Beispiel #1
0
        public IDataServiceQueryable <TEntity, TBase> Where(Expression <Func <TEntity, bool> > where)
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            queriable.Filters.Add(new Filter(where));
            return(queriable);
        }
        public static IDataServiceQueryable <TEntity, TBase> Where <TEntity, TBase>(this IDataServiceQueryable <TEntity, TBase> queriable, RLinq.LambdaExpression expression) where TEntity : TBase where TBase : Entity
        {
            var newQueriable = new DataServiceQueryableImp <TEntity, TBase>((DataServiceQueryable <TEntity, TBase>)queriable);

            newQueriable.Filters.Add(new DataServiceQueryable <TEntity, TBase> .Filter(expression));
            return(newQueriable);
        }
Beispiel #3
0
        public IDataServiceQueryable <TEntity, TBase> IncludeTotalCount()
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            queriable.QueryTotalCount = true;
            return(queriable);
        }
Beispiel #4
0
        public IDataServiceQueryable <TEntity, TBase> IncludeData(bool includeData = true)
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            queriable.QueryData = includeData;
            return(queriable);
        }
Beispiel #5
0
        public IDataServiceQueryable <TEntity, TBase> SetClientInfo(ClientInfo clientInfo)
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            queriable.ClientInfo = clientInfo;
            return(queriable);
        }
Beispiel #6
0
        public IDataServiceQueryable <TEntity, TBase> Take(int number)
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            queriable.TakeValue = number;
            return(queriable);
        }
Beispiel #7
0
        public IDataServiceQueryable <TEntity, TBase> Include(string include)
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            queriable.IncludeValues.Add(include);
            return(queriable);
        }
Beispiel #8
0
        public IDataServiceQueryable <T, TBase> OfType <T>() where T : TEntity
        {
            var queriable = new DataServiceQueryableImp <T, TBase>(this.EntitySet, this);

            queriable.OfTypeValue = new Aqua.TypeSystem.TypeInfo(typeof(T));
            return(queriable);
        }
Beispiel #9
0
        public IDataServiceQueryable <TEntity, TEntity> AsQueryable()
        {
            if (_queryDelegate == null)
            {
                throw new Exception(string.Format("There is no query procedure for entity type '{0}'. Check whether this entity is not a aggregate root and needs to be loaded through its aggregate root.", typeof(TEntity)));
            }

            var queryable = new DataServiceQueryableImp <TEntity, TEntity>(this);

            return(queryable);
        }
        public long LongCount()
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            queriable.QueryData       = false;
            queriable.QueryTotalCount = true;

            var result = queriable.Execute();

            return(result.EntitySet.TotalCount.Value);
        }
Beispiel #11
0
        private IDataServiceQueryable <TEntity, TBase> WhereIn <TValue>(Expression <Func <TEntity, TValue> > propertySelector, IEnumerable <TValue> values, bool doNegate)
        {
            //if (!values.Any())
            //{
            //    return Where(e => false);
            //}

            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            var collectionExpression = Expression.Constant(values);
            var compareExpression    = Expression.Call(null, EnumerableContainsMethodInfo.MakeGenericMethod(typeof(TValue)), collectionExpression, propertySelector.Body) as Expression;

            if (doNegate)
            {
                compareExpression = Expression.MakeUnary(ExpressionType.Not, compareExpression, typeof(bool));
            }
            var parameter        = propertySelector.Parameters[0];
            var lambdaExpression = Expression.Lambda <Func <TEntity, bool> >(compareExpression, parameter);

            queriable.Filters.Add(new Filter(lambdaExpression));

            return(queriable);
        }
        /// <summary>
        /// Gets a data service queriable for the specific entity type
        /// </summary>
        public IDataServiceQueryable <TEntity, TBase> AsQueryable()
        {
            var queriable = new DataServiceQueryableImp <TEntity, TBase>(this);

            return(queriable);
        }
            IDataServiceQueryable <TEntity, TEntity> IEntitySet <TEntity> .AsQueryable()
            {
                var queryable = new DataServiceQueryableImp <TEntity, TEntity>(_entitySet);

                return(queryable);
            }