This article transferred from: http://www.tech-coder.com/2015/07/how-to-add-new-table-in-nopcommerce.html
Hey guys I am back after a long time near about 2. And hope my previous blogs help's to anyway to my friends.
So I am going to starting with Nopcommerce for what to add new table. This was the common question for newbie of Nopcommerce.
Basically here sharing my experience and you guys, that'll help.
Step by step explanation-to-add new table on Nopcommerce.
Going to explain based on the Nopcommerce source code.
So first open source code in Visual Studio then follow the below steps (Also refer any existing classes/table).
1. Create the Entity class related to table name (e.g. Enity.cs)
Path:solution\libraries\nop.core\domain\entity.cs
2. Create a Mapping class which bind class to Database table (e.g. EntityMap.cs)
Path:solution\libraries\nop.data\mapping\entitymap.cs
3. Create a Model class for MVC (i.e. for Admin or Web) (e.g EntityModel.cs)
Path:solution\presentation\nop.web\models\entitymodel.cs (for Web)
Path:solution\presentation\nop.admin\models\entitymodel.cs (for Admin)
4. Create a validator for model (e.g. EntityValidator.cs)
Path:solution\presentation\nop.web\validators\entityvalidator.cs (for Web)
Path:solution\presentation\nop.admin\validators\entityvalidator.cs (for Admin)
5. Create A Mapping Configuration on AutoMapperStartupTask.cs for Entity and Model
Path:solution\presentation\nop.admin\infrastructure
Mapping model to entity and entity to model
mapper.createmap<MyTest, mytestmodel> (). Formember (dest = dest. Name, MO = mo. Ignore ()). Formember (dest = dest. Mytestid, MO = mo. Ignore ()); mapper.createmap<Mytestmodel, mytest> (). Formember (dest = dest. Name, MO = mo. Ignore ()). Formember (dest = dest. Mytestid, MO = mo. Ignore ());
6. Apply Mapping between Model and Entity on MappingExtensions.cs
Path:solution\presentation\nop.web\extensions\ (for Web)
Path:solution\presentation\nop.admin\extensions\ (for Admin)
7. Create a service class and service interface (e.g EntityService.cs, IEntityService.cs)
Path:solution\libraries\nop.services\ientityservice.cs
Path:solution\libraries\nop.services\entityservice.cs
8. Final step to create Controller and View for given Model.
Hope get basic idea how to create/add new table on Nopcommerce system
Go How to add new table in Nopcommerce