代码生成Dto新增模型校验
This commit is contained in:
parent
14203cffd1
commit
58d5d8ef9d
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user