Extention to NopCommerce Framework

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
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.
13 лет назад
.. where all instance of "IService" are really I{YourService}, e.g. ISuperDuperService. Correct? That's how I implemented. Thanks for sharing.

You can also extend the likes of ProductService and CustomerService by creating an "Extensions" directory in the BusinessLogic project and adding partial classes, and this is closer to how we implemented. The core service classes are partial classes. However, their members are sealed, so it is necessary to add to partial rather than inherit in an isolated project (which slightly reeks but we'll live).
13 лет назад
As a starter.. I find this very hard to read (not your fault)

Would you mind sharing the created source code or explain the steps more detailed? a word document with screenshots would help too of course..thx :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.