Class DataSetEntity
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
-
objectDataSetEntity
- 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
Identifier
Unique identifier for the object.
[JsonIgnore]
[JsonIgnore]
[ValidateNever]
public string Identifier { get; set; }
Property Value
SelektionsFelder
SelektionsFelder of the DataSet.
[JsonIgnore]
[JsonIgnore]
[ValidateNever]
public List<SelektionsFeld> SelektionsFelder { get; init; }
Property Value
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
otherTThe other instance to copy from.
Type Parameters
TThe 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
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
otherTThe other instance to copy from.
Type Parameters
TThe 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
Returns
- List<TChild>
Type Parameters
TChild
HasNavigationRows(string)
Returns whether a child navigation has already been loaded.
protected bool HasNavigationRows(string key)
Parameters
keystring
Returns
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
handleLinkHandle<TChild>Handle of the included link variant.
Returns
- List<TChild>
Type Parameters
TChildEntity 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
keystringrowsobject
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
keystringrowsIEnumerable<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
Returns
Type Parameters
TChild