本文整理汇总了C#中System.Reflection.PropertyInfo.IsIgnored方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyInfo.IsIgnored方法的具体用法?C# PropertyInfo.IsIgnored怎么用?C# PropertyInfo.IsIgnored使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.PropertyInfo
的用法示例。
在下文中一共展示了PropertyInfo.IsIgnored方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddComplexProperty
public virtual ComplexPropertyConfiguration AddComplexProperty(PropertyInfo propertyInfo)
{
if (propertyInfo == null)
{
throw Error.ArgumentNull("propertyInfo");
}
if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType))
{
throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType, propertyInfo.Name, ClrType.FullName);
}
if (propertyInfo.PropertyType == ClrType)
{
throw Error.Argument("propertyInfo", SRResources.RecursiveComplexTypesNotAllowed, ClrType.FullName, propertyInfo.Name);
}
ValidatePropertyNotAlreadyDefinedInBaseTypes(propertyInfo);
ValidatePropertyNotAlreadyDefinedInDerivedTypes(propertyInfo);
ComplexPropertyConfiguration propertyConfiguration;
if (!propertyInfo.IsIgnored(this))
{
propertyConfiguration = ExplicitProperties[propertyInfo] as ComplexPropertyConfiguration;
if (propertyConfiguration == null)
{
throw Error.Argument("propertyInfo", SRResources.MustBeComplexProperty, propertyInfo.Name, ClrType.FullName);
}
}
else
{
propertyConfiguration = new ComplexPropertyConfiguration(propertyInfo, this);
ExplicitProperties[propertyInfo] = propertyConfiguration;
// Make sure the complex type is in the model.
ModelBuilder.AddComplexType(propertyInfo.PropertyType);
}
return propertyConfiguration;
}
示例2: AddCollectionProperty
/// <summary>
/// Adds a collection property to this edm type.
/// </summary>
/// <param name="propertyInfo">The property being added.</param>
/// <returns>The <see cref="CollectionPropertyConfiguration"/> so that the property can be configured further.</returns>
public virtual CollectionPropertyConfiguration AddCollectionProperty(PropertyInfo propertyInfo)
{
if (propertyInfo == null)
{
throw Error.ArgumentNull("propertyInfo");
}
if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType))
{
throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType);
}
ValidatePropertyNotAlreadyDefinedInBaseTypes(propertyInfo);
ValidatePropertyNotAlreadyDefinedInDerivedTypes(propertyInfo);
CollectionPropertyConfiguration propertyConfiguration;
if (!propertyInfo.IsIgnored(this))
{
propertyConfiguration = ExplicitProperties[propertyInfo] as CollectionPropertyConfiguration;
if (propertyConfiguration == null)
{
throw Error.Argument("propertyInfo", SRResources.MustBeCollectionProperty, propertyInfo.Name, propertyInfo.DeclaringType.FullName);
}
}
else
{
propertyConfiguration = new CollectionPropertyConfiguration(propertyInfo, this);
ExplicitProperties[propertyInfo] = propertyConfiguration;
// If the ElementType is the same as this type this is recursive complex type nesting
if (propertyConfiguration.ElementType == ClrType)
{
throw Error.Argument("propertyInfo",
SRResources.RecursiveComplexTypesNotAllowed,
ClrType.Name,
propertyConfiguration.Name);
}
// If the ElementType is not primitive or enum treat as a ComplexType and Add to the model.
IEdmPrimitiveTypeReference edmType =
EdmLibHelpers.GetEdmPrimitiveTypeReferenceOrNull(propertyConfiguration.ElementType);
if (edmType == null)
{
if (!TypeHelper.IsEnum(propertyConfiguration.ElementType))
{
ModelBuilder.AddComplexType(propertyConfiguration.ElementType);
}
}
}
return propertyConfiguration;
}
示例3: AddEnumProperty
/// <summary>
/// Adds an enum property to this edm type.
/// </summary>
/// <param name="propertyInfo">The property being added.</param>
/// <returns>The <see cref="EnumPropertyConfiguration"/> so that the property can be configured further.</returns>
public virtual EnumPropertyConfiguration AddEnumProperty(PropertyInfo propertyInfo)
{
if (propertyInfo == null)
{
throw Error.ArgumentNull("propertyInfo");
}
if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType))
{
throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType, propertyInfo.Name, ClrType.FullName);
}
if (!TypeHelper.IsEnum(propertyInfo.PropertyType))
{
throw Error.Argument("propertyInfo", SRResources.MustBeEnumProperty, propertyInfo.Name, ClrType.FullName);
}
ValidatePropertyNotAlreadyDefinedInBaseTypes(propertyInfo);
ValidatePropertyNotAlreadyDefinedInDerivedTypes(propertyInfo);
EnumPropertyConfiguration propertyConfiguration;
if (!propertyInfo.IsIgnored(this))
{
propertyConfiguration = ExplicitProperties[propertyInfo] as EnumPropertyConfiguration;
if (propertyConfiguration == null)
{
throw Error.Argument("propertyInfo", SRResources.MustBeEnumProperty, propertyInfo.Name, ClrType.FullName);
}
}
else
{
propertyConfiguration = new EnumPropertyConfiguration(propertyInfo, this);
ExplicitProperties[propertyInfo] = propertyConfiguration;
}
return propertyConfiguration;
}