public static KeyValueBuilder <T, TKey, TRef> HasKeyValue <T, TKey, TRef>(this Builder <T> builder, IBuilder keyBuilder, IBuilder valueBuilder) where T : IDictionary <TKey, TRef> { var child = new KeyValueBuilder <T, TKey, TRef>(); child.KeyBuilder = keyBuilder; child.ValueBuilder = valueBuilder; child.Add = (o, k, v) => o.Add(k, v); builder.Builders.Add(child); return(child); }
public KeyValueBuilder <T, TKey, TRef> HasKeyValue <TKey, TRef>(Func <T, IDictionary <TKey, TRef> > property, IBuilder keyBuilder, IBuilder valueBuilder) { var builder = new KeyValueBuilder <T, TKey, TRef>(); builder.KeyBuilder = keyBuilder; builder.ValueBuilder = valueBuilder; builder.Add = (o, k, v) => { var list = property(o); list.Add(k, v); }; Builders.Add(builder); return(builder); }