Class AllowedTypesAttribute
Assigns types that the property accept or restrict adding.
Inheritance
Namespace: EPiServer.DataAnnotations
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public sealed class AllowedTypesAttribute : ValidationAttribute
Constructors
AllowedTypesAttribute()
Initializes a new instance of the Allowed
Declaration
public AllowedTypesAttribute()
AllowedTypesAttribute(Type[])
Initializes a new instance of the Allowed
Declaration
public AllowedTypesAttribute(params Type[] allowedTypes)
Parameters
Type | Name | Description |
---|---|---|
System. |
allowedTypes | The allowed types. The null value is replaced with IContentData. |
AllowedTypesAttribute(Type[], Type[])
Initializes a new instance of the Allowed
Declaration
public AllowedTypesAttribute(Type[] allowedTypes, Type[] restrictedTypes)
Parameters
Type | Name | Description |
---|---|---|
System. |
allowedTypes | The allowed types. The null value is replaced with IContentData. |
System. |
restrictedTypes | The restricted types |
AllowedTypesAttribute(Type[], Type[], String)
Initializes a new instance of the Allowed
Declaration
public AllowedTypesAttribute(Type[] allowedTypes, Type[] restrictedTypes, string typesFormatSuffix)
Parameters
Type | Name | Description |
---|---|---|
System. |
allowedTypes | The allowed types. The null value is replaced with IContentData. |
System. |
restrictedTypes | The restricted types |
System. |
typesFormatSuffix | The TypesFormatSuffix |
Properties
AllowedTypes
Gets or sets the allowed types.
Declaration
public Type[] AllowedTypes { get; set; }
Property Value
Type | Description |
---|---|
System. |
The allowed types. |
Remarks
Setting value null is treated as all IContent
Restricted
RestrictedTypes
Gets types which the property is not allowed to contain.
Declaration
public Type[] RestrictedTypes { get; set; }
Property Value
Type | Description |
---|---|
System. |
Remarks
Restricted
TypesFormatSuffix
Gets or sets types format suffix.
Declaration
public string TypesFormatSuffix { get; set; }
Property Value
Type | Description |
---|---|
System. |
The types format suffix. |
Methods
IsValid(Object, ValidationContext)
Declaration
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | |
System. |
validationContext |
Returns
Type | Description |
---|---|
System. |