0

Can anyone give me some direction as to how to add a custom tuplizer for a Component programmatically?

To add it to a class is as simple as:

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

But how do you accomplish the same thing for Components?

competent_tech
  • 44,465
  • 11
  • 90
  • 113
Newbie
  • 7,031
  • 9
  • 60
  • 85
  • possible duplicate of [Custom Tuplizer in Fluent Nhibernate](http://stackoverflow.com/questions/6920592/custom-tuplizer-in-fluent-nhibernate) –  Dec 03 '11 at 21:35
  • 1
    @Inuyasha, Not a duplicate. A Component tuplizer is not a Class tuplizer. – Newbie Dec 04 '11 at 07:42

1 Answers1

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");
Firo
  • 30,626
  • 4
  • 55
  • 94