Inheritance: PropertyDescriptor
Ejemplo n.º 1
0
 /// <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);
 }
Ejemplo n.º 2
0
 /// <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);
 }
Ejemplo n.º 3
0
 /// <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);
 }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
		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;
		}
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
			}
		}
Ejemplo n.º 9
0
 /// <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);
		}
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
		/// <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;
		}
Ejemplo n.º 13
0
		/// <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;
		}
Ejemplo n.º 14
0
		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);
		}
Ejemplo n.º 15
0
		/// <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;
		}
Ejemplo n.º 16
0
		/// <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;
		}
Ejemplo n.º 17
0
		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);
		}