[转]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 ...
随机推荐
- telnetlib/SNMP
telnetlib telnetlib 总体来讲还是很好理解的,因为已经耍过paramiko 关于 .read_very_eager(), 简单理解就是就是读尽量多,读到没有反馈了为止 关键功能 1) ...
- jQuery Tocify 定位导航
Tocify是一个jQuery插件,能够动态的生成文章目录,Tocify可以随意的设置Twitter Bootstrap 或者 jQueryUI Themeroller支持的可选动画和jQuery的显 ...
- SQL Server SQL分页查询
SQL Server SQL分页查询的几种方式 目录 0. 序言 1. TOP…NOT IN… 2. ROW_NUMBER() 3. OFFSET…FETCH 4. 执行 ...
- [web安全]Web应用漏洞攻击分析与防范
网站攻击主要分为以下几类: (1) sql注入攻击 SQL Injection:就是通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令.它是利 ...
- Angular JS | Closure | Google Web Toolkit | Dart | Polymer 概要汇集
AngularJS | Closure | Google Web Toolkit | Dart | Polymer GWT https://code.google.com/p/google-web-t ...
- 数据持久化(一)--NSKeyedArchiver
数据持久化: 将内存中的数据按某种格式存进磁盘 数据的种类: 1,结构化的数据 2, 字节流数据 结构化的数据 字节流 内存中结构化的数据 -> 磁盘, 叫: 归档 字 ...
- 【代码笔记】iOS-设置textView或者label的行间距方法
一,效果图. 二,代码. RootViewController.m - (void)viewDidLoad { [super viewDidLoad]; // Do any additional se ...
- NSoperation线程通信
全局变量 @property (weak, nonatomic) IBOutlet UIImageView *imageView; @property (nonatomic, strong) NSOp ...
- HTTP协议基本知识
Xcode7.0以上版本必须操作:https http 在Info.plist中添加NSAppTransportSecurity类型Dictionary. 在NSAppTransportSecurit ...
- Hibernate 事务管理
一. 事务包含四个基本特性:简称ACID: 1. Atomic(原子性):全部成功或全部失败: 2. Consistency(一致性):只有合法数据才能被写入,不合法则回滚到最初状态: 3. Isol ...