当前位置: 首页>>代码示例>>C#>>正文


C# Expression.TypeConvert方法代码示例

本文整理汇总了C#中System.Linq.Expressions.Expression.TypeConvert方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.TypeConvert方法的具体用法?C# Expression.TypeConvert怎么用?C# Expression.TypeConvert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Linq.Expressions.Expression的用法示例。


在下文中一共展示了Expression.TypeConvert方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

        public DalTopicTag Get(Expression<Func<DalTopicTag, bool>> filter)
        {
            var query = _dbSetTopicTags;

            return filter != null
                ? query.Where(filter.TypeConvert<DalTopicTag, TopicTag>()).SingleOrDefault().ToDalTopicTag()
                : default(DalTopicTag);
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:8,代码来源:TopicTagRepository.cs

示例2: Get

        public DalPost Get(Expression<Func<DalPost, bool>> filter)
        {
            var query = _dbSetPosts.Include(p => p.MembershipUser);

            return filter != null
                ? query.Where(filter.TypeConvert<DalPost, Post>()).SingleOrDefault().ToDalPost()
                : default(DalPost);
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:8,代码来源:PostRepository.cs

示例3: Get

        public DalCategory Get(Expression<Func<DalCategory, bool>> filter)
        {
            var query = _dbSetCategories.Include(c=>c.Topics);

            return filter != null
                ? query.Where(filter.TypeConvert<DalCategory, Category>()).SingleOrDefault().ToDalCategory()
                : default(DalCategory);
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:8,代码来源:CategoryRepository.cs

示例4: Get

        public DalMembershipUser Get(Expression<Func<DalMembershipUser, bool>> filter)
        {
            var query = _dbSetUsers.Include(x=>x.MembershipRoles);

            if (filter != null)
            {
                return query.Where(filter.TypeConvert<DalMembershipUser,MembershipUser>()).SingleOrDefault().ToDalUser();
            }
            return default(DalMembershipUser);
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:10,代码来源:MembershipRepository.cs

示例5: Get

        public DalMembershipRole Get(Expression<Func<DalMembershipRole, bool>> filter)
        {
            var query = _dbSetRoles;

            if (filter != null)
            {
                return
                    query.Where(filter.TypeConvert<DalMembershipRole, MembershipRole>()).SingleOrDefault().ToDalRole();
            }
            return default(DalMembershipRole);
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:11,代码来源:RoleRepository.cs

示例6: GetMany

        public IEnumerable<DalPost> GetMany(Expression<Func<DalPost, bool>> filter)
        {
            IQueryable<Post> query = _dbSetPosts.Include(p => p.MembershipUser);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalPost());
            }

            return
                query.Where(filter.TypeConvert<DalPost, Post>())
                    .ToList()
                    .Select(user => user.ToDalPost());
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:14,代码来源:PostRepository.cs

示例7: GetMany

        public IEnumerable<DalTopicTag> GetMany(Expression<Func<DalTopicTag, bool>> filter)
        {
            IQueryable<TopicTag> query = _dbSetTopicTags;

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalTopicTag());
            }

            return
                query.Where(filter.TypeConvert<DalTopicTag, TopicTag>())
                    .ToList()
                    .Select(user => user.ToDalTopicTag());
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:14,代码来源:TopicTagRepository.cs

示例8: Get

        public DalTopic Get(Expression<Func<DalTopic, bool>> filter)
        {
            var query = _dbSetTopics
                .Include(t => t.Posts)
                .Include(t => t.TopicTags)
                .Include(t => t.MembershipUser);

            if (filter != null)
            {
                var result =
                    query.Where(filter.TypeConvert<DalTopic, Topic>()).SingleOrDefault();
                return result.ToDalTopic();
            }
            return default(DalTopic);
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:15,代码来源:TopicRepository.cs

示例9: GetMany

        public IEnumerable<DalMembershipRole> GetMany(Expression<Func<DalMembershipRole, bool>> filter)
        {
            IQueryable<MembershipRole> query = _dbSetRoles;

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalRole());
            }

            return
                query.Where(filter.TypeConvert<DalMembershipRole, MembershipRole>())
                    .ToList()
                    .Select(user => user.ToDalRole());
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:14,代码来源:RoleRepository.cs

示例10: GetMany

        public IEnumerable<DalCategory> GetMany(Expression<Func<DalCategory, bool>> filter)
        {
            IQueryable<Category> query = _dbSetCategories.Include(c => c.Topics);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalCategory());
            }

            return
                query.Where(filter.TypeConvert<DalCategory, Category>())
                    .ToList()
                    .Select(user => user.ToDalCategory());
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:14,代码来源:CategoryRepository.cs

示例11: GetMany

        public IEnumerable<DalMembershipUser> GetMany(Expression<Func<DalMembershipUser, bool>> filter)
        {
            IQueryable<MembershipUser> query = _dbSetUsers.Include(x => x.MembershipRoles);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalUser());
            }

            return query.Where(filter.TypeConvert<DalMembershipUser,MembershipUser>()).ToList().Select(user=>user.ToDalUser());
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:11,代码来源:MembershipRepository.cs

示例12: GetMany

        public IEnumerable<DalTopic> GetMany(Expression<Func<DalTopic, bool>> filter)
        {
            IQueryable<Topic> query = _dbSetTopics
                .Include(t => t.Posts)
                .Include(t => t.TopicTags)
                .Include(t => t.MembershipUser);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalTopic());
            }

            return
                query.Where(filter.TypeConvert<DalTopic, Topic>())
                    .ToList()
                    .Select(user => user.ToDalTopic());
        }
开发者ID:Alukar,项目名称:ForumMVC,代码行数:17,代码来源:TopicRepository.cs


注:本文中的System.Linq.Expressions.Expression.TypeConvert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。