【发布时间】:2009-04-30 15:45:03
【问题描述】:
我喜欢我在这篇博文 (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, 浆果
【问题讨论】:
标签: fluent-nhibernate conventions