示例#1
0
        public static IList <TEntity> SelectWith <TEntity, TKey>(this Table <TEntity> t, int skip, int count, ref int total, Expression <Func <TEntity, bool> > predicate, Expression <Func <TEntity, TKey> > orderKey, bool isDesc, params Expression <Func <TEntity, object> >[] objects) where TEntity : class
        {
            InpinkeDataContext udc = new InpinkeDataContext();
            DataLoadOptions    dlo = new DataLoadOptions();

            foreach (Expression <Func <TEntity, object> > obj in objects)
            {
                dlo.LoadWith(obj);
            }
            udc.LoadOptions = dlo;
            IList <TEntity> list = udc.GetTable <TEntity>().Select(skip, count, ref total, predicate, orderKey, isDesc);

            return(list);
        }
示例#2
0
        public static TEntity GetWith <TEntity>(this Table <TEntity> t, Expression <Func <TEntity, bool> > predicate, params Expression <Func <TEntity, object> >[] objects) where TEntity : class
        {
            InpinkeDataContext udc = new InpinkeDataContext();
            DataLoadOptions    dlo = new DataLoadOptions();

            foreach (Expression <Func <TEntity, object> > obj in objects)
            {
                dlo.LoadWith(obj);
            }
            udc.LoadOptions = dlo;
            TEntity te = udc.GetTable <TEntity>().SingleOrDefault(predicate);

            return(te);
        }