Table of Contents

Class EntityContext

Namespace
The.Entities
Assembly
Instagile.dll

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

services IServices
principal IPrincipal

Properties

Licence

public virtual IToken? Licence { get; }

Property Value

IToken

Principal

public IPrincipal Principal { get; }

Property Value

IPrincipal

Services

public IServices Services { get; }

Property Value

IServices

Size

public int Size { get; }

Property Value

int

Methods

Add(EntityKernel)

public IEnumerable<EntityReferenceProperty> Add(EntityKernel entity)

Parameters

entity EntityKernel

Returns

IEnumerable<EntityReferenceProperty>

AddAll<T>(IEntityInfo, IFrozenQuery<T>)

public void AddAll<T>(IEntityInfo type, IFrozenQuery<T> query) where T : IEntity

Parameters

type IEntityInfo
query IFrozenQuery<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

other IEntityContext

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Get(Guid)

returns null if the entity is not found

public EntityKernel? Get(Guid id)

Parameters

id Guid

Returns

EntityKernel

GetAll<T>(IEntityInfo)

returns null if no set is cached

public IFrozenQuery<T>? GetAll<T>(IEntityInfo type) where T : IEntity

Parameters

type IEntityInfo

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

id Guid
getE Func<Mutation, EntityKernel>

Returns

EntityKernel

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

id Guid

Returns

T

Type Parameters

T

HasChanges()

public bool HasChanges()

Returns

bool

OnSavedTypesAsync(IEnumerable<IEntityInfo>)

public Task OnSavedTypesAsync(IEnumerable<IEntityInfo> types)

Parameters

types IEnumerable<IEntityInfo>

Returns

Task

SaveAsync(CancellationToken?)

public Task<SaveResult> SaveAsync(CancellationToken? cancellationToken = null)

Parameters

cancellationToken CancellationToken?

Returns

Task<SaveResult>

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

Event Type

ContextSavedHandler