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


C# ICollection.AsQueryable方法代码示例

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


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

示例1: SetUp

 public void SetUp()
 {
     mockBackingCollection = new List<Student>();
     mockRepository = new Mock<IRepository<Student>>();
     mockRepository.Setup(r => r.ElementType).Returns(() => mockBackingCollection.AsQueryable().ElementType);
     mockRepository.Setup(r => r.Expression).Returns(() => mockBackingCollection.AsQueryable().Expression);
     mockRepository.Setup(r => r.Provider).Returns(() => mockBackingCollection.AsQueryable().Provider);
     unitOfWorkWithMock = new Mock<IStudentUnitOfWork>();
     unitOfWorkWithMock.SetupGet(u => u.Students).Returns(mockRepository.Object);
     serviceWithMock = new StudentService(unitOfWorkWithMock.Object);
 }
开发者ID:jennings,项目名称:DotNetDataAccess,代码行数:11,代码来源:StudentServiceTestsWithMock.cs

示例2: SetUp

 public void SetUp()
 {
     // Setting up the test using a mock
     mockBackingCollection = new List<Student>();
     mockDbSet = new Mock<IDbSet<Student>>();
     mockDbSet.Setup(s => s.ElementType).Returns(mockBackingCollection.AsQueryable().ElementType);
     mockDbSet.Setup(s => s.Expression).Returns(mockBackingCollection.AsQueryable().Expression);
     mockDbSet.Setup(s => s.Provider).Returns(mockBackingCollection.AsQueryable().Provider);
     contextWithMock = new Mock<StudentContext>();
     contextWithMock.SetupGet(s => s.Students).Returns(mockDbSet.Object);
     serviceWithMock = new StudentService(contextWithMock.Object);
 }
开发者ID:jennings,项目名称:DotNetDataAccess,代码行数:12,代码来源:ThingyTestsWithMock.cs

示例3: TracerSucces

 // Tracer Success
 private void TracerSucces(DateTime current, ICollection<OperationRawSG> _raws)
 {
     var traceur = new ChargementTraceur(groupeId);
     var rapport1 = traceur.SaveForRapportSuccess(current, _raws.AsQueryable<OperationRawSG>());
     int nb = _raws.Count();
     var trace1 = traceur.Success(current, nb, rapport1);
     uow.TraceLog.Add(trace1);
 }
开发者ID:paulkornikov,项目名称:Pragonas,代码行数:9,代码来源:ChargementProcessus.cs

示例4: GetPBS

        public static List<PBS> GetPBS(ICollection<Product> products = null)
        {
            var prods = products != null ? products.AsQueryable() : Context.Inst.ProductSet.AsQueryable();

            var pbsList = (from p in prods
                           from bp in Context.Inst.BegemotProductSet
                           where p.Article == bp.Article
                           let s = Context.Inst.BegemotSalePriceSet.FirstOrDefault(bs =>
                               bs.BegemotSale.Active && bs.Article == p.Article)
                           select new PBS
                              {
                                  Product = p,
                                  BProduct = bp,
                                  BSale = s
                              }).ToList();
            return pbsList;
        }
开发者ID:poolsar,项目名称:LotCreator,代码行数:17,代码来源:Product.cs


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