Пример #1
0
        public override ISelectStatement <TEntity> HavingCountAll <T>(
            Comparison comparison,
            int value)
        {
            ThrowIfGroupingNotInitialised();
            var havings = Specification.Havings;
            var havingSpecification1 = new SelectStatementHavingSpecification();

            havingSpecification1.Aggregation = Aggregation.Count;
            havingSpecification1.EntityType  = typeof(T);
            havingSpecification1.Identifier  = "*";
            havingSpecification1.Operator    = OperatorStringFromComparison(comparison);
            havingSpecification1.Value       = FormatValue(value);
            var havingSpecification2 = havingSpecification1;

            havings.Add(havingSpecification2);
            return(this);
        }
Пример #2
0
        protected override void AddHavingSpecification <T>(
            Expression <Func <T, bool> > selector,
            Aggregation aggregation,
            string alias = null)
        {
            var body    = selector.Body as BinaryExpression;
            var havings = Specification.Havings;
            var havingSpecification1 = new SelectStatementHavingSpecification();

            havingSpecification1.Aggregation = aggregation;
            havingSpecification1.Alias       = alias;
            havingSpecification1.EntityType  = typeof(T);
            havingSpecification1.Identifier  = GetMemberName(body.Left);
            havingSpecification1.Operator    = OperatorString(body.NodeType);
            havingSpecification1.Value       = FormatValue(GetExpressionValue(selector));
            var havingSpecification2 = havingSpecification1;

            havings.Add(havingSpecification2);
        }