本文整理匯總了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>();
}