Пример #1
0
        public async Task <Tuple <List <Children>, int> > GetList()
        {
            System.Linq.Expressions.Expression <Func <Children, bool> >   where1   = x => x.Main.Telphone.Contains("11");
            System.Linq.Expressions.Expression <Func <Children, string> > orderby1 = x => x.Name;
            var dt = await _iChildrenRepository.Query <string>(where1, orderby1, true, 1, 10);

            System.Linq.Expressions.Expression <Func <Main, bool> > where = x => x.Telphone.Contains("11");
            System.Linq.Expressions.Expression <Func <Main, string> > orderby = x => x.Name;
            var data = await _iMainRepository.Query <string>(where, orderby, true, 1, 10);

            return(dt);
        }
Пример #2
0
        public async Task <Tuple <List <Main>, int> > GetList()
        {
            //ef 跟踪查询
            Expression <Func <Children, bool> > where1   = x => x.Main.Telphone.Contains("11");
            Expression <Func <Children, int> >  orderby1 = x => x.Id;
            var dt = await _iChildrenRepository.Query(where1, orderby1, true, 1, 10);

            //更新数据
            var put = dt.Item1.FirstOrDefault();

            put.Name = "非跟踪更新";
            await _iChildrenRepository.Update(put);

            Expression <Func <Main, bool> > where = x => x.Telphone.Contains("11");
            Expression <Func <Main, string> > orderby = x => x.Name;
            var data = await Query(where, orderby, true, 1, 10);

            return(data);
        }