I'm developing a Asp.Net MVC5 Application.I have created 3 Projects inside a solution.
The Problem is when I am trying to use Domain class file into Asp.Net MVC Application errors are coming.I unable to use the domain namespace in Asp.Net MVC Application project.
using SportsStore.Domain.Abstract; using SportsStore.Domain.Entities;
this are the name spaces try to use inside Asp.Net MVC Application Here-Abstract and Entities are folder inside the class Library-Domain
using SportsStore.Domain.Abstract;
using SportsStore.Domain.Entities;
private void AddBindings()
{
Mock<IProductRepository> mock = new Mock<IProductRepository>();
mock.Setup(m => m.Products).Returns(new List<Product>
{
new Product { Name = "Football", Price = 25 },
new Product { Name = "Surf board", Price = 179 },
new Product { Name = "Running shoes", Price = 95 }
});
kernel.Bind<IProductRepository>().ToConstant(mock.Object);
}
This codes are for IDependencyResolver Making a Mock Repository
I unable to add that AddBindings
you have to add reference to class library first then you'll be able to bring namespaces. Right-click on reference file in class library there we will come projects
tab then select your mvc project there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.