To create a Service Class in Project
1) Create Table in Database
2) Update the edmx to include the added table
3) Create class having same name of type defined in edmx.cs file
4) Include needed properties in created class. This will cover all Database Layer.
5) Now to create Business Layer Create Service Interface IService.cs6) Create Service Class Service.cs
7) Implement IService interface into Service class8) In UnityDependencyResolver.cs class add following code in Method
Protected virtual void ConfigureContainer (IUnityContainer container)
i.e.
conteainer.RegisterType<IService, Service> (new unityPerExecutionContextLifetimeManager ());
This will complete all Business Layer with Dependency Injection.
9) Now to use the service in UI Layer
Add following code in BaseNopUserControl.cs
Public IService Service
{
Get {return IoC.Resolve<IService>(); }
}10) Create User Control
Inherit user control from BaseNopUserControl
11) Now there you find property with name of service class. And you can access the methods to use.