From 58d5d8ef9ddee29d871e0f83e00d1ca8717f826f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Wed, 5 Jan 2022 20:42:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90Dto?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9E=8B=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt index a424ac5..f697b72 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using ${options.ModelsNamespace}.Dto; using ${options.ModelsNamespace}.Models; @@ -12,6 +13,9 @@ namespace ${options.DtosNamespace}.Dto { $foreach(item in genTable.Columns) $if((item.IsInsert || item.IsEdit || item.IsPk || item.IsIncrement)) +$if(item.IsRequired) + [Required(ErrorMessage = "${item.ColumnComment}不能为空")] +$end public $item.CsharpType$item.RequiredStr $item.CsharpField { get; set; } $end $end