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


C# IQueryable.AsQueryable方法代码示例

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


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

示例1: MemberList

        public IEnumerable<DirectoryInfo> MemberList()
        {
            members = FetchMembers();
            if (!count.HasValue)
                count = Count();

            var q1 = members.AsQueryable();

            if (Sort == "Birthday")
                q1 = from p in q1
                     orderby DbUtil.Db.NextBirthday(p.PeopleId)
                     select p;
            else
            {
                var qf = (from p in members
                          let famname = p.Family.People.Single(hh => hh.PeopleId == hh.Family.HeadOfHouseholdId).Name2
                          group p by new {famname, p.FamilyId}
                          into g
                          orderby g.Key.famname, g.Key.FamilyId
                          select g.Max(pp => pp.FamilyId)).Skip(StartRow).Take(PageSize);
                ;
                q1 = from p in q1
                     where qf.Contains(p.FamilyId)
                     let pos = (p.PositionInFamilyId == 10 ? p.GenderId : 1000 - (p.Age ?? 0))
                     let famname = p.Family.People.Single(hh => hh.PeopleId == hh.Family.HeadOfHouseholdId).Name2
                     orderby famname, p.FamilyId, p.PositionInFamilyId == 10 ? p.GenderId : 1000 - (p.Age ?? 0)
                     select p;
            }

            var q2 = from p in q1
                     select new DirectoryInfo
                     {
                         Family = p.LastName,
                         FamilyId = p.FamilyId,
                         Name = p.PreferredName,
                         Suffix = p.SuffixCode,
                         Birthday = p.BirthDate.ToString2("m"),
                         Address = p.PrimaryAddress,
                         Address2 = p.PrimaryAddress2,
                         CityStateZip = p.CityStateZip,
                         Cell = p.CellPhone.FmtFone("C"),
                         Home = p.HomePhone.FmtFone("H"),
                         Email = (p.SendEmailAddress1 ?? true) ? p.EmailAddress : "",
                         Email2 = (p.SendEmailAddress2 ?? false) ? p.EmailAddress2 : "",
                         DoNotPublishPhones = p.DoNotPublishPhones
                     };

            return q2;
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:49,代码来源:MemberDirectoryModel.cs

示例2: EstablishContext

        protected override void EstablishContext()
        {
            studentIndicatorRepository = mocks.StrictMock<IRepository<StudentIndicator>>();
            studentSchoolInformationRepository = mocks.StrictMock<IRepository<StudentSchoolInformation>>();
            idNameService = mocks.StrictMock<Resources.School.IIdNameService>();
            
            suppliedData = ReturnSuppliedData();

            Expect.Call(studentIndicatorRepository.GetAll()).Return(suppliedData.AsQueryable());
            Expect.Call(studentSchoolInformationRepository.GetAll()).Return(GetSuppliedStudentSchoolInformation());
            
            Expect.Call(idNameService.Get(null))
                .Constraints(new ActionConstraint<Resources.School.IdNameRequest>(x => Assert.That(x.SchoolId, Is.EqualTo(schoolId0))))
                .Return(GetSuppliedSchoolIdNameModel());
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:15,代码来源:StudentAccommodationFixture.cs

示例3: Filter

        public IQueryable<Contract> Filter(IQueryable<Contract> items, IEnumerable<ColumnFilterInfo> filterCriteria)
        {
            if (filterCriteria == null)
            {
                return items;
            }

            var result = items.AsQueryable();
            foreach (var filterCriterion in filterCriteria)
            {
                result = this.headFilter.Filter(filterCriterion, result);
            }

            return result;
        }
开发者ID:akesy,项目名称:HR-Contracts-Module,代码行数:15,代码来源:ContractFilter.cs

示例4: SetRecipients

        private void SetRecipients( Panel pnl, HtmlAnchor htmlAnchor, Literal literalControl, 
            Grid grid, IQueryable<CommunicationRecipient> qryRecipients )
        {
            pnl.CssClass = pnlOpened.Visible ? "col-md-2-10 margin-b-md" : "col-md-3 margin-b-md";

            int count = qryRecipients.Count();

            if ( count <= 0 )
            {
                htmlAnchor.Attributes["disabled"] = "disabled";
            }
            else
            {
                htmlAnchor.Attributes.Remove( "disabled" );
            }

            literalControl.Text = count.ToString( "N0" );

            var sortProperty = grid.SortProperty;
            if ( sortProperty != null )
            {
                qryRecipients = qryRecipients.AsQueryable().Sort( sortProperty );

            }
            else
            {
                qryRecipients = qryRecipients.OrderBy( r => r.PersonAlias.Person.LastName ).ThenBy( r => r.PersonAlias.Person.NickName );
            }

            grid.SetLinqDataSource( qryRecipients );
            grid.DataBind();
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:32,代码来源:CommunicationDetail.ascx.cs


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