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


C# IQueryable.Join方法代码示例

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


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

示例1: GetQuests

        /// <summary>
        /// returns quests localized for a given culture
        /// </summary>
        /// <param name="source">the data source</param>
        /// <param name="culture">the localization culture</param>
        /// <returns>quests converted from source</returns>
        private IEnumerable<Quest> GetQuests(IQueryable<quest_template> source, CultureInfo culture)
        {
            var join = source
                .Join(_context.locales_quest, o => o.entry, o => o.entry, (it, li) => new { it, li });

            switch (LocalizationHelper.GetOffset(culture))
            {
                case 1: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc1, Details = o.li.Details_loc1, Objectives = o.li.Objectives_loc1, OfferRewardText = o.li.OfferRewardText_loc1, RequestItemsText = o.li.RequestItemsText_loc1, EndText = o.li.EndText_loc1, CompletedText = o.li.CompletedText_loc1, ObjectiveText1 = o.li.ObjectiveText1_loc1, ObjectiveText2 = o.li.ObjectiveText2_loc1, ObjectiveText3 = o.li.ObjectiveText3_loc1, ObjectiveText4 = o.li.ObjectiveText4_loc1 });
                case 2: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc2, Details = o.li.Details_loc2, Objectives = o.li.Objectives_loc2, OfferRewardText = o.li.OfferRewardText_loc2, RequestItemsText = o.li.RequestItemsText_loc2, EndText = o.li.EndText_loc2, CompletedText = o.li.CompletedText_loc2, ObjectiveText1 = o.li.ObjectiveText1_loc2, ObjectiveText2 = o.li.ObjectiveText2_loc2, ObjectiveText3 = o.li.ObjectiveText3_loc2, ObjectiveText4 = o.li.ObjectiveText4_loc2 });
                case 3: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc3, Details = o.li.Details_loc3, Objectives = o.li.Objectives_loc3, OfferRewardText = o.li.OfferRewardText_loc3, RequestItemsText = o.li.RequestItemsText_loc3, EndText = o.li.EndText_loc3, CompletedText = o.li.CompletedText_loc3, ObjectiveText1 = o.li.ObjectiveText1_loc3, ObjectiveText2 = o.li.ObjectiveText2_loc3, ObjectiveText3 = o.li.ObjectiveText3_loc3, ObjectiveText4 = o.li.ObjectiveText4_loc3 });
                case 4: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc4, Details = o.li.Details_loc4, Objectives = o.li.Objectives_loc4, OfferRewardText = o.li.OfferRewardText_loc4, RequestItemsText = o.li.RequestItemsText_loc4, EndText = o.li.EndText_loc4, CompletedText = o.li.CompletedText_loc4, ObjectiveText1 = o.li.ObjectiveText1_loc4, ObjectiveText2 = o.li.ObjectiveText2_loc4, ObjectiveText3 = o.li.ObjectiveText3_loc4, ObjectiveText4 = o.li.ObjectiveText4_loc4 });
                case 5: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc5, Details = o.li.Details_loc5, Objectives = o.li.Objectives_loc5, OfferRewardText = o.li.OfferRewardText_loc5, RequestItemsText = o.li.RequestItemsText_loc5, EndText = o.li.EndText_loc5, CompletedText = o.li.CompletedText_loc5, ObjectiveText1 = o.li.ObjectiveText1_loc5, ObjectiveText2 = o.li.ObjectiveText2_loc5, ObjectiveText3 = o.li.ObjectiveText3_loc5, ObjectiveText4 = o.li.ObjectiveText4_loc5 });
                case 6: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc6, Details = o.li.Details_loc6, Objectives = o.li.Objectives_loc6, OfferRewardText = o.li.OfferRewardText_loc6, RequestItemsText = o.li.RequestItemsText_loc6, EndText = o.li.EndText_loc6, CompletedText = o.li.CompletedText_loc6, ObjectiveText1 = o.li.ObjectiveText1_loc6, ObjectiveText2 = o.li.ObjectiveText2_loc6, ObjectiveText3 = o.li.ObjectiveText3_loc6, ObjectiveText4 = o.li.ObjectiveText4_loc6 });
                case 7: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc7, Details = o.li.Details_loc7, Objectives = o.li.Objectives_loc7, OfferRewardText = o.li.OfferRewardText_loc7, RequestItemsText = o.li.RequestItemsText_loc7, EndText = o.li.EndText_loc7, CompletedText = o.li.CompletedText_loc7, ObjectiveText1 = o.li.ObjectiveText1_loc7, ObjectiveText2 = o.li.ObjectiveText2_loc7, ObjectiveText3 = o.li.ObjectiveText3_loc7, ObjectiveText4 = o.li.ObjectiveText4_loc7 });
                case 8: return join.Select(o => new Quest { Id = o.it.entry, Title = o.li.Title_loc8, Details = o.li.Details_loc8, Objectives = o.li.Objectives_loc8, OfferRewardText = o.li.OfferRewardText_loc8, RequestItemsText = o.li.RequestItemsText_loc8, EndText = o.li.EndText_loc8, CompletedText = o.li.CompletedText_loc8, ObjectiveText1 = o.li.ObjectiveText1_loc8, ObjectiveText2 = o.li.ObjectiveText2_loc8, ObjectiveText3 = o.li.ObjectiveText3_loc8, ObjectiveText4 = o.li.ObjectiveText4_loc8 });
                default: return join.Select(o => new Quest { Id = o.it.entry, Title = o.it.Title, Details = o.it.Details, Objectives = o.it.Objectives, OfferRewardText = o.it.OfferRewardText, RequestItemsText = o.it.RequestItemsText, EndText = o.it.EndText, CompletedText = o.it.CompletedText, ObjectiveText1 = o.it.ObjectiveText1, ObjectiveText2 = o.it.ObjectiveText2, ObjectiveText3 = o.it.ObjectiveText3, ObjectiveText4 = o.it.ObjectiveText4 });
            }
        }
