本文转自: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. 常用的css命名规则:

    关于团队合作的css命名规范 常用的css命名规则: 头:header 内容:content/container 尾:footer 导航:nav 侧栏:sidebar 栏目:column 页面外围控制 ...

  2. js改变css样式的三种方法

    共用代码: <div id="div">this is a div</div> var div=document.getElementById('div') ...

  3. 简洁的jQuery cxMenu 手风琴导航

    版本: jQuery v1.7+ jQuery cxMenu v1.2 注意事项: 自动判断是否有子导航,有则显示并不触发链接,无则触发链接. 实例预览 使用方法 载入 JavaScript 文件 & ...

  4. Kickoff - 创造可扩展的,响应式的网站

    Kickoff 是一个轻量级的前端框架,用于创建可扩展的,响应式的网站.作为前端开发人员,我们工作的类型越来越多样化.Kickoff 旨在帮助您在所有项目保持一致的结构和风格,无需添加其他框架. 在线 ...

  5. 25款响应式,支持视网膜显示的 Wordpress 主题

    响应式和现代设计风格的多用途 WordPress 主题与能够非常灵活的适应所有设备.而高级主题能够更大可能性的轻松定制.所有的主题是完全响应式的,您可以从主题选项中禁用/启用响应模式. 多用途的响应式 ...

  6. 捕获当前事件作用的对象event.target和event.srcElement

    语法: //返回事件的目标节点(触发该事件的节点). event.target //FF,Chrome event.srcElement //IE 栗子: var oDiv=document.getE ...

  7. Phonegap 之 iOS银联在线支付(js调用ios端银联支付控件)

    Phonegap项目,做支付的时候,当把网站打包到ios或android端成app后,在app上通过wap调用银联在线存在一个问题: 就是当从银联支付成功后,再从服务器返回到app客户端就很难实现. ...

  8. 查看Android系统是User模式还是Eng模式

    root@itek82_wet_kk:/ # cat default.prop # # ADDITIONAL_DEFAULT_PROPERTIES # ro.secure= ro.allow.mock ...

  9. 将Android系统源码导入ecplise

    Android系统源码中带有个IDE的配置文件,目录为:development/ide/ 如果要用eclipse导入查看系统源码,则将development/ide/eclipse/.classpat ...

  10. 【代码笔记】iOS-饼图

    一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @class QuizChartView; @interf ...