Class RedbListItem

Assembly: redb.Core.dll

REDB list item entity with direct data storage.
Maps to _list_items table in PostgreSQL.

public class RedbListItem : IRedbListItem

Inheritance

Object→RedbListItem

Implements

Properties

Alias

Item alias (display name).

[JsonPropertyName("alias")]
public string? Alias { get; set; }

Id

Unique item identifier.

[JsonPropertyName("id")]
public long Id { get; set; }

IdList

List identifier this item belongs to.

[JsonPropertyName("id_list")]
public long IdList { get; set; }

IdObject

Linked object identifier (optional).

[JsonPropertyName("id_object")]
public long? IdObject { get; set; }

IsObjectLoaded

Whether the linked object has been resolved (set, preloaded or lazily loaded).

[JsonIgnore]
public bool IsObjectLoaded { get; }

IsObjectLoaderAvailable

Check if global loader is available.

public static bool IsObjectLoaderAvailable { get; }

IsObjectReference

Check if item is object reference.

[JsonIgnore]
public bool IsObjectReference { get; }

Object

Linked object, loaded lazily on the live redb scope of whoever reads it. Reading it may hit the database; it is

[JsonIgnore]
public IRedbObject? Object { get; set; }

Value

Item value.

[JsonPropertyName("value")]
public string Value { get; set; }

Methods

ForList(IRedbList, string?, string?, IRedbObject)

Create ListItem with linked object.

public static RedbListItem ForList(IRedbList list, string? value, string? alias, IRedbObject linkedObject)

ForList(IRedbList, string?, string?, long?)

Create ListItem for specific list.

public static RedbListItem ForList(IRedbList list, string? value, string? alias = null, long? idObject = null)

GetDisplayValue()

Get display value.

public string GetDisplayValue()

GetObjectAsync(CancellationToken)

Asynchronous form of : resolves the linked object on the reader's scope without blocking a

public Task<IRedbObject?> GetObjectAsync(CancellationToken cancellationToken = default)

SetGlobalObjectLoader(Func<long, Task<IRedbObject?>>)

Set global object loader for all ListItems.

public static void SetGlobalObjectLoader(Func<long, Task<IRedbObject?>> loader)

ToString()

Returns a string that represents the current object.

public override string ToString()

Constructors

RedbListItem()

Default constructor for deserialization and mapping.

RedbListItem(IRedbList, string?, string?, IRedbObject)

Constructor for creating item with linked object.

RedbListItem(IRedbList, string?, string?, long?)

Constructor for creating item linked to list.