Class ModelAttributeCollection
Attributes on models. This class are used by the ContentTypeModel and PropertyDefinitionModel to add the class attributes to the models.
Inheritance
Inherited Members
Namespace: EPiServer.DataAbstraction.RuntimeModel
Assembly: EPiServer.dll
Version: 11.20.7Syntax
public class ModelAttributeCollection
Constructors
ModelAttributeCollection()
Declaration
public ModelAttributeCollection()
Methods
AddAttribute(Attribute)
Adds an attribute to the attribute list.
Declaration
public void AddAttribute(Attribute attribute)
Parameters
Type | Name | Description |
---|---|---|
System.Attribute | attribute | The attribute. |
AttributeExist<T>()
Returns true
if the T
. exist on the model, otherwise false
.
Declaration
public bool AttributeExist<T>()
where T : Attribute
Returns
Type | Description |
---|---|
System.Boolean |
|
Type Parameters
Name | Description |
---|---|
T | The attribute type to look for. |
GetAllAttributes<T>()
Gets all attributes of type T
.
Declaration
public IEnumerable<T> GetAllAttributes<T>()
where T : Attribute
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | All attribute of type |
Type Parameters
Name | Description |
---|---|
T | The attribute type. |
GetSingleAttribute<T>()
Gets the attribute of the type T
.
Declaration
public T GetSingleAttribute<T>()
where T : Attribute
Returns
Type | Description |
---|---|
T | The attribute of type |
Type Parameters
Name | Description |
---|---|
T | The attribute type. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If more than one attribute of the type |
TryGetSingleAttribute<T>(out T)
Tries to get the attribute of the type T
.
Declaration
public bool TryGetSingleAttribute<T>(out T attribute)
where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
T | attribute | The returned attribute. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Type Parameters
Name | Description |
---|---|
T | The attribute type. |