Пример #1
0
        public static Criterion From <T>(Expression <Func <T, bool> > criterion) where T : IEntity
        {
            if (criterion == null)
            {
                throw new ArgumentNullException(nameof(criterion));
            }

            var methodCallExpression = criterion.Body as MethodCallExpression;

            if (methodCallExpression != null)
            {
                return(From(methodCallExpression));
            }

            var binaryExpression = criterion.Body as BinaryExpression;

            if (binaryExpression != null)
            {
                return(From(binaryExpression));
            }

            return(CriteriaExtractor <T> .CreateCriterion(criterion.Body));
        }
Пример #2
0
 static Criterion CreateByExpression <T>(Expression expression) where T : IEntity =>
 CriteriaExtractor <T> .CreateCriterion(expression);