• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DictionaryAdapter.PropertyDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Castle.Components.DictionaryAdapter.PropertyDescriptor的典型用法代码示例。如果您正苦于以下问题:C# PropertyDescriptor类的具体用法?C# PropertyDescriptor怎么用?C# PropertyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyDescriptor类属于Castle.Components.DictionaryAdapter命名空间,在下文中一共展示了PropertyDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DictionaryAdapterInstance

		public DictionaryAdapterInstance(IDictionary dictionary, PropertyDescriptor descriptor, 
										 IDictionaryAdapterFactory factory)
		{
			Dictionary = dictionary;
			Descriptor = descriptor;
			Factory = factory;
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:7,代码来源:DictionaryAdapterInstance.cs


示例2: MergeBehaviorOverrides

		private void MergeBehaviorOverrides(DictionaryAdapterMeta meta)
		{
			if (Descriptor == null) return;

			var typeDescriptor = Descriptor as DictionaryDescriptor;

			if (typeDescriptor != null)
			{
				Initializers = Initializers.Prioritize(typeDescriptor.Initializers).ToArray();
			}

			Properties = new Dictionary<string, PropertyDescriptor>();

			foreach (var property in meta.Properties)
			{
				var propertyDescriptor = property.Value;

				var propertyOverride = new PropertyDescriptor(propertyDescriptor, false)
					.AddKeyBuilders(propertyDescriptor.KeyBuilders.Prioritize(Descriptor.KeyBuilders))
					.AddGetters(propertyDescriptor.Getters.Prioritize(Descriptor.Getters))
					.AddSetters(propertyDescriptor.Setters.Prioritize(Descriptor.Setters));

				Properties.Add(property.Key, propertyOverride);
			}
		}
开发者ID:ThatExtraBit,项目名称:Castle.Core,代码行数:25,代码来源:DictionaryAdapterInstance.cs


示例3: GetPropertyAsString

		bool IDictionaryPropertySetter.SetPropertyValue(IDictionaryAdapter dictionaryAdapter,
			string key, ref object value, PropertyDescriptor property)
		{
			if (value != null)
			{
				value = GetPropertyAsString(property, value);
			}
			return true;
		}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:9,代码来源:StringValuesAttribute.cs


示例4: GetPropertyValue

 public object GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue, PropertyDescriptor property, bool ifExists)
 {
     if (storedValue != null)
     {
         return storedValue;
     }
     
     throw new InvalidOperationException(string.Format("App setting '{0}' not found!", key));
 }
开发者ID:jhonner72,项目名称:plat,代码行数:9,代码来源:AppSettingWrapperAttribute.cs


示例5: GetPropertyValue

		public object GetPropertyValue(IDictionaryAdapter dictionaryAdapter,
			string key, object storedValue, PropertyDescriptor property, bool ifExists)
		{
			if (storedValue == null || storedValue.Equals(UnassignedGuid))
			{
				storedValue = Guid.NewGuid();
				property.SetPropertyValue(dictionaryAdapter, key, ref storedValue, dictionaryAdapter.This.Descriptor);
			}

			return storedValue;
		}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:11,代码来源:NewGuidAttribute.cs


示例6: DictionaryAdapterInstance

		public DictionaryAdapterInstance(IDictionary dictionary, DictionaryAdapterMeta meta,
										 PropertyDescriptor descriptor, IDictionaryAdapterFactory factory)
		{
			Dictionary = dictionary;
			Descriptor = descriptor;
			Factory = factory;

			Properties = meta.Properties;
			Initializers = meta.Initializers;
			MergeBehaviorOverrides(meta);
		}
开发者ID:ThatExtraBit,项目名称:Castle.Core,代码行数:11,代码来源:DictionaryAdapterInstance.cs


示例7: GetPropertyValue

        public object GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue, PropertyDescriptor property, bool ifExists)
        {
            if (property.PropertyType.IsAssignableFrom(storedValue.GetType()))
            {
                return storedValue;
            }

            if (property.PropertyType.IsInterface && IsDictionary(storedValue.GetType()))
            {
                return dictionaryAdapter.This.Factory.GetAdapter(property.PropertyType, storedValue as IDictionary);
            }

            return storedValue;
        }
开发者ID:trayburn,项目名称:BlogPosts,代码行数:14,代码来源:Program.cs


示例8: GetPropertyValue

        public object GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue,
            PropertyDescriptor property, bool ifExists)
        {
            var defaultValue = property.Annotations
                .OfType<DefaultValueAttribute>()
                .SingleOrDefault();

            if (storedValue == null && IsRequired(ifExists) && defaultValue == null)
                throw new KeyNotFoundException("key '" + key + "' not found");

            if (storedValue == null && defaultValue != null)
                return defaultValue.Value;

            return storedValue;
        }
开发者ID:cprieto,项目名称:SimpleConf,代码行数:15,代码来源:KeyMustExistBehaviour.cs


示例9: PropertyDescriptor

		object IDictionaryPropertyGetter.GetPropertyValue(
			IDictionaryAdapterFactory factory, IDictionary dictionary,
			string key, object storedValue, PropertyDescriptor property)
		{
			if (storedValue == null)
			{
				PropertyDescriptor descriptor = 
					new PropertyDescriptor(property.Property);
				descriptor.AddKeyBuilder(new DictionaryKeyPrefixAttribute(key));

				return factory.GetAdapter(
					property.Property.PropertyType, dictionary, descriptor);
			}

			return storedValue;
		}
开发者ID:ralescano,项目名称:castle,代码行数:16,代码来源:DictionaryComponentAttribute.cs


