本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}