Class EntityCollectionProperty<T>
- Namespace
- The.Relationships
- Assembly
- Instagile.dll
A one-to-many-T foreign key
public sealed class EntityCollectionProperty<T> : EntityCollectionProperty, IEntitySet<T>, IFrozenQuery<T>, IEntityQuery<T>, IEntityQuery, IDisposable, ILazy<ILoadedSet<T>>, ILazy, ILoadedSet<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, INotifyCollectionChanged, IProperty, IOwned, IHasChanges, IVisitor<IEntityQuery<T>> where T : IEntity<T>
Type Parameters
T
- Inheritance
-
EntityCollectionProperty<T>
- Implements
-
IEntitySet<T>IFrozenQuery<T>IEntityQuery<T>ILazy<ILoadedSet<T>>ILoadedSet<T>IEnumerable<T>IVisitor<IEntityQuery<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?)
Constructors
EntityCollectionProperty(RelationshipInfo, EntityKernel)
public EntityCollectionProperty(RelationshipInfo metadata, EntityKernel parent)
Parameters
metadataRelationshipInfoparentEntityKernel
Properties
CacheState
Whether data was loaded from the entity cache and, if so, whether it's up to date.
public ResultState CacheState { get; }
Property Value
ElementType
Gets the type of the element(s) that are returned when the expression tree associated with this instance of IEntityQuery is executed.
public Type ElementType { get; }
Property Value
Expression
Gets the expression tree that is associated with the instance of IEntityQuery.
public Expression Expression { get; }
Property Value
OriginalValue
public IEntityQuery<T> OriginalValue { get; }
Property Value
- IEntityQuery<T>
Provider
Gets the query provider that is associated with this data source.
public IEntityQueryProvider Provider { get; }
Property Value
Methods
Add(IEntity)
public override void Add(IEntity item)
Parameters
itemIEntity
Add(T)
public void Add(T item)
Parameters
itemT
AddAsync(IEntity, CancellationToken?)
public Task AddAsync(IEntity item, CancellationToken? cancellationToken = null)
Parameters
itemIEntitycancellationTokenCancellationToken?
Returns
AddAsync(T, CancellationToken?)
public Task AddAsync(T item, CancellationToken? cancellationToken = null)
Parameters
itemTcancellationTokenCancellationToken?
Returns
AddRange(IEnumerable<IEntity>)
public override void AddRange(IEnumerable<IEntity> items)
Parameters
itemsIEnumerable<IEntity>
AddRange(IEnumerable<T>)
public void AddRange(IEnumerable<T> items)
Parameters
itemsIEnumerable<T>
AddRangeAsync(IEnumerable<T>, CancellationToken?)
public Task AddRangeAsync(IEnumerable<T> items, CancellationToken? cancellationToken = null)
Parameters
itemsIEnumerable<T>cancellationTokenCancellationToken?
Returns
AsLoaded()
Asserts that the property object is loaded and returns it; never performs I/O.
public ILoadedSet<T> AsLoaded()
Returns
- ILoadedSet<T>
Exceptions
- InvalidOperationException
Thrown if the property or any reference along the path to it is unloaded.
AsUnloaded()
Assert that the set is unloaded and treat it as a datastore query.
public 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()
public override void Clear()
ClearAsync(CancellationToken?)
public override Task ClearAsync(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?
Returns
Clone(IEntityContext?)
public EntityCollectionProperty<T> Clone(IEntityContext? context = null)
Parameters
contextIEntityContext
Returns
Contains(IEntity?)
protected override bool Contains(IEntity? item)
Parameters
itemIEntity
Returns
Contains(T?)
public bool Contains(T? item)
Parameters
itemT
Returns
ContainsAsync(T?, CancellationToken?)
public Task<bool> ContainsAsync(T? item, CancellationToken? cancellationToken = null)
Parameters
itemTcancellationTokenCancellationToken?
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
EagerLoad(IEnumerable<T>)
public void EagerLoad(IEnumerable<T> entities)
Parameters
entitiesIEnumerable<T>
EagerLoad(params T[])
public void EagerLoad(params T[] entities)
Parameters
entitiesT[]
GetEnumerator()
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
GetRelatedEntities()
protected override IEnumerable<IEntity> GetRelatedEntities()
Returns
GetRelatedEntitiesAsync(RelationshipPath[], CancellationToken?)
protected override Task<IEnumerable<IEntity>> GetRelatedEntitiesAsync(RelationshipPath[] includeRelationships, CancellationToken? cancellationToken)
Parameters
includeRelationshipsRelationshipPath[]cancellationTokenCancellationToken?
Returns
GetRelatedEntitiesCachedAsync(RelationshipPath[], RequestOptions, CancellationToken?)
protected override Task<IEnumerable<IEntity>> GetRelatedEntitiesCachedAsync(RelationshipPath[] includeRelationships, RequestOptions options, CancellationToken? cancellationToken)
Parameters
includeRelationshipsRelationshipPath[]optionsRequestOptionscancellationTokenCancellationToken?
Returns
IsInMemory()
Returns true if the frozen query is at least partially-loaded. In-memory queries should not be transformed into ReadOperations for batching.
public bool IsInMemory()
Returns
LoadAsync(CancellationToken?)
Loads the property object in at most one read batch.
public Task<ILoadedSet<T>> LoadAsync(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?
Returns
- Task<ILoadedSet<T>>
LoadAsync(RelationshipPath[], CancellationToken?)
Loads the property object and related data in at most one read batch.
public Task<ILoadedSet<T>> LoadAsync(RelationshipPath[] includeRelationships, CancellationToken? cancellationToken = null)
Parameters
includeRelationshipsRelationshipPath[]cancellationTokenCancellationToken?
Returns
- Task<ILoadedSet<T>>
LoadCachedAsync(RequestOptions?, CancellationToken?)
Loads the property object and related data in at most one read batch. Uses the entity cache if possible. If the result was stale, ValueChanged will be raised after validation.
public Task<ILoadedSet<T>> LoadCachedAsync(RequestOptions? options = null, CancellationToken? cancellationToken = null)
Parameters
optionsRequestOptionscancellationTokenCancellationToken?
Returns
- Task<ILoadedSet<T>>
LoadCachedAsync(RequestOptions?, RelationshipPath[], CancellationToken?)
Loads the property object and related data in at most one read batch. Uses the entity cache if possible. If the result was stale, ValueChanged will be raised after validation.
public Task<ILoadedSet<T>> LoadCachedAsync(RequestOptions? options, RelationshipPath[] includes, CancellationToken? cancellationToken = null)
Parameters
optionsRequestOptionsincludesRelationshipPath[]cancellationTokenCancellationToken?
Returns
- Task<ILoadedSet<T>>
Remove(IEntity)
public override void Remove(IEntity item)
Parameters
itemIEntity
Remove(T)
public void Remove(T item)
Parameters
itemT
RemoveAsync(IEntity, CancellationToken?)
public Task RemoveAsync(IEntity item, CancellationToken? cancellationToken = null)
Parameters
itemIEntitycancellationTokenCancellationToken?
Returns
RemoveAsync(T, CancellationToken?)
public Task RemoveAsync(T item, CancellationToken? cancellationToken = null)
Parameters
itemTcancellationTokenCancellationToken?
Returns
RemoveRange(IEnumerable<IEntity>)
public override void RemoveRange(IEnumerable<IEntity> items)
Parameters
itemsIEnumerable<IEntity>
RemoveRange(IEnumerable<T>)
public void RemoveRange(IEnumerable<T> items)
Parameters
itemsIEnumerable<T>
RemoveRangeAsync(IEnumerable<T>, CancellationToken?)
public Task RemoveRangeAsync(IEnumerable<T> items, CancellationToken? cancellationToken = null)
Parameters
itemsIEnumerable<T>cancellationTokenCancellationToken?
Returns
ReplaceAll(IEnumerable<T>)
public void ReplaceAll(IEnumerable<T> entities)
Parameters
entitiesIEnumerable<T>
ReplaceAll(IEntitySet<T>)
public void ReplaceAll(IEntitySet<T> entities)
Parameters
entitiesIEntitySet<T>
ReplaceAllAsync(IEnumerable<T>, CancellationToken?)
public Task ReplaceAllAsync(IEnumerable<T> entities, CancellationToken? cancellationToken = null)
Parameters
entitiesIEnumerable<T>cancellationTokenCancellationToken?