Table of Contents

Class DataSetEntity

Namespace
BpNexT.NET.Models
Assembly
BpNexT.NET.Contracts.dll

COM-free base class for dataset entities. Provides change tracking, disposal, and property copy/fill operations. GraphQL models inherit this directly; COM models inherit HasAutoDataSet which extends this.

public class DataSetEntity : IDataSetEntity, IDisposable
Inheritance
object
DataSetEntity
Implements

Properties

ChangedProperties

Gets the dictionary of changed properties (JSON name -> value).

[JsonIgnore]
[JsonIgnore]
[ValidateNever]
protected Dictionary<string, object?> ChangedProperties { get; }

Property Value

Dictionary<string, object>

HasChanges

Indicates whether the object has changes.

[JsonIgnore]
[JsonIgnore]
[ValidateNever]
public bool HasChanges { get; }

Property Value

bool

Identifier

Unique identifier for the object.

[JsonIgnore]
[JsonIgnore]
[ValidateNever]
public string Identifier { get; set; }

Property Value

string

SelektionsFelder

SelektionsFelder of the DataSet.

[JsonIgnore]
[JsonIgnore]
[ValidateNever]
public List<SelektionsFeld> SelektionsFelder { get; init; }

Property Value

List<SelektionsFeld>

Methods

BeginLoad()

Suspends change tracking while a reader fills the entity with values from the backend. Loaded values are current state, not changes; recording them only to clear the dictionary afterwards wastes allocations on every materialized row.

protected void BeginLoad()

CopyFrom<T>(T)

Copies properties from another instance.

public void CopyFrom<T>(T other) where T : IDataSetEntity

Parameters

other T

The other instance to copy from.

Type Parameters

T

The type of the other instance.

Exceptions

ArgumentException

Thrown when the type of the other instance does not match the current type.

Dispose()

Releases managed resources held by this entity.

public void Dispose()

Dispose(bool)

Releases the resources held by this entity.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true when called from Dispose().

EndLoad()

Resumes change tracking after materialization; every setter call from here on is a genuine change again.

protected void EndLoad()

FillFrom<T>(T)

Fills empty properties from another instance. null values in the other instance are ignored. Empty strings and DateTime.MinValue are also treated as empty.

public void FillFrom<T>(T other) where T : IDataSetEntity

Parameters

other T

The other instance to copy from.

Type Parameters

T

The type of the other instance.

Exceptions

ArgumentException

Thrown when the type of the other instance does not match the current type.

GetOrLoadNavigationRows<TChild>(string, Func<List<TChild>>)

Returns a cached child navigation list, loading and caching it when absent.

protected List<TChild> GetOrLoadNavigationRows<TChild>(string key, Func<List<TChild>> loader)

Parameters

key string
loader Func<List<TChild>>

Returns

List<TChild>

Type Parameters

TChild

HasNavigationRows(string)

Returns whether a child navigation has already been loaded.

protected bool HasNavigationRows(string key)

Parameters

key string

Returns

bool

Linked<TChild>(LinkHandle<TChild>)

Returns the rows loaded for one included link variant, or null when that variant was not included in the query that materialized this entity. The handle comes from the Include/ThenInclude overloads with an out handle parameter.

public List<TChild>? Linked<TChild>(LinkHandle<TChild> handle)

Parameters

handle LinkHandle<TChild>

Handle of the included link variant.

Returns

List<TChild>

Type Parameters

TChild

Entity type of the linked table.

ResetChanges()

Resets the change tracking. Does NOT reset the Object.

public void ResetChanges()

SetNavigationRows(string, object?)

Stores rows for a child navigation. Passing null clears the cached navigation.

protected void SetNavigationRows(string key, object? rows)

Parameters

key string
rows object

SetNavigationRows<TChild>(string, IEnumerable<TChild>?)

Stores rows for a typed child navigation. Passing null clears the cached navigation.

protected void SetNavigationRows<TChild>(string key, IEnumerable<TChild>? rows)

Parameters

key string
rows IEnumerable<TChild>

Type Parameters

TChild

ThrowIfDisposed()

Throws an System.ObjectDisposedException if the instance has been disposed. Internal so implementation-side extension methods can guard entity state too.

protected void ThrowIfDisposed()

TryGetNavigationRows<TChild>(string, out List<TChild>)

Attempts to read a cached child navigation list.

protected bool TryGetNavigationRows<TChild>(string key, out List<TChild> rows)

Parameters

key string
rows List<TChild>

Returns

bool

Type Parameters

TChild