Interface IEntitySet<T>
A set of entities which can be queried and modified; may be owned by a parent entity.
public interface IEntitySet<T> : IFrozenQuery<T>, IEntityQuery<T>, IEntityQuery, IDisposable, IEnumerable, INotifyCollectionChanged, IProperty, IOwned, IHasChanges, ILazy where T : IEntity
Type Parameters
T
- Inherited Members
- Extension Methods
-
EntityQueryExtensions.OrderBy<TSource, TKey>(IEntityQuery<TSource>, Expression<Func<TSource, TKey>>)EntityQueryExtensions.SingleAsync<T>(IEntityQuery<T>, Expression<Func<T, bool>>, CancellationToken?)EntityQueryExtensions.SumAsync<T>(IEntityQuery<T>, Expression<Func<T, decimal>>, CancellationToken?)
Properties
CacheState
Whether data was loaded from the entity cache and, if so, whether it's up to date.
ResultState CacheState { get; }
Property Value
Methods
Add(T)
void Add(T item)
Parameters
itemT
AddAsync(T, CancellationToken?)
Task AddAsync(T item, CancellationToken? cancellationToken = null)
Parameters
itemTcancellationTokenCancellationToken?
Returns
AddRange(IEnumerable<T>)
void AddRange(IEnumerable<T> items)
Parameters
itemsIEnumerable<T>
AddRangeAsync(IEnumerable<T>, CancellationToken?)
Task AddRangeAsync(IEnumerable<T> items, CancellationToken? cancellationToken = null)
Parameters
itemsIEnumerable<T>cancellationTokenCancellationToken?
Returns
AsLoaded()
Assert that the set is loaded and treat it as iterable.
ILoadedSet<T> AsLoaded()
Returns
- ILoadedSet<T>
Exceptions
- InvalidOperationException
Thrown if the set is partially or entirely unloaded.
AsUnloaded()
Assert that the set is unloaded and treat it as a datastore query.
IEntityQuery<T> AsUnloaded()
Returns
- IEntityQuery<T>
Remarks
An empty set is always considered loaded. Calling this method on an empty set will cause an exception to be thrown.
Exceptions
- InvalidOperationException
Thrown if the set is partially or entirely loaded.
Clear()
void Clear()
ClearAsync(CancellationToken?)
Task ClearAsync(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?
Returns
Contains(T)
bool Contains(T item)
Parameters
itemT
Returns
ContainsAsync(T, CancellationToken?)
Task<bool> ContainsAsync(T item, CancellationToken? cancellationToken = null)
Parameters
itemTcancellationTokenCancellationToken?
Returns
GetEnumerator()
IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
LoadAsync(CancellationToken?)
Load the whole set into memory for iteration or modification, including related entities.
Task<ILoadedSet<T>> LoadAsync(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?Cancellation token.
Returns
- Task<ILoadedSet<T>>
The loaded set.
LoadAsync(RelationshipPath[], CancellationToken?)
Load the whole set into memory for iteration or modification.
Task<ILoadedSet<T>> LoadAsync(RelationshipPath[] includeRelationships, CancellationToken? cancellationToken = null)
Parameters
includeRelationshipsRelationshipPath[]Relationship paths to load along with the set. If the set is already loaded, just the paths will be loaded.
cancellationTokenCancellationToken?Cancellation token.
Returns
- Task<ILoadedSet<T>>
The loaded set.
LoadCachedAsync(RequestOptions?, CancellationToken?)
Load the whole set into memory for iteration or modification, including related entities. Uses the entity cache if possible. If the result was stale, CollectionChanged will be raised after validation.
Task<ILoadedSet<T>> LoadCachedAsync(RequestOptions? options = null, CancellationToken? cancellationToken = null)
Parameters
optionsRequestOptionsRequest options (priority, freshness requirements).
cancellationTokenCancellationToken?Cancellation token.
Returns
- Task<ILoadedSet<T>>
The loaded set.
Remarks
Check CacheState after calling to determine if a background refresh is in progress:
- Fresh - Data is current, no refresh pending
- Stale - Showing cached data, refresh in progress
- Uncached - Data not from cache (for example, if already loaded)
If the collection is modified locally before the background refresh completes, the refresh will be silently skipped to preserve local changes.
Cache updates are marshalled to the calling thread's SynchronizationContext if available (e.g., WPF UI thread, Blazor component context).
LoadCachedAsync(RelationshipPath[], RequestOptions?, CancellationToken?)
Load the whole set into memory for iteration or modification. Uses the entity cache if possible. If the result was stale, CollectionChanged will be raised after validation.
Task<ILoadedSet<T>> LoadCachedAsync(RelationshipPath[] includes, RequestOptions? options = null, CancellationToken? cancellationToken = null)
Parameters
includesRelationshipPath[]Relationship paths to load along with the set. If the set is already loaded, uses GraphNavigation.LoadGraphAsync to load the paths.
optionsRequestOptionsRequest options (priority, freshness requirements).
cancellationTokenCancellationToken?Cancellation token.
Returns
- Task<ILoadedSet<T>>
The loaded set.
Remarks
Check CacheState after calling to determine if a background refresh is in progress:
- Fresh - Data is current, no refresh pending
- Stale - Showing cached data, refresh in progress
- Uncached - Data not from cache (for example, if already loaded)
If the collection is modified locally before the background refresh completes, the refresh will be silently skipped to preserve local changes.
Cache updates are marshalled to the calling thread's SynchronizationContext if available (e.g., WPF UI thread, Blazor component context).
Remove(T)
void Remove(T item)
Parameters
itemT
RemoveAsync(T, CancellationToken?)
Task RemoveAsync(T item, CancellationToken? cancellationToken = null)
Parameters
itemTcancellationTokenCancellationToken?
Returns
RemoveRange(IEnumerable<T>)
void RemoveRange(IEnumerable<T> items)
Parameters
itemsIEnumerable<T>
RemoveRangeAsync(IEnumerable<T>, CancellationToken?)
Task RemoveRangeAsync(IEnumerable<T> items, CancellationToken? cancellationToken = null)
Parameters
itemsIEnumerable<T>cancellationTokenCancellationToken?
Returns
ReplaceAll(IEnumerable<T>)
void ReplaceAll(IEnumerable<T> items)
Parameters
itemsIEnumerable<T>
ReplaceAllAsync(IEnumerable<T>, CancellationToken?)
Task ReplaceAllAsync(IEnumerable<T> items, CancellationToken? cancellationToken = null)
Parameters
itemsIEnumerable<T>cancellationTokenCancellationToken?