Class ItemLinkField<TTargetModel>
Facilitates mapping a link field to a specific target model type.
Inherited Members
Namespace: Sitecore.LayoutService.Client.Response.Model.Fields
Assembly: Sitecore.LayoutService.Client.Abstractions.dll
Syntax
public class ItemLinkField<TTargetModel> : ItemLinkField, IFieldsReader, IField, IFieldReader where TTargetModel : classType Parameters
| Name | Description |
|---|---|
| TTargetModel |
Target model type. |
Constructors
ItemLinkField()
Declaration
public ItemLinkField()Properties
Fields
Gets or sets the strongly typed target.
Declaration
public TTargetModel Fields { get; set; }Property Value
| Type | Description |
|---|---|
| TTargetModel |
Target
Gets or sets the strongly types target if the item link.
Declaration
public TTargetModel Target { get; protected set; }Property Value
| Type | Description |
|---|---|
| TTargetModel |
Methods
HandleRead(Type)
Returns an instance of the Field data as a specified type.
Declaration
protected override object HandleRead(Type type)Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type |
The type to read the field as. |
Returns
| Type | Description |
|---|---|
| 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
public override object Read(Type type)Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type |
The type of field to be read. |
Returns
| Type | Description |
|---|---|
| System.Object |
A new instance if successful. |
Overrides
Read<TField>()
Reads the current Field as the specified type.
Declaration
public override TField Read<TField>()
where TField : IFieldReturns
| Type | Description |
|---|---|
| TField |
A new instance of |
Type Parameters
| Name | Description |
|---|---|
| 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
public override bool TryRead(Type type, out IField field)Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type |
The type of field to be read. |
| IField | field |
The resulting field. |
Returns
| Type | Description |
|---|---|
| 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
public override bool TryRead<TField>(out TField field)
where TField : IFieldParameters
| Type | Name | Description |
|---|---|---|
| TField | field |
The resulting instance if successful. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
True if the field could be read as the specified type, otherwise false. |
Type Parameters
| Name | Description |
|---|---|
| TField |
The type of Field to be read. |