本文整理汇总了C#中System.Reflection.MemberInfo.GetMemberFromDeclaringType方法的典型用法代码示例。如果您正苦于以下问题:C# MemberInfo.GetMemberFromDeclaringType方法的具体用法?C# MemberInfo.GetMemberFromDeclaringType怎么用?C# MemberInfo.GetMemberFromDeclaringType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.MemberInfo
的用法示例。
在下文中一共展示了MemberInfo.GetMemberFromDeclaringType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsOneToMany
protected virtual Boolean IsOneToMany(MemberInfo member, Boolean isLikely)
{
Type sourceType = member.DeclaringType;
Type destinationType = member.GetMemberFromDeclaringType().GetPropertyOrFieldType();
//check if the property is of a generic collection type
if ((destinationType.IsGenericCollection() == true) && (destinationType.GetGenericArguments().Length == 1))
{
Type destinationEntityType = destinationType.GetGenericArguments().Single();
//check if the type of the generic collection property is an entity
if (this.ModelInspector.IsEntity(destinationEntityType) == true)
{
//check if there is an equivalent property on the target type that is also a generic collection and points to this entity
PropertyInfo collectionInDestinationType = destinationEntityType.GetProperties().Where(x => (x.PropertyType.IsGenericCollection() == true) && (x.PropertyType.GetGenericArguments().Length == 1) && (x.PropertyType.GetGenericArguments().Single() == sourceType)).SingleOrDefault();
if (collectionInDestinationType != null)
{
return (false);
}
}
}
return (true);
}
开发者ID:rjperes,项目名称:DevelopmentWithADot.NHibernateConventions,代码行数:25,代码来源:ManyToManyConventionModelMapper.cs
示例2: ContainsMember
public static bool ContainsMember(this ICollection<MemberInfo> source, MemberInfo item)
{
return source.Count > 0 && (source.Contains(item) || (!item.DeclaringType.Equals(item.ReflectedType) && source.Contains(item.GetMemberFromDeclaringType())) ||
item.GetPropertyFromInterfaces().Any(source.Contains));
}
示例3: GetSplitGroupFor
public string GetSplitGroupFor(MemberInfo member)
{
var memberKey = member.GetMemberFromDeclaringType();
string splitGroup;
if (memberSplitGroup.TryGetValue(memberKey, out splitGroup))
{
return splitGroup;
}
return null;
}