开发者ID:GetPlay,项目名称:Mangos-TEx,代码行数:24,代码来源:MangosProvider.cs

示例2: GetItems

        /// <summary>
        /// returns items localized for a given culture
        /// </summary>
        /// <param name="source">the data source</param>
        /// <param name="culture">the localization culture</param>
        /// <returns>items converted from source</returns>
        private IEnumerable<Item> GetItems(IQueryable<item_template> source, CultureInfo culture)
        {
            var join = source
                .Join(_context.locales_item, o => o.entry, o => o.entry, (it, li) => new { it, li });

            switch (LocalizationHelper.GetOffset(culture))
            {
                case 1: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc1, Description = o.li.description_loc1 });
                case 2: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc2, Description = o.li.description_loc2 });
                case 3: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc3, Description = o.li.description_loc3 });
                case 4: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc4, Description = o.li.description_loc4 });
                case 5: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc5, Description = o.li.description_loc5 });
                case 6: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc6, Description = o.li.description_loc6 });
                case 7: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc7, Description = o.li.description_loc7 });
                case 8: return join.Select(o => new Item { Id = o.it.entry, Name = o.li.name_loc8, Description = o.li.description_loc8 });
                default: return join.Select(o => new Item { Id = o.it.entry, Name = o.it.name, Description = o.it.description });
            }
        }
开发者ID:GetPlay,项目名称:Mangos-TEx,代码行数:24,代码来源:MangosProvider.cs

示例3: ExcludePausedAccounts

 private IQueryable<Facility> ExcludePausedAccounts(PSS2012DataContext context, IQueryable<Facility> facilities)
 {
     var facilitiesActive = facilities
     .Join(context.Clients, oid => oid.ClientGuid, iid => iid.ClientGuid, (oid, iid) => new { Facility = oid, Exclude = iid.AccountPaused })
             .Where(fe => !fe.Exclude)
             .Select(f => f.Facility);
     return facilitiesActive;
 }
开发者ID:ankit-defacto,项目名称:PSS,代码行数:8,代码来源:FacilityGateway.cs

示例4: TypeOfCareIntersect

        private IQueryable<Facility> TypeOfCareIntersect(PSS2012DataContext context, IQueryable<Facility> query, IEnumerable<Offering> offerings, bool wideSearch)
        {
            if (offerings.Count() > 0)
            {
                if (wideSearch)
                {
                    //wider search - includes any of the input offerings
                    var ofg = context.Offerings.Where(Offering.ContainsOfferings(offerings))
                        .Join(context.FacilityOfferings, oid => oid.OfferingGuid, iid => iid.OfferingGuid,
                        (oid, iid) => iid)
                        .Join(query, oid => oid.FacilityGuid, iid => iid.FacilityGuid, (oid, iid) => iid);
                    //
                    query = query.Intersect(ofg);
                }
                else
                {
                    // get offering guid list as queryable to avoid not supported exception
                    var offeringsAsQueryable = context.Offerings.Where(Offering.ContainsOfferings(offerings)).Select(s => s.OfferingGuid);
                    // group by guid and intersect with offerings
                    var facilityOfferings = context.FacilityOfferings
                        .GroupBy(g => g.FacilityGuid)
                        .Select(s => new { Fguid = s.Key, Fos = s.Select(ss => ss.OfferingGuid).Intersect(offeringsAsQueryable) })
                        .Where(w => w.Fos.Count() == offeringsAsQueryable.Count());
                    query = query.Join(facilityOfferings, oid => oid.FacilityGuid, iid => iid.Fguid, (oid, iid) => oid);
                }
            }

            return query.OrderBy(f => f.FacilityName);
        }
开发者ID:ankit-defacto,项目名称:PSS,代码行数:29,代码来源:FacilityGateway.cs

示例5: ClassicJoin

 private static IQueryable<long> ClassicJoin(IQueryable<Order> orders, IQueryable<OrderPosition> positions)
 {
     return orders.Join(positions, o => o.Id, p => p.OrderId, (order, position) => order.Id);
 }
开发者ID:2gis,项目名称:nuclear-join,代码行数:4,代码来源:JoinTest.cs


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