/// <summary> /// Copies the initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <returns></returns> public DictionaryDescriptor CopyInitializers(DictionaryDescriptor other) { if (initializers != null) { other.AddInitializers(initializers.Select(init => init.Copy()).OfType <IDictionaryInitializer>()); } return(this); }
/// <summary> /// Copies the initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <returns></returns> public DictionaryDescriptor CopyInitializers(DictionaryDescriptor other) { if (initializers != null) { other.AddInitializers(initializers); } return(this); }
/// <summary> /// Copies the meta-initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <returns></returns> public DictionaryDescriptor CopyMetaInitializers(DictionaryDescriptor other) { if (metaInitializers != null) { other.AddMetaInitializers(metaInitializers.Select(meta => meta.Copy()).OfType <IDictionaryMetaInitializer>()); } return(this); }
private static object Create(IDictionaryAdapter adapter, Type type, IDictionary dictionary, XPathAdapter xpathAdapter) { dictionary = dictionary ?? new Hashtable(); var descriptor = new DictionaryDescriptor(); adapter.This.Descriptor.CopyBehaviors(descriptor, b => b is XPathAdapter == false); descriptor.AddBehavior(xpathAdapter); return(adapter.This.Factory.GetAdapter(type, dictionary, descriptor)); }
private static DictionaryAdapterMeta GetDictionaryMeta(IDictionaryAdapter dictionaryAdapter, Type otherType) { var meta = dictionaryAdapter.Meta; if (otherType != null && otherType != meta.Type) { var descriptor = new DictionaryDescriptor(); dictionaryAdapter.This.Descriptor.CopyBehaviors(descriptor); meta = dictionaryAdapter.This.Factory.GetAdapterMeta(otherType, descriptor); } return meta; }
private void InitializeMeta(IDictionaryAdapterFactory factory, DictionaryDescriptor descriptor) { if (descriptor != null) { MetaInitializers = MetaInitializers.Prioritize(descriptor.MetaInitializers).ToArray(); } foreach (var metaInitializer in MetaInitializers) { metaInitializer.Initialize(factory, this); } }
private static DictionaryAdapterMeta GetDictionaryMeta(IDictionaryAdapter dictionaryAdapter, Type otherType) { var meta = dictionaryAdapter.Meta; if (otherType != null && otherType != meta.Type) { var descriptor = new DictionaryDescriptor(); dictionaryAdapter.This.Descriptor.CopyBehaviors(descriptor); meta = dictionaryAdapter.This.Factory.GetAdapterMeta(otherType, descriptor); } return(meta); }
/// <summary> /// Copies the filtered initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <param name="selector"></param> /// <returns></returns> public DictionaryDescriptor CopyInitializers(DictionaryDescriptor other, Func <IDictionaryInitializer, bool> selector) { if (selector == null) { throw new ArgumentNullException("selector"); } if (initializers != null) { other.AddInitializers(initializers.Where(selector)); } return(this); }
public DictionaryAdapterMeta(Type type, IDictionaryInitializer[] initializers, IDictionaryMetaInitializer[] metaInitializers, object[] behaviors, IDictionary<String, PropertyDescriptor> properties, DictionaryDescriptor descriptor, IDictionaryAdapterFactory factory) { Type = type; Initializers = initializers; MetaInitializers = metaInitializers; Behaviors = behaviors; Properties = properties; InitializeMeta(factory, descriptor); }
public DictionaryAdapterMeta(Type type, IDictionaryInitializer[] initializers, IDictionaryMetaInitializer[] metaInitializers, object[] behaviors, IDictionary <String, PropertyDescriptor> properties, DictionaryDescriptor descriptor, IDictionaryAdapterFactory factory) { Type = type; Initializers = initializers; MetaInitializers = metaInitializers; Behaviors = behaviors; Properties = properties; InitializeMeta(factory, descriptor); }
/// <summary> /// Copies the initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <returns></returns> public DictionaryDescriptor CopyInitializers(DictionaryDescriptor other) { if (initializers != null) { other.AddInitializers(initializers); } return this; }
/// <summary> /// Copies the filtered meta-initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <param name="selector"></param> /// <returns></returns> public DictionaryDescriptor CopyMetaInitializers(DictionaryDescriptor other, Func<IDictionaryMetaInitializer, bool> selector) { if (selector == null) { throw new ArgumentNullException("selector"); } if (metaInitializers != null) { other.AddMetaInitializers(metaInitializers.Where(selector)); } return this; }
private static object Create(IDictionaryAdapter adapter, Type type, IDictionary dictionary, XPathAdapter xpathAdapter) { dictionary = dictionary ?? new Hashtable(); var descriptor = new DictionaryDescriptor(adapter.Meta.Behaviors); adapter.This.Descriptor.CopyBehaviors(descriptor); descriptor.AddBehavior(xpathAdapter); return adapter.This.Factory.GetAdapter(type, dictionary, descriptor); }
/// <summary> /// Copies the initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <returns></returns> public DictionaryDescriptor CopyInitializers(DictionaryDescriptor other) { if (initializers != null) { other.AddInitializers(initializers.Select(init => init.Copy()).OfType<IDictionaryInitializer>()); } return this; }
/// <summary> /// Copies the meta-initializers to the other <see cref="PropertyDescriptor"/> /// </summary> /// <param name="other"></param> /// <returns></returns> public DictionaryDescriptor CopyMetaInitializers(DictionaryDescriptor other) { if (metaInitializers != null) { other.AddMetaInitializers(metaInitializers.Select(meta => meta.Copy()).OfType<IDictionaryMetaInitializer>()); } return this; }
object IDictionaryCreateStrategy.Create(IDictionaryAdapter adapter, Type type, IDictionary dictionary) { dictionary = dictionary ?? new Hashtable(); var descriptor = new DictionaryDescriptor(); adapter.This.Descriptor.CopyBehaviors(descriptor, b => b is XPathAdapter == false); descriptor.AddBehavior(XPathBehavior.Instance).AddBehavior(new XPathAdapter(new XmlDocument())); return adapter.This.Factory.GetAdapter(type, dictionary, descriptor); }