Table of Contents

Interface ITarget

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

Reference to target. Usually used on IEntity to define what thing it provides additional metadata for. Basically it contains all the references necessary to identify what it belongs to.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public interface ITarget

Properties

IsMetadata

Determines if the current thing is used as Metadata.

[JsonIgnore]
bool IsMetadata { get; }

Property Value

bool

True if it's a metadata item, false if not.

KeyGuid

A GUID key identifying a target.

[JsonPropertyName("Guid")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
Guid? KeyGuid { get; }

Property Value

Guid?

The GUID key of the target. Null if the identifier is not a string.

KeyNumber

A number (int) key identifying a target.

[JsonPropertyName("Number")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
int? KeyNumber { get; }

Property Value

int?

The number key of the target. Null if the identifier is not a string.

KeyString

A string key identifying a target.

[JsonPropertyName("String")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
string? KeyString { get; }

Property Value

string

The string key of the target. Null if the identifier is not a string.

TargetType

If this is metadata, then the target could be anything. This is an ID telling what kind of thing we're enhancing.

[JsonPropertyName("Target")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
int TargetType { get; }

Property Value

int

An ID from the system which registers all the types of things that can be described. See also ToSic.Eav.Metadata.Targets.ITargetTypeService.

Remarks

  • In 2sxc 8 - 12 this is called AssignmentObjectTypeId in the DB, but will change some day.
  • It must be an int, not a TargetTypes enum, because the DB could hold values which are not in the enum