Table of Contents

Class RawEntity

Namespace
ToSic.Eav.Data.Raw
Assembly
ToSic.Eav.Data.Build.dll

A ready-to-use IRawEntity which receives all the data in the constructor.

Use this for scenarios where you don't want to create your own IRawEntity but wish to return this kind of typed object.

[WorkInProgressApi("v22")]
public record RawEntity : IRawEntity, IRawData, IHasMetadata, IEquatable<RawEntity>
Inheritance
object
RawEntity
Implements
Extension Methods

Remarks

  • Added in 15.04 - was public for a while, but never quite stable, believe never used
  • Made private again in 16.09
  • Moved to .Sys ca. v20 - no complaints, so seems to be unused
  • Changed to be record instead of class v22 (WIP)

Properties

Created

Created - either the real creation date or the DateTime.Now

public virtual DateTime Created { get; set; }

Property Value

DateTime

Guid

The Guid to use. Must always be set. If you don't have a GUID, use Guid.Empty

public virtual Guid Guid { get; set; }

Property Value

Guid

Id

The ID to use. If the real object doesn't have a real ID, please do not set at all. It will then keep the default and will auto-enumerate.

public virtual int Id { get; set; }

Property Value

int

Metadata

WIP experimental v18.02 - trying to get content-type metadata into the raw entity

public IMetadata? Metadata { get; init; }

Property Value

IMetadata

Remarks

Explicitly nullable, even if the IHasMetadata interface would not expect this.

Modified

Modified - either the real creation date or the DateTime.Now

public virtual DateTime Modified { get; set; }

Property Value

DateTime

RelationshipKeys

Optional relationship keys - can also be null if never specified.

The keys this object provides - meaning a reference to such a key should point to this object. Keys can be int, string or something else.

Example

  1. if another IRawEntity has a property (like Folders)
  2. of type IRawRelationship/ToSic.Eav.Data.Raw.RawRelationship
  3. which lists the key /abcd/efg

Then it will ask all other IRawEntity of ToSic.Eav.Data.Raw.IRelationshipKeys if they have a /abcd/efg in their RelationshipKeys.

public IEnumerable<object>? RelationshipKeys { get; init; }

Property Value

IEnumerable<dynamic>

Values

Dictionary of all values to be added.

public IDictionary<string, object?> Values { get; set; }

Property Value

IDictionary<string, object>

Remarks

  • Please ensure it doesn't have duplicate keys.
  • ...and also not keys which are only different in casing.
  • Also ensure you don't use spaces, dots or special characters in keys

Methods

GetValues()

Override this method to provide the values for the entity. By default, it returns an empty dictionary.

protected virtual IDictionary<string, object?> GetValues()

Returns

IDictionary<string, object>

Remarks

This is needed because we don't want to make Values virtual, since any implementation would also have to implement the init, defeating the purpose.