本文转自: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 year. And hope my previous blogs help's to anyway to my friends.
So I am going to starting with NopCommerce for how to add new table. This is the common question for newbie of NopCommerce.
Basically here sharing my experience with you guys that will help to other.
Step by step explanation for how to add new table on NopCommerce.
Going to explain based on the NopCommerce source code.

So first open source code on 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 you get basic idea how to create/add new table on NopCommerce system

[转]How to add new table in NopCommerce的更多相关文章

  1. asp.net实现动态添加table行

    asp.net动态的生成,删除table的行,主要是在后台动态创建单元行,单元表格,效果图: 2.代码: <%@ Page Language="C#" AutoEventWi ...

  2. iphone dev 入门实例1:Use Storyboards to Build Table View

    http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/ Creating Navig ...

  3. ASP.NET给Table动态添加删除行,并且得到控件的值

    ASP.NET给Table动态添加控件并且得到控件的值 由于跟老师做一个小的项目,可是我自己又不太懂js,所以一直为动态建立表格并且能动态的取值和赋值感到苦恼.起初在网上找到了一些js资源,解决了动态 ...

  4. table插入标签form标记怪现象

    最近帮朋友处理问题,它无法提交表单,得到一些时间,我发现了一个奇怪的问题 <table> <form action="upload.php" method=&qu ...

  5. HashSet集合的add()方法的源码

    interface Collection { ... } interface Set extends Collection { ... } class HashSet implements Set { ...

  6. 转换sql文件的create table语句为drop table语句

    package com.csii.pweb.query.action; import java.io.BufferedReader; import java.io.FileNotFoundExcept ...

  7. SpringBoot+MyBatis中自动根据@Table注解和@Column注解生成增删改查逻辑

    习惯使用jpa操作对象的方式,现在用mybatis有点不习惯. 其实是懒得写SQL,增删改查那么简单的事情你帮我做了呗,mybatis:NO. 没办法,自己搞喽! 这里主要是实现了通过代码自动生成my ...

  8. Inheritance with EF Code First: Part 2 – Table per Type (TPT)

    In the previous blog post you saw that there are three different approaches to representing an inher ...

  9. Table View Programming Guide for iOS---(五)---Creating and Configuring a Table View

    Creating and Configuring a Table View Your app must present a table view to users before it can mana ...

随机推荐

  1. (1)RGB-D SLAM系列- 工具篇(硬件+关键技术)

    /*************************************************************************************************** ...

  2. transform:rotate在手机上显示有锯齿的解决方案大全

    先来个兼容性说明,洗洗脑: div{transform:rotate(7deg);-ms-transform:rotate(7deg); /* IE 9 */-moz-transform:rotate ...

  3. Hybrid框架UI重构之路:六、前端那点事儿(Javascript)

    上文回顾 :Hybird框架UI重构之路:五.前端那点事儿(HTML.CSS) 这里讲述在开发的过程中,一些JS的关键点. 换肤 对于终端的换肤,我之前一篇文章有说了我的想法. 请查看:http:// ...

  4. Hybrid框架UI重构之路:二、事出有因

    上文回顾:Hybird框架UI重构之路:一.师其长技以自强 一切的重构都是有原因的,或许为了更快速度.更好体验.更快捷开发等,于是就有了自己的开发目标,简单看看未重构前UI("中国移动式&q ...

  5. Egret白鹭H5小游戏开发入门(一)

    前言: 好久没更新博客了,以前很多都不会,所以常常写博客总结,倒是现在有点点经验了就懒了.在过去的几个月里,在canvas游戏框架方面,撸过了CreateJS,玩得了Egret,又学过PIXI.js. ...

  6. 错误 1 “System.Data.DataRow.DataRow(System.Data.DataRowBuilder)”不可访问,因为它受保护级别限制

    new DataRow 的方式: DataTable pDataTable = new DataTable(); DataRow pRow = new DataRow(); 正确的方式: DataRo ...

  7. java 实现 LINQ 的一些框架记录一下

    jOOQ: http://www.jooq.org JINQ: http://www.jinq.org JaQue: http://github.com/TrigerSoft/jaque JaQu:  ...

  8. Cordoval在iOS中的运用整理

    一:关于Cordoval理论知识 1:PhoneGap是手机平台上流行的一款中间件.它构建在各种手机平台所提供的WebView(浏览器内核)组件的基础之上,使用javascript语言对应用开发者提供 ...

  9. 我的Android第三章:Android的组件介绍

    小编摘录了Android文档介绍Android四大组件的基本内容,感觉文档的内容写的很详细所以小编将它写入了博客 Android 使用Java语言开发.Android SDK 工具编译代码-以及任意数 ...

  10. 如何正确使用Cocoapods

    ➠更多技术干货请戳:听云博客 一.介绍Cocoapods Cocoapods是引入为项目引入新血液的接口,只有引入了新血液,功能才可以多样化,进而满足不同的消费群体.使用Cocoapods可以方便日后 ...