[转]How to add new table in NopCommerce
本文转自: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的更多相关文章
- asp.net实现动态添加table行
asp.net动态的生成,删除table的行,主要是在后台动态创建单元行,单元表格,效果图: 2.代码: <%@ Page Language="C#" AutoEventWi ...
- iphone dev 入门实例1:Use Storyboards to Build Table View
http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/ Creating Navig ...
- ASP.NET给Table动态添加删除行,并且得到控件的值
ASP.NET给Table动态添加控件并且得到控件的值 由于跟老师做一个小的项目,可是我自己又不太懂js,所以一直为动态建立表格并且能动态的取值和赋值感到苦恼.起初在网上找到了一些js资源,解决了动态 ...
- table插入标签form标记怪现象
最近帮朋友处理问题,它无法提交表单,得到一些时间,我发现了一个奇怪的问题 <table> <form action="upload.php" method=&qu ...
- HashSet集合的add()方法的源码
interface Collection { ... } interface Set extends Collection { ... } class HashSet implements Set { ...
- 转换sql文件的create table语句为drop table语句
package com.csii.pweb.query.action; import java.io.BufferedReader; import java.io.FileNotFoundExcept ...
- SpringBoot+MyBatis中自动根据@Table注解和@Column注解生成增删改查逻辑
习惯使用jpa操作对象的方式,现在用mybatis有点不习惯. 其实是懒得写SQL,增删改查那么简单的事情你帮我做了呗,mybatis:NO. 没办法,自己搞喽! 这里主要是实现了通过代码自动生成my ...
- 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 ...
- 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 ...
随机推荐
- 酷!使用 jQuery & Canvas 制作相机快门效果
在今天的教程中,我们将使用 HTML5 的 Canvas 元素来创建一个简单的摄影作品集,它显示了一组精选照片与相机快门的效果.此功能会以一个简单的 jQuery 插件形式使用,你可以很容易地整合到任 ...
- 【初窥javascript奥秘之事件机制】论“点透”与“鬼点击”
前言 最近好好的研究了一番移动设备的点击响应速度,期间不断的被自己坑,最后搞得焦头烂额,就是现在可能还有一些问题,但是过程中感觉自己成长不少, 最后居然感觉对javascript事件机制有了更好的认识 ...
- [deviceone开发]-模仿Zaker的示例
一.简介 这个示例模仿zaker这个App,主要的界面基本都完成,用到了各种deviceone提供的ui组件,比如GridView,ListView,ScrollView,ViewShower等等.初 ...
- HTML5移动开发学习笔记
最近做webapp项目过程中,发现坑还是挺多的,以下是网络收集一些开发中的常见问题及知识汇总,以便查阅,慢慢更新:). meta 基础知识 H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 < ...
- Flex Viewer (二)——体系结构
一.概述 在上一篇文章<深入浅出Flex Viewer (一)——概述>中,笔者对Flex Viewer用于构建以地图为中心的富客户端(RIA)应用的原型的功能和价值做了简要地介绍.在本文 ...
- Sharepoint学习笔记—习题系列--70-576习题解析 -(Q45-Q48)
Question 45 You are designing a branding strategy for a customer with a new SharePoint 2010 server f ...
- [Android]Activity启动过程
Android系统启动加载流程: 参考图 Linux内核加载完毕 启动init进程 init进程fork出zygote进程 zygote进程在ZygoteInit.main()中进行初始化的时候for ...
- Android项目实战(十九):Android Studio 优秀插件: Parcelable Code Generator
Android Studio 优秀插件系列: Android Studio 优秀插件(一):GsonFormat Android Studio 优秀插件(二): Parcelable Code Gen ...
- 代码创建storyboard
代码创建storyboard方式如下 // 加载storyboard UIStoryboard *storyboard = [UIStoryboard StoryboardWithName:@&quo ...
- C语言中的复合类型
复合类型 一.掌握的类型 1. 指针数组 int * arr[10]; //arr是一个数组,有10个元素,每个元素都是一个指针,即arr是一个指针数组 int a,b,c,d; arr[0] = & ...