修改模板
This commit is contained in:
parent
61b91aaa64
commit
d0d7d0bc7f
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using FluentValidation;
|
||||||
using NCA_MES_Models.CommonUtils.DB.DBAttribute;
|
using NCA_MES_Models.CommonUtils.DB.DBAttribute;
|
||||||
|
|
||||||
namespace ${namespace_name}
|
namespace ${namespace_name}
|
||||||
@ -25,4 +26,20 @@ $end
|
|||||||
$end
|
$end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 验证类 采用FluentValidation
|
||||||
|
/// 项目地址 https://github.com/FluentValidation/FluentValidation
|
||||||
|
/// 文档地址 https://docs.fluentvalidation.net/en/latest/start.html
|
||||||
|
/// </summary>
|
||||||
|
public class ${table_name}Validator : AbstractValidator<${table_name}>
|
||||||
|
{
|
||||||
|
public ${table_name}Validator()
|
||||||
|
{
|
||||||
|
$foreach(filedInfo in filedInfos)
|
||||||
|
$if(filedInfo["is_nullable"]=="true")
|
||||||
|
RuleFor(item => item.${filedInfo["field_name"]}).NotNull().WithMessage("${filedInfo["comment"]}不能为空");
|
||||||
|
$end
|
||||||
|
$end
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user