Class EntityContext
Tracks a set of entities with consistent changes within a unit of work.
public class EntityContext : IEntityContext, IEquatable<IEntityContext>, IEntityContextAccessor
- Inheritance
-
EntityContext
- Implements
- Inherited Members
Constructors
EntityContext(IServices, IPrincipal)
public EntityContext(IServices services, IPrincipal principal)
Parameters
servicesIServicesprincipalIPrincipal
Properties
Licence
public virtual IToken? Licence { get; }
Property Value
Principal
public IPrincipal Principal { get; }
Property Value
Services
public IServices Services { get; }
Property Value
Size
public int Size { get; }
Property Value
Methods
Add(EntityKernel)
public IEnumerable<EntityReferenceProperty> Add(EntityKernel entity)
Parameters
entityEntityKernel
Returns
AddAll<T>(IEntityInfo, IFrozenQuery<T>)
public void AddAll<T>(IEntityInfo type, IFrozenQuery<T> query) where T : IEntity
Parameters
typeIEntityInfoqueryIFrozenQuery<T>
Type Parameters
T
Equals(IEntityContext?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(IEntityContext? other)
Parameters
otherIEntityContextAn object to compare with this object.
Returns
Get(Guid)
returns null if the entity is not found
public EntityKernel? Get(Guid id)
Parameters
idGuid
Returns
GetAll<T>(IEntityInfo)
returns null if no set is cached
public IFrozenQuery<T>? GetAll<T>(IEntityInfo type) where T : IEntity
Parameters
typeIEntityInfo
Returns
- IFrozenQuery<T>
Type Parameters
T
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetOrAdd(Guid, Func<Mutation, EntityKernel>)
public EntityKernel GetOrAdd(Guid id, Func<Mutation, EntityKernel> getE)
Parameters
idGuidgetEFunc<Mutation, EntityKernel>
Returns
Get<T>(Guid)
returns null if the entity is not found or has the wrong type
public T? Get<T>(Guid id) where T : IEntity
Parameters
idGuid
Returns
- T
Type Parameters
T
HasChanges()
public bool HasChanges()
Returns
OnSavedTypesAsync(IEnumerable<IEntityInfo>)
public Task OnSavedTypesAsync(IEnumerable<IEntityInfo> types)
Parameters
typesIEnumerable<IEntityInfo>
Returns
SaveAsync(CancellationToken?)
public Task<SaveResult> SaveAsync(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Events
Saved
public event ContextSavedHandler? Saved