public RuleBuilder(StencilEngineService <T> service, Expression <Func <T, TValue> > propertyExpression) { _service = service; PropertyExpression = propertyExpression; var memberExpr = propertyExpression.Body as MemberExpression ?? throw new ArgumentException("The property expression must be a Member"); propInfo = memberExpr.Member as PropertyInfo ?? throw new ArgumentException("The property expression must be a Property"); }
public StencilEngineService <T> Build() { if (storedTemplateProperty == null) { throw new ArgumentNullException("The Stored Template property is required."); } if (defaultTemplate == null) { throw new ArgumentNullException("The Default Template property is required."); } return(StencilEngineService <T> .New <T>( storedTemplateProperty, defaultTemplate, backupTemplate )); }
public static RuleBuilder <T, TValue> NewRuleFor <T, TValue>(this StencilEngineService <T> engine, Expression <Func <T, TValue> > propertyExpression) where T : class { return(new RuleBuilder <T, TValue>(engine, propertyExpression)); }