You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuExpressionParamReplaceVisitor.cs 846B

12345678910111213141516171819202122232425262728
  1. using System.Linq.Expressions;
  2. using Luticate2.Auth.Dbo;
  3. using Luticate2.Auth.Dbo.Result;
  4. using Luticate2.Auth.Exceptions;
  5. namespace Luticate2.Auth.Business.ExpressionConverter
  6. {
  7. public class LuExpressionParamReplaceVisitor : ExpressionVisitor
  8. {
  9. public LuExpressionConverterOptions Options { get; }
  10. public LuExpressionParamReplaceVisitor(LuExpressionConverterOptions options)
  11. {
  12. Options = options;
  13. }
  14. protected override Expression VisitParameter(ParameterExpression node)
  15. {
  16. if (!Options.Parameters.ContainsKey(node))
  17. {
  18. LuResult<Expression>.Error(LuStatus.InternalError.ToInt(),
  19. $"Could not find a conversion for parameter {node}").Throw();
  20. }
  21. return Options.Parameters[node];
  22. }
  23. }
  24. }