代码生成Dto新增模型校验

This commit is contained in:
不做码农 2022-01-05 20:42:43 +08:00
parent 14203cffd1
commit 58d5d8ef9d

View File

@ -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