当前位置: 首页>>代码示例>>C#>>正文


C# MemberInfo.GetPropertyOrFieldType方法代码示例

本文整理汇总了C#中System.Reflection.MemberInfo.GetPropertyOrFieldType方法的典型用法代码示例。如果您正苦于以下问题:C# MemberInfo.GetPropertyOrFieldType方法的具体用法?C# MemberInfo.GetPropertyOrFieldType怎么用?C# MemberInfo.GetPropertyOrFieldType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.MemberInfo的用法示例。


在下文中一共展示了MemberInfo.GetPropertyOrFieldType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsOneToMany

        private bool IsOneToMany(MemberInfo member, bool declared)
        {
            if (declared) return true;
            if (member.GetPropertyOrFieldType().IsGenericCollection() == false) return false;

            var collectionElementType = member.GetPropertyOrFieldType().GetGenericArguments().First();

            var isOneToMany = ManyToMany.IsManyToMany(member) == false && Mapper.ModelInspector.IsEntity(collectionElementType);

            return  isOneToMany;
        }
开发者ID:solyutor,项目名称:enhima,代码行数:11,代码来源:OneToMany.cs

示例2: Component

		public void Component(MemberInfo property, Action<IComponentElementMapper> mapping)
		{
			System.Type nestedComponentType = property.GetPropertyOrFieldType();
			var hbm = new HbmNestedCompositeElement { name = property.Name, @class = nestedComponentType.GetShortClassName(_mapDoc) };
			mapping(new ComponentNestedElementMapper(nestedComponentType, _mapDoc, hbm, property));
			AddProperty(hbm);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:ComponentElementMapper.cs

示例3: OneToOne

		public virtual void OneToOne(MemberInfo property, Action<IOneToOneMapper> mapping)
		{
			var hbm = new HbmOneToOne {name = property.Name};
			var type = typeof(OneToOneMapper<>).MakeGenericType(property.GetPropertyOrFieldType());
			var mapper = (IOneToOneMapper)Activator.CreateInstance(type, property, hbm);
			mapping(mapper);
			AddProperty(hbm);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:8,代码来源:AbstractPropertyContainerMapper.cs

示例4: should_get_value

 public void should_get_value(CachedMember cachedMember, MemberInfo memberInfo)
 {
     var @object = new Members();
     @object.SetPropertyOrFieldValue(memberInfo.Name,
         memberInfo.GetPropertyOrFieldType() == typeof(string) ?
             "hai" : (object)(Optional<string>)"hai");
     cachedMember.GetValue(@object).As<string>().ShouldEqual("hai");
 }
开发者ID:mikeobrien,项目名称:Bender,代码行数:8,代码来源:CachedMemberTests.cs

示例5: IdBag

		public virtual void IdBag(MemberInfo property, Action<IIdBagPropertiesMapper> collectionMapping, Action<ICollectionElementRelation> mapping)
		{
			var hbm = new HbmIdbag { name = property.Name };
			System.Type propertyType = property.GetPropertyOrFieldType();
			System.Type collectionElementType = propertyType.DetermineCollectionElementType();
			collectionMapping(new IdBagMapper(container, collectionElementType, hbm));
			mapping(new CollectionElementRelation(collectionElementType, MapDoc, rel => hbm.Item = rel));
			AddProperty(hbm);
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:9,代码来源:AbstractPropertyContainerMapper.cs

示例6: Set

 public virtual void Set(MemberInfo property, Action<ISetPropertiesMapper> collectionMapping, Action<ICollectionElementRelation> mapping)
 {
     var hbm = new HbmSet { name = property.Name };
     var propertyType = property.GetPropertyOrFieldType();
     var collectionElementType = propertyType.DetermineCollectionElementType();
     collectionMapping(new SetMapper(container, collectionElementType, hbm));
     mapping(new CollectionElementRelation(collectionElementType, MapDoc, rel => hbm.Item = rel));
     AddProperty(hbm);
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:9,代码来源:AbstractPropertyContainerMapper.cs

示例7: Component

		public virtual void Component(MemberInfo property, Action<IComponentMapper> mapping)
		{
			if (!IsMemberSupportedByMappedContainer(property))
			{
				throw new ArgumentOutOfRangeException("property", "Can't add a property of another graph");
			}
			var hbm = new HbmComponent { name = property.Name };
			mapping(new ComponentMapper(hbm, property.GetPropertyOrFieldType(), property, MapDoc));
			AddProperty(hbm);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:AbstractBasePropertyContainerMapper.cs

示例8: Property

		public void Property(MemberInfo property, Action<IPropertyMapper> mapping)
		{
			var hbmProperty = new HbmProperty
			                  {
			                  	name = property.Name, 
													type1 = property.GetPropertyOrFieldType().GetNhTypeName()
			                  };

			mapping(new PropertyMapper(property, hbmProperty, new NoMemberPropertyMapper()));
			AddProperty(hbmProperty);
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:11,代码来源:DynamicComponentMapper.cs

示例9: Match

 public override bool Match(MemberInfo subject)
 {
     bool isBidirectionalUnaryAssociation = base.Match(subject);
     if (isBidirectionalUnaryAssociation)
     {
         Type from = subject.DeclaringType;
         Type to = subject.GetPropertyOrFieldType();
         return DomainInspector.IsOneToOne(from, to) && DomainInspector.IsMasterOneToOne(from, to)
                && DomainInspector.IsOneToOne(to, from);
     }
     return false;
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:12,代码来源:BidirectionalPrimaryKeyAssociationMasterOneToOnePattern.cs

示例10: Map

		public virtual void Map(MemberInfo property, Action<IMapPropertiesMapper> collectionMapping,
								Action<IMapKeyRelation> keyMapping, Action<ICollectionElementRelation> mapping)
		{
			var hbm = new HbmMap {name = property.Name};
			System.Type propertyType = property.GetPropertyOrFieldType();
			System.Type dictionaryKeyType = propertyType.DetermineDictionaryKeyType();
			System.Type dictionaryValueType = propertyType.DetermineDictionaryValueType();

			collectionMapping(new MapMapper(container, dictionaryKeyType, dictionaryValueType, hbm, mapDoc));
			keyMapping(new MapKeyRelation(dictionaryKeyType, hbm, mapDoc));
			mapping(new CollectionElementRelation(dictionaryValueType, MapDoc, rel => hbm.Item1 = rel));
			AddProperty(hbm);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:13,代码来源:AbstractPropertyContainerMapper.cs

示例11: MemberMatch

 protected override bool MemberMatch(MemberInfo subject)
 {
     Type memberType = subject.GetPropertyOrFieldType();
     if (typeof(IDictionary).IsAssignableFrom(memberType))
     {
         return true;
     }
     if (memberType.IsGenericType)
     {
         return memberType.GetGenericIntercafesTypeDefinitions().Contains(typeof(IDictionary<,>));
     }
     return false;
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:13,代码来源:DictionaryCollectionPattern.cs

示例12: IsSetFieldType

        private static bool IsSetFieldType(MemberInfo mi, bool declared)
        {
            var propertyTypeIsSet = mi.GetPropertyOrFieldType()
            .GetGenericIntercafesTypeDefinitions()
            .Contains(typeof (ISet<>));

              if (propertyTypeIsSet) return true;

              var backFieldInfo = PropertyToField.GetBackFieldInfo((PropertyInfo) mi);

              return backFieldInfo != null
             && backFieldInfo
                  .FieldType.GetGenericIntercafesTypeDefinitions().Contains(typeof (ISet<>));
        }
开发者ID:horsdal,项目名称:Restbucks-on-Nancy,代码行数:14,代码来源:Mapper.cs

示例13: MatchOneToMany

		private bool MatchOneToMany(MemberInfo memberInfo)
		{
			var modelInspector = (IModelInspector) this;
			System.Type from = memberInfo.ReflectedType;
			System.Type to = memberInfo.GetPropertyOrFieldType().DetermineCollectionElementOrDictionaryValueType();
			if(to == null)
			{
				// no generic collection or simple property
				return false;
			}
			bool areEntities = modelInspector.IsEntity(from) && modelInspector.IsEntity(to);
			bool isFromComponentToEntity = modelInspector.IsComponent(from) && modelInspector.IsEntity(to);
			return !declaredModel.IsManyToMany(memberInfo) && (areEntities || isFromComponentToEntity);
		}
开发者ID:pontillo,项目名称:PowerNap,代码行数:14,代码来源:SimpleModelInspector.cs

示例14: IdMapper

 public IdMapper(MemberInfo member, HbmId hbmId)
 {
     this.hbmId = hbmId;
     if (member != null)
     {
         var idType = member.GetPropertyOrFieldType();
         hbmId.name = member.Name;
         hbmId.type1 = idType.GetNhTypeName();
         accessorMapper = new AccessorPropertyMapper(member.DeclaringType, member.Name, x => hbmId.access = x);
     }
     else
     {
         accessorMapper = new NoMemberPropertyMapper();
     }
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:15,代码来源:IdMapper.cs

示例15: MemberMatch

 protected override bool MemberMatch(MemberInfo subject)
 {
     Type memberType = subject.GetPropertyOrFieldType();
     if (IsNotSupportedAsList(memberType))
     {
         return false;
     }
     if (typeof (IList).IsAssignableFrom(memberType))
     {
         return true;
     }
     if (memberType.IsGenericType)
     {
         var isList = memberType.GetGenericIntercafesTypeDefinitions().Contains(typeof(IList<>));
         // a bidirectional one-to-many should use Bag or Set
         return isList && !(new BidirectionalOneToManyPattern(domainInspector).Match(new Relation(subject.DeclaringType, memberType.DetermineCollectionElementType())));
     }
     return false;
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:19,代码来源:ListCollectionPattern.cs


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