Пример #1
0
        public GroupSearchModel FindById(int groupId)
        {
            var result = _context.Groups.Where(v => v.GroupId == groupId);

            result = (IQueryable <Group>)ExpandOperator.ExpandRelatedEntities <Group>(result);

            var group       = result.FirstOrDefault();
            var groupSearch = GroupOperator.SetGroupSearchModelCascade(group);

            return(groupSearch);
        }
Пример #2
0
        public IEnumerable <GroupSearchModel> GetAll()
        {
            var queryData = from G in _context.Groups
                            select G;

            var result = QueryOperate <Group> .Execute(queryData);

            result = (IQueryable <Group>)ExpandOperator.ExpandRelatedEntities <Group>(result);

            //以下执行完后才会去数据库中查询
            var groups       = result.ToList();
            var groupsSearch = GroupOperator.SetGroupSearchModelCascade(groups);

            return(groupsSearch);
        }