Go How to add new table in Nopcommerce

Source: Internet
Author: User
Tags nopcommerce

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.