任何人都可以给我一些指导,如何以编程方式为Component添加自定义tuplizer?
将它添加到类中就像:
new Configuration().ClassMappings
.First()
.AddTuplizer(EntityMode.Map, "tuplizerClassName");
但是你如何为组件做同样的事情呢?
答案 0 :(得分:2)
config.ClassMappings
.SelectMany(cm => cm.PropertyIterator)
.Where(prop => prop.IsComposite)
.Select(prop => prop.Value)
.Cast<NHibernate.Mapping.Component>()
.ForEach(c => c.TuplizerMap[NHibernate.EntityMode.Map] = "tuplizerClassName");