我有一个班级:
public class ParentClass
{
//other stuff
IList<string> ChildPages
}
Fluent NHibernate 使“IList<string> ChildPages
”自动化时,ChildPages
'联接表创建时带有nvarchar(255)
支持集合中每个字符串的字段。
但问题是我希望sql支持字段为“text
”,这样我就可以为这个实体提供冗长的条目。
进行此更改的最简单方法是什么?
如何更改自动化原始集合的基础类型?
另外,对于额外的点,你会如何使用约定或映射覆盖?
THX!
答案 0 :(得分:1)
您可以设置覆盖约定,以便字符串使用text
而不是nvarchar2 (255)
,如解决方案on this other thread中所示。如果您只想对特定属性执行此类行为,则在您的流畅配置中会出现这样的情况:
AutoMap
.AssemblyOf<ParentClass>()
.Override<ChildPage>(map =>
{
mapping.Map(x => x.Page).CustomType("StringClob").CustomSqlType("text");
});