示例10: DictionaryAdapterInstance

		public DictionaryAdapterInstance(IDictionary dictionary, DictionaryAdapterMeta meta,
										 PropertyDescriptor descriptor, IDictionaryAdapterFactory factory)
		{
			Dictionary = dictionary;
			Descriptor = descriptor;
			Factory    = factory;

			List<IDictionaryBehavior> behaviors;

			if (null == descriptor || null == (behaviors = descriptor.BehaviorsInternal))
			{
				Initializers = meta.Initializers;
				Properties   = MergeProperties(meta.Properties);
			}
			else
			{
				Initializers = MergeInitializers(meta.Initializers, behaviors);
				Properties   = MergeProperties(meta.Properties, behaviors);
			}
		}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:20,代码来源:DictionaryAdapterInstance.cs


示例11: PropertyDescriptor

		object IDictionaryPropertyGetter.GetPropertyValue(IDictionaryAdapter dictionaryAdapter,
			string key, object storedValue, PropertyDescriptor property, bool ifExists)
		{
			if (storedValue == null)
			{
				var component = dictionaryAdapter.This.ExtendedProperties[property.PropertyName];

				if (component == null)
				{
					var descriptor = new PropertyDescriptor(property.Property, null);
					descriptor.AddKeyBuilder(new KeyPrefixAttribute(key));
					component = dictionaryAdapter.This.Factory.GetAdapter(
						property.Property.PropertyType, dictionaryAdapter.This.Dictionary, descriptor);
					dictionaryAdapter.This.ExtendedProperties[property.PropertyName] = component;
				}

				return component;
			}

			return storedValue;
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:21,代码来源:ComponentAttribute.cs


示例12: IsCollection

		private static bool IsCollection(PropertyDescriptor property, out Type collectionItemType)
		{
			collectionItemType = null;
			var propertyType = property.PropertyType;
			if (propertyType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(propertyType))
			{
				if (propertyType.IsArray)
				{
					collectionItemType = propertyType.GetElementType();
				}
				else if (propertyType.IsGenericType)
				{
					var arguments = propertyType.GetGenericArguments();
					collectionItemType = arguments[0];
				}
				else
				{
					collectionItemType = typeof(object);
				}
				return true;
			}
			return false;
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:23,代码来源:AbstractDictionaryAdapterVisitor.cs


示例13: SetPropertyValue

		public bool SetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, ref object value, PropertyDescriptor property)
		{
			value = (value != null) ? value.ToString() : null;
			return true;
		}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:5,代码来源:StringStorageAttribute.cs


示例14:

		String IDictionaryKeyBuilder.GetKey(IDictionaryAdapter dictionaryAdapter, String key, PropertyDescriptor property)
		{
			return String.Format("{0}#{1}", property.Property.DeclaringType.FullName, key);
		}
开发者ID:leloulight,项目名称:Core,代码行数:4,代码来源:TypeKeyPrefixAttribute.cs


示例15: IsVolatileProperty

		private static bool IsVolatileProperty(IDictionaryAdapter dictionaryAdapter, PropertyDescriptor property)
		{
			return dictionaryAdapter.Meta.Behaviors.Union(property.Behaviors).Any(behavior => behavior is VolatileAttribute);
		}
开发者ID:Jarvin-Guan,项目名称:CleanAOP,代码行数:4,代码来源:XPathAdapter.cs


示例16: ShouldIgnoreProperty

		private static bool ShouldIgnoreProperty(PropertyDescriptor property)
		{
			return property.Behaviors.Any(behavior => behavior is XmlIgnoreAttribute);
		}
开发者ID:Jarvin-Guan,项目名称:CleanAOP,代码行数:4,代码来源:XPathAdapter.cs


示例17: CopyBehaviors

		public override PropertyDescriptor CopyBehaviors(PropertyDescriptor other, Func<IDictionaryBehavior, bool> selector)
		{
			if (other is DictionaryDescriptor)
			{
				var otherDict = (DictionaryDescriptor)other;
				CopyMetaInitializers(otherDict, selector).CopyInitializers(otherDict, selector);
			}
			return base.CopyBehaviors(other, selector);
		}
开发者ID:ewhauser,项目名称:Castle.Core,代码行数:9,代码来源:DictionaryDescriptor.cs


示例18: CopyBehaviors

		public override PropertyDescriptor CopyBehaviors(PropertyDescriptor other)
		{
			if (other is DictionaryDescriptor)
			{
				var otherDict = (DictionaryDescriptor)other;
				CopyMetaInitializers(otherDict).CopyInitializers(otherDict);
			}
			return base.CopyBehaviors(other);
		}
开发者ID:firegrass,项目名称:Castle.Core,代码行数:9,代码来源:DictionaryDescriptor.cs


示例19: SetPropertyValue

		public bool SetPropertyValue(IDictionaryAdapter dictionaryAdapter,
			string key, ref object value, PropertyDescriptor property)
		{
			dictionaryAdapter.This.ExtendedProperties.Remove(property.PropertyName);
			return true;
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:6,代码来源:ComponentAttribute.cs


示例20:

		string IDictionaryKeyBuilder.GetKey(IDictionaryAdapter dictionaryAdapter, string key,
		                                    PropertyDescriptor property)
		{
			return prefix ?? key + "_";
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:5,代码来源:ComponentAttribute.cs



注:本文中的Castle.Components.DictionaryAdapter.PropertyDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.ComponentModel类代码示例发布时间:2022-05-24
下一篇:
C# Binder.CompositeNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap