0

I Like to use a custom IDictionary class for my DynamicComponent mappings:

class ObservableDictionary : Hashtable, INotifyCollectionChanged, INotifyPropertyChanged

when mapping lists it's possible to use a custom collection type as follows:

mapping.HasMany(x => x.Items).CollectionType<ObservableCollection<ItemClass>>();

But how can i do this with DynamicComponents? There is no CollectionType Method.

mapping.DynamicComponent(
    x => x.DynamicFields,
    c => {
            c.Map(x => x["fld_num"]).CustomType(typeof(int));
            c.Map(x => x["shortdesc"]).CustomType(typeof(string));
         });
Gerard
  • 2,461
  • 2
  • 26
  • 34
doerig
  • 1,857
  • 1
  • 18
  • 26

1 Answers1

0

if your custom Dictionary has an inner dictionary holding the data then you can

mapping.Component(x => x.DynamicFields, c => c.DynamicComponent(
    Reveal.Member<CustomDictionary, IDictionary>("_innerDictionary"),
    c => {
        c.Map(x => x["fld_num"]).CustomType(typeof(int));
        c.Map(x => x["shortdesc"]).CustomType(typeof(string));
    })
);
Firo
  • 30,626
  • 4
  • 55
  • 94