Table of Contents

Interface IEntity

Namespace
ToSic.Eav.Data
Assembly
ToSic.Eav.Data.dll

The primary data-item in the system, IEntity is a generic data-item for any kind of information.

We recommend you read about the Understanding Data...

[PublicApi]
public interface IEntity : IAppIdentityLight, IHasPermissions, IHasMetadata
Inherited Members
Extension Methods

Properties

Attributes

All the attributes of the current Entity.

IReadOnlyDictionary<string, IAttribute> Attributes { get; }

Property Value

IReadOnlyDictionary<string, IAttribute>

Created

Gets the Created DateTime

DateTime Created { get; }

Property Value

DateTime

A date-time object.

EntityGuid

Gets the EntityGuid

Guid EntityGuid { get; }

Property Value

Guid

The GUID of the Entity

EntityId

Gets the EntityId

int EntityId { get; }

Property Value

int

The internal EntityId - usually for reference in the DB, but not quite always (like when this is a draft entity).

this[string]

Gets an Attribute using its StaticName

IAttribute? this[string attributeName] { get; }

Parameters

attributeName string

StaticName of the Attribute

Property Value

IAttribute

A typed Attribute Object

Metadata

Get the metadata for this item

IMetadata Metadata { get; }

Property Value

IMetadata

A typed Metadata provider for this Entity

Remarks

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

MetadataFor

Information which is relevant if this current entity is actually mapped to something else. If it is mapped, then it's describing another thing, which is identified in this MetadataFor.

ITarget MetadataFor { get; }

Property Value

ITarget

A ToSic.Eav.Metadata.ITarget object describing the target.

Modified

Gets the Last Modified DateTime

DateTime Modified { get; }

Property Value

DateTime

A date-time object.

Owner

Owner of this entity

string Owner { get; }

Property Value

string

A string identifying the owner. Uses special encoding to work with various user-ID providers.

OwnerId

Owner of this entity - as an int-ID

int OwnerId { get; }

Property Value

int

This is based on the Owner but will only return the ID

Remarks

Added in v15.03

Relationships

Relationship-helper object, important to navigate to children and parents

IEntityRelationships Relationships { get; }

Property Value

IEntityRelationships

The IEntityRelationships in charge of relationships for this Entity.

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.

Type

Gets the ContentType of this Entity

IContentType Type { get; }

Property Value

IContentType

The content-type object.

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

IEnumerable<IEntity?> Children(string? field = null, string? type = null)

Parameters

field string

Optional field name to access

type string

Optional type to filter for

Returns

IEnumerable<IEntity>

List of children, or empty list if not found. List can contain nulls, as there may be "empty" slots.

Get(string)

Get a value typed as object from this entity.

[PublicApi]
object? Get(string name)

Parameters

name string

the field/attribute name

Returns

object

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 string

the field/attribute name

noParamOrder NoParamOrder

see Convention: Named Parameters

language string

optional language like en-us

languages string[]

optional list of language IDs which can be a list which is checked in the order provided

Returns

object

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()

Best way to get the current entities title. The field used is determined in the IContentType. If you need the attribute-object, use the Title instead.

string? GetBestTitle()

Returns

string

The entity title as a string.

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

Parents(string?, string?)

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

IEnumerable<IEntity> Parents(string? type = null, string? field = null)

Parameters

type string

The type name to filter for

field string

The field name where a parent references this item

Returns

IEnumerable<IEntity>

List of children, or empty list if not found