Table of Contents

Class EntityCollectionProperty

Namespace
The.Relationships
Assembly
Instagile.dll

A one-to-many foreign key

public abstract class EntityCollectionProperty : RelationshipProperty, IProperty, IOwned, IHasChanges, ILazy, INotifyCollectionChanged
Inheritance
EntityCollectionProperty
Implements
Derived
Inherited Members

Remarks

The base EntityCollection is always a collection of IEntity, but it is non-generic because it is mutable. Covariance would not be safe. Instead, there's a generic subclass EntityCollection<T>, created by factories.

Constructors

EntityCollectionProperty(RelationshipInfo, EntityKernel)

public EntityCollectionProperty(RelationshipInfo metadata, EntityKernel parent)

Parameters

metadata RelationshipInfo
parent EntityKernel

Fields

CurrentValues

protected ConcurrentSet<RelationshipKernel> CurrentValues

Field Value

ConcurrentSet<RelationshipKernel>

OriginalValues

protected ConcurrentSet<RelationshipKernel> OriginalValues

Field Value

ConcurrentSet<RelationshipKernel>

Properties

Count

Gets the number of entities in the collection. Does not require or force the property to be present.

public int Count { get; }

Property Value

int

IsInitialised

public override sealed bool IsInitialised { get; }

Property Value

bool

IsPresent

True if fully loaded, false if partially or fully unloaded.

public override sealed bool IsPresent { get; }

Property Value

bool

WasModifiedWhileUnloaded

public bool WasModifiedWhileUnloaded { get; }

Property Value

bool

Methods

Add(IEntity)

public abstract void Add(IEntity item)

Parameters

item IEntity

AddImpl(Mutation, EntityKernel, RowState)

protected void AddImpl(Mutation m, EntityKernel entity, RowState initialState)

Parameters

m Mutation
entity EntityKernel
initialState RowState

AddRange(IEnumerable<IEntity>)

public abstract void AddRange(IEnumerable<IEntity> items)

Parameters

items IEnumerable<IEntity>

Clear()

public abstract void Clear()

ClearAsync(CancellationToken?)

public abstract Task ClearAsync(CancellationToken? cancellationToken = null)

Parameters

cancellationToken CancellationToken?

Returns

Task

ClearImpl(Mutation)

protected void ClearImpl(Mutation m)

Parameters

m Mutation

Contains(IEntity?)

protected abstract bool Contains(IEntity? item)

Parameters

item IEntity

Returns

bool

EagerLoad(Mutation, IEnumerable<IEntity>)

public void EagerLoad(Mutation m, IEnumerable<IEntity> relatedEntities)

Parameters

m Mutation
relatedEntities IEnumerable<IEntity>

FindKernel(EntityKernel)

protected RelationshipKernel? FindKernel(EntityKernel entity)

Parameters

entity EntityKernel

Returns

RelationshipKernel

GetCurrentKernels()

protected override IEnumerable<RelationshipKernel> GetCurrentKernels()

Returns

IEnumerable<RelationshipKernel>

GetOriginalKernels()

protected override IEnumerable<RelationshipKernel> GetOriginalKernels()

Returns

IEnumerable<RelationshipKernel>

GetRelatedEntities()

protected abstract IEnumerable<IEntity> GetRelatedEntities()

Returns

IEnumerable<IEntity>

GetRelatedEntitiesAsync(RelationshipPath[], CancellationToken?)

protected abstract Task<IEnumerable<IEntity>> GetRelatedEntitiesAsync(RelationshipPath[] includeRelationships, CancellationToken? cancellationToken)

Parameters

includeRelationships RelationshipPath[]
cancellationToken CancellationToken?

Returns

Task<IEnumerable<IEntity>>

GetRelatedEntitiesCachedAsync(RelationshipPath[], RequestOptions, CancellationToken?)

protected abstract Task<IEnumerable<IEntity>> GetRelatedEntitiesCachedAsync(RelationshipPath[] includeRelationships, RequestOptions options, CancellationToken? cancellationToken)

Parameters

includeRelationships RelationshipPath[]
options RequestOptions
cancellationToken CancellationToken?

Returns

Task<IEnumerable<IEntity>>

InternalAddCurrent(Mutation, RelationshipKernel)

protected override bool InternalAddCurrent(Mutation m, RelationshipKernel kernel)

Parameters

m Mutation
kernel RelationshipKernel

Returns

bool

InternalAddOriginal(RelationshipKernel)

protected override void InternalAddOriginal(RelationshipKernel kernel)

Parameters

kernel RelationshipKernel

InternalCopy(Mutation, RelationshipProperty, RelationshipProperty, bool, CloneState)

protected override void InternalCopy(Mutation m, RelationshipProperty from, RelationshipProperty to, bool cloneEntities, CloneState state)

Parameters

m Mutation
from RelationshipProperty
to RelationshipProperty
cloneEntities bool
state CloneState

InternalHasChanges(bool)

protected override bool InternalHasChanges(bool ignoreDerived)

Parameters

ignoreDerived bool

Returns

bool

InternalRemoveCurrent(Mutation, RelationshipKernel)

protected override bool InternalRemoveCurrent(Mutation m, RelationshipKernel kernel)

Parameters

m Mutation
kernel RelationshipKernel

Returns

bool

InternalRemoveOriginal(Mutation, RelationshipKernel)

protected override bool InternalRemoveOriginal(Mutation m, RelationshipKernel kernel)

Parameters

m Mutation
kernel RelationshipKernel

Returns

bool

LazyLoad(Mutation)

protected override void LazyLoad(Mutation m)

Parameters

m Mutation

LazyLoadAsync(Mutation, CancellationToken?)

protected override Task LazyLoadAsync(Mutation m, CancellationToken? cancellationToken)

Parameters

m Mutation
cancellationToken CancellationToken?

Returns

Task

LazyLoadAsync(Mutation, RelationshipPath[], CancellationToken?)

protected Task LazyLoadAsync(Mutation m, RelationshipPath[] includeRelationships, CancellationToken? cancellationToken)

Parameters

m Mutation
includeRelationships RelationshipPath[]
cancellationToken CancellationToken?

Returns

Task

LazyLoadCachedAsync(Mutation, RelationshipPath[], RequestOptions, CancellationToken?)

protected Task LazyLoadCachedAsync(Mutation m, RelationshipPath[] includeRelationships, RequestOptions options, CancellationToken? cancellationToken)

Parameters

m Mutation
includeRelationships RelationshipPath[]
options RequestOptions
cancellationToken CancellationToken?

Returns

Task

MarkUnchanged()

update original data so that it's no longer considered changed

public override void MarkUnchanged()

Remove(IEntity)

public abstract void Remove(IEntity item)

Parameters

item IEntity

RemoveImpl(Mutation, EntityKernel)

protected void RemoveImpl(Mutation m, EntityKernel entity)

Parameters

m Mutation
entity EntityKernel

RemoveRange(IEnumerable<IEntity>)

public abstract void RemoveRange(IEnumerable<IEntity> items)

Parameters

items IEnumerable<IEntity>

SetRelatedEntities(Mutation, IEnumerable<EntityKernel>)

protected void SetRelatedEntities(Mutation m, IEnumerable<EntityKernel> entityKernels)

Parameters

m Mutation
entityKernels IEnumerable<EntityKernel>

Unload(RelationshipKernel)

protected override void Unload(RelationshipKernel forgottenKernel)

Parameters

forgottenKernel RelationshipKernel

Events

CollectionChanged

Occurs when the collection changes.

public event NotifyCollectionChangedEventHandler? CollectionChanged

Event Type

NotifyCollectionChangedEventHandler