[转]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 ...
随机推荐
- 改写百度云推送SDK,PHP PEAR 包:Services_Baidu_Push
iPhone使用apple push很方便,而Android很多厂商删除了google push,而且google在大陆连不上,所以要用别的办法. Android常见的推送服务商有:极光推送(http ...
- Immutable.js – JavaScript 不可变数据集合
不可变数据是指一旦创建就不能被修改的数据,使得应用开发更简单,允许使用函数式编程技术,比如惰性评估.Immutable JS 提供一个惰性 Sequence,允许高效的队列方法链,类似 map 和 f ...
- ClockPicker – 时钟风格 Bootstrap 时间选择器
ClockPicker 是国内前端开发者发布的一个时钟样式 Timepicker,可以用于 Bootstrap 和 jQuery.所有主流浏览器都支持,包括 IE9+,支持移动设备,能够在触摸屏设备很 ...
- jQ函数after、append、appendTo的区别
1.after函数定义和用法:after() 方法在被选元素后插入指定的内容.参考:http://keleyi.com/a/bjac/cfyxd60g.htm 语法:$(selector).after ...
- html5标签的改变
1.新的文档类型声明 浏览器解析html模式是有两种模式,按照各自浏览器的定义渲染的页面叫“怪异模式”,而按照w3c组织统一的标准渲染叫“标准模式”.一般都是使用标准模式来保持网页兼容性,区分这两种模 ...
- ae_将面积小于1500的Feature同附近Feature进行合并
private void 合并1500图斑ToolStripMenuItem_Click(object sender, EventArgs e) { /* *将图层中面积小于1500的图斑与之相同BS ...
- DevExpress .NET界面开发示例大全
说到做.net界面开发,很多人应该都会想到DevExpress. 它的 .net界面开发系列一共有7个版本:WinForms.ASP.NET.MVC.WPF.Silverlight.Windows 8 ...
- sqlite使用xcode编译
使用xcode去开发makefile的project(Building Makefile Projects With Xcode) 新建工程,template选择 external Build Sys ...
- Android 手机卫士--自定义控件(获取焦点的TextView)
本文地址:http://www.cnblogs.com/wuyudong/p/5906735.html,转载请注明源地址. 本文将实现标题栏下面的textview中的文字跑马灯的效果,就是将一行文字水 ...
- Content-Type: application/vnd.ms-excel">
如果要将查询结果导出到Excel,只需将页面的Context-Type修改一下就可以了: header( "Content-Type: application/vnd.ms-excel& ...