Class IdentityObjectExtensions
Provides extension methods for System.
Inheritance
System.Object
IdentityObjectExtensions
Namespace: EPiServer.Data
Assembly: EPiServer.Data.dll
Version: 12.0.3Syntax
public static class IdentityObjectExtensions : Object
Methods
GetIdentity(Object)
Extracts the identity from the object if it has one.
Declaration
public static Identity GetIdentity(this object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The object to check for identity |
Returns
Remarks
The algorith used to extract identity is as follows:
- The object is checked to see if it implements the IDynamic
Data interface and if so its Id property is called. - The object is reflected to search for a property named Id with a getter whose type is either Identity or System.
Guid - The object is checked to see if it implements the IEntity interface and if so its ID and UniqueId properties are called
SetIdentity(Object, Identity)
Sets the identity into the object if supported
Declaration
public static void SetIdentity(this object value, Identity id)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The object to set the identity in |
Identity | id | The Identity to set |
Remarks
The algorith used to set identity is as follows:
- The object is checked to see if it implements the IDynamic
Data interface and if so its Id property is set. - The object is reflected to search for a property named Id with a setter whose type is either Identity or System.
Guid - The object is checked to see if it implements the IEntity interface and if so its Id property is set.