本文整理汇总了C#中SportsStore.Domain.Entities.Product.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# Product.AsQueryable方法的具体用法?C# Product.AsQueryable怎么用?C# Product.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SportsStore.Domain.Entities.Product
的用法示例。
在下文中一共展示了Product.AsQueryable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBindings
private void AddBindings()
{
// put additional bindings here
var prods = new Product[] {
new Product{ProductID =1, Name ="Mangos", Category="Fruit", Description="Summer gift", Price=12M},
new Product{ProductID =2, Name ="Apples", Category="Fruit", Description="spring gift", Price=20M},
new Product{ProductID =3, Name ="Nike Joggers", Category="Sports", Description="football fever", Price=13M},
new Product{ProductID =4, Name ="Calculator", Category="Accounting", Description="japaniiii", Price=52M},
new Product{ProductID =5, Name ="PC", Category="Computers", Description="I am PC", Price=92M},
new Product{ProductID =6, Name ="MAC", Category="Computers", Description="I am Mac", Price=120M}
};
//Mocking IProduct and setting what will its Products property will return
Mock<IProductRepository> mock = new Mock<IProductRepository>();
mock.Setup(m => m.Products).Returns(prods.AsQueryable());
//Registering the Mock object with IProductRepository
//ninjectKernel.Bind<IProductRepository>().ToConstant(mock.Object);
ninjectKernel.Bind<IProductRepository>().To<EFProductRepository>();
EmailSettings emailSettings = new EmailSettings
{
WriteAsFile
= bool.Parse(ConfigurationManager.AppSettings["Email.WriteAsFile"] ?? "false")
};
ninjectKernel.Bind<IOrderProcessor>()
.To<EmailOrderProcessor>().WithConstructorArgument("settings", emailSettings);
ninjectKernel.Bind<IAuthProvider>().To<FormsAuthProvider>();
}