Class ItemLinkField<TTargetModel>

Version: 21.x

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

Inheritance
System.Object
ItemLinkField<TTargetModel>
Namespace: Sitecore.LayoutService.Client.Response.Model.Fields
Assembly: Sitecore.LayoutService.Client.Abstractions.dll
Syntax
RequestResponse
public class ItemLinkField<TTargetModel> : ItemLinkField, IFieldsReader, IField, IFieldReader where TTargetModel : class
Type Parameters
NameDescription
TTargetModel

Target model type.

Constructors

ItemLinkField()

Declaration
RequestResponse
public ItemLinkField()

Properties

Fields

Gets or sets the strongly typed target.

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

Target

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

Declaration
RequestResponse
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
RequestResponse
protected override object HandleRead(Type type)
Parameters
TypeNameDescription
System.Typetype

The type to read the field as.

Returns
TypeDescription
System.Object

A new instance of the specified type.

Overrides

Read(Type)

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

Declaration
RequestResponse
public override object Read(Type type)
Parameters
TypeNameDescription
System.Typetype

The type of field to be read.

Returns
TypeDescription
System.Object

A new instance if successful.

Overrides

Read<TField>()

Reads the current Field as the specified type.

Declaration
RequestResponse
public override TField Read<TField>()
    where TField : IField
Returns
TypeDescription
TField

A new instance of TField.

Type Parameters
NameDescription
TField

The type of Field to be read.

Overrides

TryRead(Type, out IField)

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

Declaration
RequestResponse
public override bool TryRead(Type type, out IField field)
Parameters
TypeNameDescription
System.Typetype

The type of field to be read.

IFieldfield

The resulting field.

Returns
TypeDescription
System.Boolean

True if the field could be read as the specified type, otherwise false.

Overrides

TryRead<TField>(out TField)

Attempts to read the current Field as the specified type.

Declaration
RequestResponse
public override bool TryRead<TField>(out TField field)
    where TField : IField
Parameters
TypeNameDescription
TFieldfield

The resulting instance if successful.

Returns
TypeDescription
System.Boolean

True if the field could be read as the specified type, otherwise false.

Type Parameters
NameDescription
TField

The type of Field to be read.

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

Implements

Do you have some feedback for us?

If you have suggestions for improving this article,