【发布时间】:2015-06-11 02:22:57
【问题描述】:
在这个实体中:
public class Foo
{
public Guid Id { get; set; }
public string Type { get; set; }
public string Name { get; set; }
}
如何使用实体的另一个属性或从数据库中获取的任何其他字符串在运行时自定义验证消息?
RuleFor(foo => foo.Name) 的验证消息是:
var msg = "The foo with type '" + foo.Type + "' already exists in the database with name '" + nameInDataBase + "'!"
【问题讨论】:
标签: c# validation message fluentvalidation