Class RedbObject<TProps>

Assembly: redb.Core.dll

Generic wrapper for JSON from get_object_json with typed interface.
Field names match JSON/DB (snake_case) to work without attributes and settings.
Inherits from base RedbObject for API unification.
Implements typed interface IRedbObject<TProps> for type safety.
Object saving uses ChangeTracking strategy by default -
compares with DB and updates only changed properties.

public class RedbObject<TProps> : RedbObject, IRedbObject<TProps>, IRedbObject where TProps : class, new()

Inheritance

ObjectRedbObjectRedbObject<TProps>

Implements

Inherited Members

Properties

Props

Object properties with lazy loading support.

[JsonPropertyName("properties")]
public TProps Props { get; set; }

Methods

CloneWithProperties(TProps)

Create object copy with same metadata but new properties.

public IRedbObject<TProps> CloneWithProperties(TProps newProperties)

ComputeHash()

Get MD5 hash from Props values without changing hash field.

public override Guid ComputeHash()

ComputeHashForType()

Get new hash based on current properties without changing object.

public Guid ComputeHashForType()

GetPropsDirectly()

Get Props without triggering lazy loading (for internal use in cache).

public TProps? GetPropsDirectly()

GetSchemeForTypeAsync()

Get scheme for type TProps (using cache and provider).

public Task<IRedbScheme> GetSchemeForTypeAsync()

GetStructureByNameAsync(string)

Get structure by field name for type TProps.

public Task<IRedbStructure?> GetStructureByNameAsync(string fieldName)

GetStructuresForTypeAsync()

Get scheme structures for type TProps.

public Task<IReadOnlyCollection<IRedbStructure>> GetStructuresForTypeAsync()

InvalidateCacheForType()

Clear metadata cache for type TProps.

public void InvalidateCacheForType()

IsHashValidForType()

Check if current hash matches TProps properties.

public bool IsHashValidForType()

LoadPropsAsync()

Explicit async Props preloading (for eager loading scenarios).

public Task LoadPropsAsync()

RecomputeHash()

Recompute MD5 hash from Props values and write to hash field.

public override void RecomputeHash()

RecomputeHashForType()

Recompute hash based on current TProps properties.

public void RecomputeHashForType()

ResetIds(bool)

Override with recursive Props processing.

public override void ResetIds(bool recursive = false)

WarmupCacheForTypeAsync()

Preload metadata cache for type TProps.

public Task WarmupCacheForTypeAsync()

Constructors

RedbObject()

Default constructor for deserialization.

RedbObject(TProps)

Constructor with properties.