Example #1
0
        /// <summary>
        /// 创建查询
        /// </summary>
        public IDbQueryable <TResult> CreateQuery <TResult>(DbExpression exp = null)
        {
            IDbQueryable <TResult> query = new DbQueryable <TResult>
            {
                DbContext     = _context,
                DbExpressions = new List <DbExpression>(_dbExpressions)
            };

            if (exp != null)
            {
                query.DbExpressions.Add(exp);
            }
            return(query);
        }
Example #2
0
        /// <summary>
        /// 返回特定类型的对象的集合,其中类型由 T 参数定义
        /// </summary>
        public IDbQueryable <T> GetTable <T>()
        {
            DbQueryable <T> queryable = new DbQueryable <T> {
                DbContext = this
            };

            queryable.DbExpressions = new List <DbExpression> {
                new DbExpression
                {
                    DbExpressionType = DbExpressionType.GetTable,
                    Expressions      = new[] { Expression.Constant(typeof(T)) }
                }
            };
            return(queryable);
        }