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


C# IQueryable.ToDictionary方法代码示例

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


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

示例1: SendReminderMail

        public void SendReminderMail(int activityId, IQueryable<User> senderList, EmailType emailType, string freeText = "")
        {
            var activity = _activityRepository.GetActivityById(activityId);
            var toAddressToName = senderList.ToDictionary(teamMember => teamMember.Email, teamMember => teamMember.Name);
            var text = NewEventText(activity, emailType, "");

            SendMail(toAddressToName, _emailSettings.From, activity.OrganizingTeam.Name, text.Subject, text.Body);
        }
开发者ID:kodkatten,项目名称:TeamRynkeby,代码行数:8,代码来源:EmailService.cs

示例2: sortMoviesBasedOnUserPreference

 private static IEnumerable<Movie> sortMoviesBasedOnUserPreference(IQueryable<Movie> allMovies, UserMoviePreference userPreference)
 {
     var moviesById = allMovies.ToDictionary(m => m.Id);
     var sortedMovies = new List<Movie>();
     foreach (var id in userPreference.SortOrder)
     {
         if (!moviesById.ContainsKey(id)) continue;
         sortedMovies.Add(moviesById[id]);
         moviesById.Remove(id);
     }
     foreach (var remainingMovieId in moviesById.Keys.OrderBy(id => id))
     {
         sortedMovies.Add(moviesById[remainingMovieId]);
     }
     return sortedMovies;
 }
开发者ID:shashankshetty,项目名称:fubumvc-examples,代码行数:16,代码来源:ListEndpoint.cs

示例3: FavoriteCollectionResponseMapping

        public List<FavoriteInfoResponse> FavoriteCollectionResponseMapping(IQueryable<FavoriteEntity> source,
                                                                                   CoordinateInfo coordinateInfo)
        {
            if (source == null)
            {
                return new List<FavoriteInfoResponse>(0);
            }

            var linq = source;

            var prolist = _promotionRepository.Get(new PromotionFilter
                {
                    DataStatus = DataStatus.Normal,
                });
            var prodList = _productRepository.Get(null, new ProductFilter
                {
                    DataStatus = DataStatus.Normal,
                });

            var linqPro = linq.Where(v => v.FavoriteSourceType == (int)SourceType.Promotion)
                              .Join(prolist, p => p.FavoriteSourceId,
                                    f => f.Id,
                                    (p, f) =>
                                    new
                                        {
                                            Favor = p,
                                            Pro = f
                                        }
                );
            var linqProd = linq.Where(v => v.FavoriteSourceType == (int)SourceType.Product)
                              .Join(prodList, p => p.FavoriteSourceId,
                                    f => f.Id,
                                    (p, f) =>
                                                                        new
                                                                        {
                                                                            Favor = p,
                                                                            Prod = f
                                                                        }
                );

            var itemRepoonse = ItemsInfoResponseMapping(linqProd.Select(v => v.Prod), linqPro.Select(v => v.Pro), coordinateInfo, false);

            //sort
            //itemRepoonse = itemRepoonse.OrderByDescending(v => v.CreatedDate);
            var s = source.ToDictionary(v => String.Concat(v.FavoriteSourceId, "_", v.FavoriteSourceType), v => v);
            var list = FavoriteInfoResponseMapping(itemRepoonse, s);

            return list.OrderByDescending(v => v.CreatedDate).ToList();
        }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:49,代码来源:MappingManager.cs


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