• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    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...

    Inherited Members
    IEntityLight.EntityId
    IEntityLight.EntityGuid
    IEntityLight.MetadataFor
    IEntityLight.Type
    IEntityLight.Modified
    IEntityLight.Created
    IEntityLight.Relationships
    IEntityLight.GetBestTitle()
    IEntityLight.Owner
    IEntityLight.OwnerId
    IAppIdentityLight.AppId
    IHasPermissions.Permissions
    Namespace: ToSic.Eav.Data
    Assembly: ToSic.Eav.Core.dll
    Syntax
    [PublicApi_Stable_ForUseInYourCode]
    public interface IEntity : IPropertyLookup, IHasMetadata, ICanBeEntity, IEntity, IEntityLight, IAppIdentityLight, IPublish<IEntity>, IHasPermissions

    Properties

    | Improve this Doc View Source

    Attributes

    All the attributes of the current Entity.

    Declaration
    IImmutableDictionary<string, IAttribute> Attributes { get; }
    Property Value
    Type Description
    System.Collections.Immutable.IImmutableDictionary<System.String, IAttribute>
    | Improve this Doc View Source

    Item[String]

    Gets an Attribute using its StaticName

    Declaration
    IAttribute this[string attributeName] { get; }
    Parameters
    Type Name Description
    System.String attributeName

    StaticName of the Attribute

    Property Value
    Type Description
    IAttribute

    A typed Attribute Object

    | Improve this Doc View Source

    Metadata

    Get the metadata for this item

    Declaration
    IMetadataOf Metadata { get; }
    Property Value
    Type Description
    IMetadataOf

    A typed Metadata provider for this Entity

    Remarks

    The metadata is either already prepared, from the same app, or from a remote app

    | Improve this Doc View Source

    Title

    Gets the "official" Title-Attribute IAttribute<T>

    Declaration
    IAttribute Title { get; }
    Property Value
    Type Description
    IAttribute

    The title of this Entity. The field used is determined in the IContentType. If you need a string, use GetBestTitle() instead.

    | Improve this Doc View Source

    Version

    version of this entity in the repository

    Declaration
    int Version { get; }
    Property Value
    Type Description
    System.Int32

    The version number.

    Methods

    | Improve this Doc View Source

    Children(String, String)

    Get all the children IEntity items - optionally only of a specific field and/or type

    Declaration
    List<IEntity> Children(string field = null, string type = null)
    Parameters
    Type Name Description
    System.String field

    Optional field name to access

    System.String type

    Optional type to filter for

    Returns
    Type Description
    System.Collections.Generic.List<IEntity>

    List of children, or empty list if not found

    | Improve this Doc View Source

    GetBestTitle(String[])

    Best way to get the current entities title

    Declaration
    string GetBestTitle(string[] dimensions)
    Parameters
    Type Name Description
    System.String[] dimensions

    Array of dimensions/languages to use in the lookup

    Returns
    Type Description
    System.String

    The entity title as a string

    | Improve this Doc View Source

    GetBestValue(String, String[])

    Retrieves the best possible value for an attribute or virtual attribute (like EntityTitle) Automatically resolves the language-variations as well based on the list of preferred languages

    Declaration
    object GetBestValue(string attributeName, string[] languages)
    Parameters
    Type Name Description
    System.String attributeName

    Name of the attribute or virtual attribute

    System.String[] languages

    list of languages to search in

    Returns
    Type Description
    System.Object

    An object OR a null - for example when retrieving the title and no title exists the object is string, int or even a EntityRelationship

    | Improve this Doc View Source

    GetBestValue<T>(String, String[])

    Retrieves the best possible value for an attribute or virtual attribute (like EntityTitle) Automatically resolves the language-variations as well based on the list of preferred languages. Will cast/convert to the expected type, or return null / default value for that type if not possible.

    Declaration
    T GetBestValue<T>(string attributeName, string[] languages)
    Parameters
    Type Name Description
    System.String attributeName

    Name of the attribute or virtual attribute

    System.String[] languages

    list of languages to search in

    Returns
    Type Description
    T

    An object OR a null - for example when retrieving the title and no title exists the object is string, int or even a EntityRelationship

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Parents(String, String)

    Get all the parent IEntity items - optionally only of a specific type and/or referenced in a specific field

    Declaration
    List<IEntity> Parents(string type = null, string field = null)
    Parameters
    Type Name Description
    System.String type

    The type name to filter for

    System.String field

    The field name where a parent references this item

    Returns
    Type Description
    System.Collections.Generic.List<IEntity>

    List of children, or empty list if not found

    | Improve this Doc View Source

    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.

    Declaration
    object Value(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName
    Returns
    Type Description
    System.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.

    | Improve this Doc View Source

    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.

    Declaration
    T Value<T>(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName
    Returns
    Type Description
    T

    The typed value or the (default) value - so a null for strings, false for boolean etc.

    Type Parameters
    Name Description
    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.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX