Interface IEntity
The primary data-item in the system, IEntity is a generic data-item for any kind of information. Note that it inherits IEntityLight which is the basic definition without languages, versioning, publishing etc.
We recommend you read about the Understanding Data...
[PublicApi]
public interface IEntity : IHasMetadata, IEntityLight, IAppIdentityLight, IHasPermissions
- Inherited Members
Properties
Attributes
All the attributes of the current Entity.
IImmutableDictionary<string, IAttribute> Attributes { get; }
Property Value
this[string]
Gets an Attribute using its StaticName
IAttribute this[string attributeName] { get; }
Parameters
attributeName
stringStaticName of the Attribute
Property Value
- IAttribute
A typed Attribute Object
Metadata
Get the metadata for this item
IMetadataOf Metadata { get; }
Property Value
- IMetadataOf
A typed Metadata provider for this Entity
Remarks
The metadata is either already prepared, from the same app, or from a remote app
Title
Gets the "official" Title-Attribute IAttribute<T>
IAttribute Title { get; }
Property Value
- IAttribute
The title of this Entity. The field used is determined in the IContentType. If you need a string, use GetBestTitle() instead.
Version
version of this entity in the repository
int Version { get; }
Property Value
- int
The version number.
Methods
Children(string, string)
Get all the children IEntity items - optionally only of a specific field and/or type
List<IEntity> Children(string field = null, string type = null)
Parameters
Returns
Get(string)
Get a value typed as object from this entity.
[PublicApi]
object Get(string name)
Parameters
name
stringthe field/attribute name
Returns
Remarks
- Introduced as beta in 15.06, published in v17
- If you want to supply a
fallback
it will automatically use the generic version of this method
Get(string, NoParamOrder, string, string[])
Get a value typed as object from this entity.
[PublicApi]
object Get(string name, NoParamOrder noParamOrder = default, string language = null, string[] languages = null)
Parameters
name
stringthe field/attribute name
noParamOrder
NoParamOrderlanguage
stringoptional language like
en-us
languages
string[]optional list of language IDs which can be a list which is checked in the order provided
Returns
Remarks
- Introduced as beta in 15.06, published in v17
- If you want to supply a
fallback
it will automatically use the generic version of this method
GetBestTitle(string[])
Best way to get the current entities title
string GetBestTitle(string[] dimensions)
Parameters
dimensions
string[]Array of dimensions/languages to use in the lookup
Returns
- string
The entity title as a string
Get<TValue>(string)
Get a value in the expected type from this entity.
[PublicApi]
TValue Get<TValue>(string name)
Parameters
name
stringthe field/attribute name
Returns
- TValue
Type Parameters
TValue
The type to try-convert the result to
Remarks
- Introduced as beta in 15.06, published in v17
- If you want to supply a
fallback
it will automatically use the other version of this method
Get<TValue>(string, NoParamOrder, TValue, string, string[])
Get a value in the expected type from this entity - or a fallback value instead.
[PublicApi]
TValue Get<TValue>(string name, NoParamOrder noParamOrder = default, TValue fallback = default, string language = null, string[] languages = null)
Parameters
name
stringthe field/attribute name
noParamOrder
NoParamOrderfallback
TValuevalue to be returned if finding or conversion it didn't succeed
language
stringoptional language like
en-us
languages
string[]optional list of language IDs which can be a list which is checked in the order provided
Returns
- TValue
Type Parameters
TValue
The type to try-convert the result to
Remarks
- Introduced as beta in 15.06, published in v17
- If you want to supply a
fallback
it will automatically use the generic version of this method
Parents(string, string)
Get all the parent IEntity items - optionally only of a specific type and/or referenced in a specific field
List<IEntity> Parents(string type = null, string field = null)
Parameters
type
stringThe type name to filter for
field
stringThe field name where a parent references this item
Returns
Value(string)
Get the value of this field as an object. This overload without languages will always return the first value it finds, so if the data is multi-lingual, it's not reliable. This is preferred for internal work for configuration objects and similar which are not multi-language.
object Value(string fieldName)
Parameters
fieldName
string
Returns
- object
The value or null if not found
Remarks
In addition to the fields this Entity has (like FirstName, etc.) you can also use known terms like EntityId, Modified etc.
Value<T>(string)
Get the value of this field in a type-safe way. This overload without languages will always return the first value it finds, so if the data is multi-lingual, it's not reliable. This is preferred for internal work for configuration objects and similar which are not multi-language.
T Value<T>(string fieldName)
Parameters
fieldName
string
Returns
- T
The typed value or the (default) value - so a null for strings, false for boolean etc.
Type Parameters
T
The type, usually string, int, bool, etc.
Remarks
In addition to the fields this Entity has (like FirstName, etc.) you can also use known terms like EntityId, Modified etc.