using System.Linq.Expressions; using Luticate2.Auth.Utils.Business.Converters; 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 LuConvertersOptions Options { get; } public LuExpressionParamReplaceVisitor(LuConvertersOptions options) { Options = options; } protected override Expression VisitParameter(ParameterExpression node) { if (!Options.Parameters.ContainsKey(node)) { LuResult.Error(LuStatus.InternalError.ToInt(), $"Could not find a conversion for parameter {node}").Throw(); } return Options.Parameters[node]; } } }