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


C# IRepository.List方法代码示例

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


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

示例1: Get

 public static BlogSettings Get(IRepository repo)
 {
     return repo.List<BlogSettings>().Single();
 }
开发者ID:BjartN,项目名称:Blog,代码行数:4,代码来源:BlogSettings.cs

示例2: GetPublishedPosts

 public static IQueryable<Post> GetPublishedPosts(IRepository repository)
 {
     //TODO: Limitation in current version of the Norm driver. Need to pull everything
     return repository.List<Post>()
         .Where(x => x.IsPublished).ToList()
         .OrderByDescending(x => x.Created).AsQueryable();
 }
开发者ID:BjartN,项目名称:Blog,代码行数:7,代码来源:Post.cs

示例3: GetTags

 public static IQueryable<Tag> GetTags(IRepository repository)
 {
     //TODO: Nasty. Need to deal with m-m relationships in some way....
     var posts = repository.List<Post>().ToList();
     var tags = new List<Tag>();
     foreach(var post in posts)
     {
         tags = tags.Union(post.Tags).Distinct().ToList();
     }
     return tags.AsQueryable();
 }
开发者ID:BjartN,项目名称:Blog,代码行数:11,代码来源:Post.cs

示例4: GenerateRouteDirectionReals

        private static void GenerateRouteDirectionReals(Route route, IRepository rep)
        {
            Dictionary<string, Route> s_routes = null;
            if (s_routes == null)
            {
                var routes = rep.List<Route>();
                s_routes = new Dictionary<string, Route>();
                foreach (var i in routes)
                {
                    s_routes[i.Name] = i;
                }
            }
            string realRoute = route.DirectionExpression;
            if (string.IsNullOrEmpty(route.DirectionExpression))
            {
                route.DirectionReal = null;
                return;
            }

            string[] subRoute = route.DirectionExpression.Split(new char[] {'|', '(', ')' }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < subRoute.Length; ++i)
            {
                string s = subRoute[i].Trim();
                if (s_routes.ContainsKey(s))
                {
                    if (string.IsNullOrEmpty(s_routes[s].DirectionReal))
                    {
                        GenerateRouteDirectionReals(s_routes[s], rep);
                    }
                    if (string.IsNullOrEmpty(s_routes[s].DirectionReal))
                    {
                        throw new ArgumentException(string.Format("There is no route named of {0}", subRoute[i]));
                    }
                    realRoute = realRoute.Replace(subRoute[i], s_routes[subRoute[i]].DirectionReal);
                }
            }
            route.DirectionReal = realRoute;
        }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:39,代码来源:RouteHelper.cs


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