12345678910111213141516171819202122232425262728 |
- using System.Linq.Expressions;
- using Luticate2.Auth.Utils.Dbo;
- using Luticate2.Auth.Utils.Dbo.Result;
- using Luticate2.Auth.Utils.Exceptions;
-
- namespace Luticate2.Auth.Utils.Business.ExpressionConverter
- {
- public class LuExpressionParamReplaceVisitor : ExpressionVisitor
- {
- public LuExpressionConverterOptions Options { get; }
-
- public LuExpressionParamReplaceVisitor(LuExpressionConverterOptions options)
- {
- Options = options;
- }
-
- protected override Expression VisitParameter(ParameterExpression node)
- {
- if (!Options.Parameters.ContainsKey(node))
- {
- LuResult<Expression>.Error(LuStatus.InternalError.ToInt(),
- $"Could not find a conversion for parameter {node}").Throw();
- }
-
- return Options.Parameters[node];
- }
- }
- }
|