0

谁能给我一些关于如何以编程方式为组件添加自定义 tuplizer 的指导?

将其添加到类中很简单:

new Configuration().ClassMappings
                   .First()
                   .AddTuplizer(EntityMode.Map, "tuplizerClassName");

但是你如何为组件完成同样的事情呢?

4

1 回答 1

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");
于 2011-12-05T12:19:00.903 回答