abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)目錄
<https://www.cnblogs.com/chillsrc/p/11231284.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——ABP總體介紹(一)
<https://www.cnblogs.com/chillsrc/p/10913047.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——解決方案介紹(二)
<https://www.cnblogs.com/chillsrc/p/10944870.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——領(lǐng)域?qū)觿?chuàng)建實(shí)體(三)
<https://www.cnblogs.com/chillsrc/p/10980974.html>
?abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——定義倉儲(chǔ)并實(shí)現(xiàn) (四)
<https://www.cnblogs.com/chillsrc/p/11024357.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——?jiǎng)?chuàng)建應(yīng)用服務(wù)(五)
<https://www.cnblogs.com/chillsrc/p/11065667.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——展現(xiàn)層實(shí)現(xiàn)增刪改查之控制器(六)
<https://www.cnblogs.com/chillsrc/p/11096690.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——展現(xiàn)層實(shí)現(xiàn)增刪改查之列表視圖(七)
<https://www.cnblogs.com/chillsrc/p/11124614.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——展現(xiàn)層實(shí)現(xiàn)增刪改查之增刪改視圖(八)
<https://www.cnblogs.com/chillsrc/p/11159642.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——展現(xiàn)層實(shí)現(xiàn)增刪改查之菜單與測(cè)試(九)
<https://www.cnblogs.com/chillsrc/p/11195189.html>
abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——多語言(十)
<https://www.cnblogs.com/chillsrc/p/11231265.html>
?
????? 通過abp(net core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——展現(xiàn)層實(shí)現(xiàn)增刪改查之控制器(六)
<https://www.cnblogs.com/chillsrc/p/11096690.html>至abp(net
core)+easyui+efcore實(shí)現(xiàn)倉儲(chǔ)管理系統(tǒng)——展現(xiàn)層實(shí)現(xiàn)增刪改查之菜單與測(cè)試(九)
<https://www.cnblogs.com/chillsrc/p/11195189.html>四篇文章的學(xué)習(xí),我們使用ASP.NET Core
Mvc的常規(guī)的實(shí)現(xiàn)方式實(shí)現(xiàn)了對(duì)數(shù)據(jù)庫的CURD操作。ABP有其默認(rèn)的實(shí)現(xiàn)增刪改查的方式。我們可以先看一下“ABP.TPLMS.Web.Mvc”項(xiàng)目中的“Views\Users”的相關(guān)代碼,可以查看一下ABP默認(rèn)是如何實(shí)現(xiàn)對(duì)用戶信息的增刪改查的。我們發(fā)現(xiàn)ABP中的用戶信息的增刪改查是通過繼承
AsyncCrudAppService這個(gè)類來實(shí)現(xiàn)CURD操作,前端頁面中通過javascript調(diào)用WEB
API來實(shí)現(xiàn)增刪改查。當(dāng)然還有一個(gè)同步操作類CrudAppService,通過繼承這個(gè)類來實(shí)現(xiàn)CURD的同步操作。對(duì)于這兩個(gè)類的的區(qū)別在于AsyncCrudAppService是CrudAppService異步實(shí)現(xiàn)。ABP作為開發(fā)框架,通過以上兩個(gè)基類實(shí)現(xiàn)了對(duì)于CRUD這種通用功能的一種解決方案。在接下來的幾篇文章中,我們要通過
繼承 AsyncCrudAppService這個(gè)類來實(shí)現(xiàn)CURD操作,在前端通過調(diào)用WebAPI來實(shí)現(xiàn)對(duì)供應(yīng)商信息的增刪改查功能。
????????? 先來看一下AsyncCrudAppService與CrudAppService這兩個(gè)類具體提供的功能。
????????? 首先,這兩個(gè)類都繼承自CrudAppServiceBase類。如圖1,圖2。
?
圖1
?
圖2
???? 其次,這兩個(gè)類都提供了Create、Delete、Update、Get、GetAll、GetEntityById方法。
?????
第三,CrudAppServiceBase類提供了有關(guān)于權(quán)限(xxxPermissionName屬性和CheckxxxPermission方法)的屬性和方法,關(guān)于分頁(ApplyPaging)的方法,關(guān)于排序(ApplySorting)方法,關(guān)于查詢條件(CreateFilteredQuery)的方法,關(guān)于對(duì)象映射(MapToxxx)的方法。如下圖。
? ????? 接下來我們來通過實(shí)現(xiàn)一個(gè)供應(yīng)商信息的管理功能來學(xué)習(xí)一下這種方式實(shí)現(xiàn)增刪改查功能。我會(huì)通過幾篇文章來一步一步來實(shí)現(xiàn)這個(gè)供應(yīng)商管理的功能。
?一、創(chuàng)建Supplier實(shí)體
??????? 1. 在Visual Studio
2017的“解決方案資源管理器”中,右鍵單擊“ABP.TPLMS.Core”項(xiàng)目的“Entitys”文件夾,在彈出菜單中選擇“添加” --> “類”。
將類命名為 Supplier,然后選擇“添加”。
??????? 2.創(chuàng)建Supplier類繼承自Entity<int>,通過實(shí)現(xiàn)審計(jì)模塊中的IHasCreationTime來實(shí)現(xiàn)保存創(chuàng)建時(shí)間。代碼如下:
using Abp.Domain.Entities; using Abp.Domain.Entities.Auditing; using
Abp.Timing;using System; using System.Collections.Generic; using
System.ComponentModel.DataAnnotations;using System.Text; namespace
ABP.TPLMS.Entitys {public class Supplier : Entity<int>, IHasCreationTime {
public const int MaxLength = 255; public Supplier() { this.Address = string
.Empty;this.Name = string.Empty; this.Email = string.Empty; this.Code = string
.Empty;this.Sex = 0; this.LinkName = string.Empty; this.Status = 0; this.Tel =
string.Empty; this.Mobile = string.Empty; this.UserId = 0; CreationTime =
Clock.Now; } [Required] [StringLength(50)] public string Code { get; set; }
[Required] [StringLength(MaxLength)]public string Name { get; set; }
[StringLength(MaxLength)]public string Address { get; set; } [Required]
[StringLength(MaxLength)]public string Email { get; set; }
[StringLength(MaxLength)]public string LinkName { get; set; } public int Sex {
get; set; } [Required] [StringLength(MaxLength)] public string Tel { get; set;
} [StringLength(MaxLength)]public string Mobile { get; set; } public int Status
{get; set; } public int UserId { get; set; } public DateTime CreationTime { get;
set; } } }
?????
3.定義好實(shí)體之后,我們?nèi)ァ癆BP.TPLMS.EntityFrameworkCore”項(xiàng)目中的“TPLMSDbContext”類中定義實(shí)體對(duì)應(yīng)的DbSet,以應(yīng)用Code
First 數(shù)據(jù)遷移。添加以下代碼
using Microsoft.EntityFrameworkCore; using Abp.Zero.EntityFrameworkCore; using
ABP.TPLMS.Authorization.Roles;using ABP.TPLMS.Authorization.Users; using
ABP.TPLMS.MultiTenancy;using ABP.TPLMS.Entitys; namespace
ABP.TPLMS.EntityFrameworkCore {public class TPLMSDbContext :
AbpZeroDbContext<Tenant, Role, User, TPLMSDbContext> { /* Define a DbSet for
each entity of the application*/ public
TPLMSDbContext(DbContextOptions<TPLMSDbContext> options) : base(options) { }
public DbSet<Module> Modules { get; set; } public DbSet<Supplier> Suppliers {
get; set; } } }
???? 4.從菜單中選擇“工具->NuGet包管理器器—>程序包管理器控制臺(tái)”菜單。
???? 5. 在PMC中,默認(rèn)項(xiàng)目選擇EntityframeworkCore對(duì)應(yīng)的項(xiàng)目后。輸入以下命令:Add-Migration
AddEntitySupplier,創(chuàng)建遷移。如下圖。
?
???? 6.
在上面的命令執(zhí)行完畢之后,創(chuàng)建成功后,會(huì)在Migrations文件夾下創(chuàng)建時(shí)間_AddEntitySupplier格式的類文件,這些代碼是基于DbContext指定的模型。如下圖。
?
???? 7.在程序包管理器控制臺(tái),輸入U(xiǎn)pdate-Database,回車執(zhí)行遷移。如下圖。
?
? ?? 8.執(zhí)行成功后,查看數(shù)據(jù)庫,Suppliers表創(chuàng)建成功。
?
?
熱門工具 換一換
感谢您访问我们的网站,您可能还对以下资源感兴趣:
调教肉文小说-国产成本人片免费av-空姐av种子无码-在线观看免费午夜视频-综合久久精品激情-国产成人丝袜视频在线观看软件-大芭区三区四区无码-啊啊好爽啊啊插啊用力啊啊-wanch视频网-国产精品成人a免费观看