Table of Contents

Class Identifiable<TId>

Namespace
JsonApiDotNetCore.Resources
Assembly
JsonApiDotNetCore.Annotations.dll

A convenient basic implementation of IIdentifiable<TId> that provides conversion between typed Id and StringId.

public abstract class Identifiable<TId> : IIdentifiable<TId>, IIdentifiable

Type Parameters

TId

The resource identifier type.

Inheritance
Identifiable<TId>
Implements
Inherited Members

Properties

Id

The typed identifier as used by the underlying data store (usually numeric or Guid).

public virtual TId Id { get; set; }

Property Value

TId

LocalId

The value for element 'lid' in a JSON:API request.

[NotMapped]
public string? LocalId { get; set; }

Property Value

string

StringId

The value for element 'id' in a JSON:API request or response.

[NotMapped]
public string? StringId { get; set; }

Property Value

string

Methods

GetStringId(TId)

Converts an outgoing typed resource identifier to string format for use in a JSON:API response.

protected virtual string? GetStringId(TId value)

Parameters

value TId

Returns

string

GetTypedId(string?)

Converts an incoming 'id' element from a JSON:API request to the typed resource identifier.

protected virtual TId GetTypedId(string? value)

Parameters

value string

Returns

TId