コード例 #1
0
ファイル: RuleBuilder.cs プロジェクト: dotnetKyle/Stencil
        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");
        }
コード例 #2
0
        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
                       ));
        }
コード例 #3
0
ファイル: RuleBuilder.cs プロジェクト: dotnetKyle/Stencil
 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));
 }