我喜欢我在这篇博文 ( http://marekblotny.blogspot.com/2009/04/conventions-after-rewrite.html ) 中看到的模式,作者正在检查是否已经更改了表名在应用约定之前。
public bool Accept(IClassMap target)
{
//apply this convention if table wasn't specified with WithTable(..) method
return string.IsNullOrEmpty(target.TableName);
}
我用于字符串长度的约定接口是 IProperty:
public class DefaultStringLengthConvention: IPropertyConvention
{
public bool Accept(IProperty property) {
//apply if the string length hasn't been already been specified
return ??; <------ ??
}
public void Apply(IProperty property) {
property.WithLengthOf(50);
}
}
我看不到 IProperty 在哪里公开任何告诉我该属性是否已设置的信息。这可能吗?
TIA,贝里尔