本文转自: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. SPRING SECURITY 拦截静态资源

    情景: <security:intercept-url pattern="/**" access="USER"/> 当在spring securti ...

  2. JQuery(选择器、事件、DOM操作)

    一.jQuery简介 jQuery 是一个 JavaScript 库. jQuery 极大地简化了 JavaScript 编程. jQuery 库位于一个 JavaScript 文件中,其中包含了所有 ...

  3. JavaScript中数组的增删改查

                                               数组的增加 ary.push()   向数组末尾添加元素,返回的是添加后新数组的长度,原有数组改变 ary.uns ...

  4. 使用 WordPress 主题制作的20个精美网页

    WordPress 是一款个人博客系统,并逐步演化成一款内容管理系统软件,它是使用 PHP 语言和 MySQL 数据库开发的.用户可以在支持 PHP 和 MySQL 数据库的服务器上使用自己的博客.这 ...

  5. ie8不兼容rgba的解决

    借鉴................. 在调试ie8兼容性的问题时,发现ie8不支持rgba. 关于rgba(),即为颜色设置的方法函数,rgb代表颜色,a代表透明度. 如rgba(0,0,0,0.1 ...

  6. ABAP 一个隐藏 selection-screen block的实例

    以下是一个演示如何通过 selection-screen 中的pushbutton来动态改变屏幕上的字段的显示状态的(即显示或者隐藏).      注意:显示 通过本示例可知selection-scr ...

  7. Atitit.git的存储结构and 追踪

    Atitit.git的存储结构and 追踪 1. Add index.js 2 index1 1.1. new1 1.2. Modify1 2. Commit1 1. Add index.js 2 i ...

  8. phonegap创建的ios项目推送消息出现闪退现象

    使用phonegap创建的ios项目,推送消息时,当程序在前台运行或者在后台运行状态下,推送消息过来,可以解析并且跳转: 但是在程序从后台退出的状态下,当消息推送过来的时候,点击通知栏,打开程序,程序 ...

  9. DragLayout: QQ5.0侧拉菜单的新特效

    一.项目概要 1.1 项目效果如图: 1.2 需要使用到的技术   ViewDragHelper: 要实现和QQ5.0侧滑的特效,需要借助谷歌在2013年I/O大会上发布的ViewDragHelper ...

  10. Java Collection Framework概述

    文章出自:听云博客 Collection概述 Java collection是java提供的工具包,包含了常用的数据结构:集合.链表.队列.栈.数组.映射等. Java集合主要可以划分为4个部分:Li ...