Class ItemLinkField

Version: 21.x

Facilitates mapping a link field to a specific target model type.

Inheritance

System.Object

FieldsReader

ItemLinkField

ItemLinkField

Implements

IFieldsReader

IField

IFieldReader

Inherited Members

ItemLinkField.Id

ItemLinkField.Url

FieldsReader.ReadField(String)

FieldsReader.TryReadField(String, TField)

FieldsReader.ReadFields()

FieldsReader.TryReadFields(T)

FieldsReader.ReadField(Type, String)

FieldsReader.TryReadField(Type, String, Object)

FieldsReader.TryReadFields(Type, Object)

FieldsReader.ReadFields(Type)

FieldsReader.HandleReadFields(Type)

Namespace: Sitecore.LayoutService.Client.Response.Model.Fields
Assembly: Sitecore.LayoutService.Client.Abstractions.dll
Syntax
public class ItemLinkField<TTargetModel> : ItemLinkField, IFieldsReader, IField, IFieldReader where TTargetModel : class
Type Parameters
NameDescription
TTargetModelTarget model type.

Constructors

ItemLinkField()

Declaration
public ItemLinkField()

Properties

Fields

Gets or sets the strongly typed target.

Declaration
public TTargetModel Fields { get; set; }
Property Value
TypeDescription
TTargetModel

Target

Gets or sets the strongly types target if the item link.

Declaration
public TTargetModel Target { get; protected set; }
Property Value
TypeDescription
TTargetModel

Methods

HandleRead(Type)

Returns an instance of the Field data as a specified type.

Declaration
protected override object HandleRead(Type type)
Parameters
TypeNameDescription
System.TypetypeThe type to read the field as.
Returns
TypeDescription
System.ObjectA new instance of the specified type.
Overrides

ItemLinkField.HandleRead(Type)

Read(Type)

Reads the current Field as the specified type. The type must implement IField.

Declaration
public override object Read(Type type)
Parameters
TypeNameDescription
System.TypetypeThe type of field to be read.
Returns
TypeDescription
System.ObjectA new instance if successful.
Overrides

ItemLinkField.Read(Type)

Read()

Reads the current Field as the specified type.

Declaration
public override TField Read<TField>()
    where TField : IField
Returns
TypeDescription
TFieldA new instance of TField.
Type Parameters
NameDescription
TFieldThe type of Field to be read.
Overrides

ItemLinkField.Read()

TryRead(Type, out IField)

Attempts to read the current Field as the specified type. The type must implement IField.

Declaration
public override bool TryRead(Type type, out IField field)
Parameters
TypeNameDescription
System.TypetypeThe type of field to be read.
IFieldfieldThe resulting field.
Returns
TypeDescription
System.BooleanTrue if the field could be read as the specified type, otherwise false.
Overrides

ItemLinkField.TryRead(Type, out IField)

TryRead(out TField)

Attempts to read the current Field as the specified type.

Declaration
public override bool TryRead<TField>(out TField field)
    where TField : IField
Parameters
TypeNameDescription
TFieldfieldThe resulting instance if successful.
Returns
TypeDescription
System.BooleanTrue if the field could be read as the specified type, otherwise false.
Type Parameters
NameDescription
TFieldThe type of Field to be read.
Overrides

Sitecore.LayoutService.Client.Response.Model.Fields.ItemLinkField.TryRead(TField)

Implements

IFieldsReader

IField

IFieldReader

If you have suggestions for improving this article, let us know!