Show / Hide Table of Contents

Class EntityList<T>

Represents a strongly typed list of entities.

Inheritance
Object
System.Collections.ObjectModel.Collection<T>
EntityList<T>
Inherited Members
System.Collections.ObjectModel.Collection<T>.Add(T)
System.Collections.ObjectModel.Collection<T>.Clear()
System.Collections.ObjectModel.Collection<T>.CopyTo(T[], System.Int32)
System.Collections.ObjectModel.Collection<T>.Contains(T)
System.Collections.ObjectModel.Collection<T>.GetEnumerator()
System.Collections.ObjectModel.Collection<T>.IndexOf(T)
System.Collections.ObjectModel.Collection<T>.Insert(System.Int32, T)
System.Collections.ObjectModel.Collection<T>.Remove(T)
System.Collections.ObjectModel.Collection<T>.RemoveAt(System.Int32)
System.Collections.ObjectModel.Collection<T>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.get_Item(System.Int32)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Add(System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Contains(System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.IndexOf(System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Remove(System.Object)
Collection<T>.Count
System.Collections.ObjectModel.Collection<T>.Items
System.Collections.ObjectModel.Collection<T>.Item[System.Int32]
System.Collections.ObjectModel.Collection<T>.System.Collections.Generic.ICollection<T>.IsReadOnly
System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.IsSynchronized
System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.SyncRoot
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Item[System.Int32]
Collection<T>.IList.IsReadOnly
Collection<T>.IList.IsFixedSize
System.Object.ToString()
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
Namespace: IRM.Domain
Assembly: IRM.dll
Syntax
public class EntityList<T> : Collection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEntityList<T>, IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable where T : IEntity
Type Parameters
T

The type of entities in the list.

Constructors

EntityList()

Initializes a new instance of the EntityList<T> class.

Declaration
public EntityList()

EntityList(IAggregateRoot)

Initializes a new instance of the EntityList<T> class with an aggregate root.

Declaration
public EntityList(IAggregateRoot aggregateRoot)
Parameters
IAggregateRoot aggregateRoot

The aggregate root all added entities will get a reference to.

Remarks

When the EntityList<T> is created with an aggregate root all added entities will get a reference to the aggregate root. This can be useful for example to raise events also in an Entity.

EntityList(IAggregateRoot, IList<T>)

Initializes a new instance of the EntityList<T> class with an aggregate root.

Declaration
public EntityList(IAggregateRoot aggregateRoot, IList<T> list)
Parameters
IAggregateRoot aggregateRoot

The aggregate root all added entities will get a reference to.

System.Collections.Generic.IList<T> list

The list that is wrapped by the new collection.

Remarks

When the EntityList<T> is created with an aggregate root all added entities will get a reference to the aggregate root. This can be useful for example to raise events also in an Entity.

EntityList(IList<T>)

Initializes a new instance of the EntityList<T> class.

Declaration
public EntityList(IList<T> list)
Parameters
System.Collections.Generic.IList<T> list

The list that is wrapped by the new collection.

Properties

Item[Guid]

Gets the element of the specified identity.

Declaration
public T this[Guid id] { get; }
Parameters
System.Guid id

The unique identifier of the element to get.

Property Value
T

The element with the specified identity or null if it does not exists.

Methods

ClearItems()

Removes all elements from the EntityList<T>.

Declaration
protected override void ClearItems()
Overrides
System.Collections.ObjectModel.Collection<T>.ClearItems()

Contains(Guid)

Determines whether an entity is in the collection.

Declaration
public bool Contains(Guid id)
Parameters
System.Guid id

The unique identifier of the entity.

Returns
Boolean

true if the entity is in the collection; otherwise false.

Initialize(IAggregateRoot)

Initializes all items in the list with the supplied aggregateRoot.

Declaration
protected virtual void Initialize(IAggregateRoot aggregateRoot)
Parameters
IAggregateRoot aggregateRoot

The aggregate root all added entities will get a reference to.

InsertItem(Int32, T)

Inserts an item into the collection at the specified index.

Declaration
protected override void InsertItem(int index, T item)
Parameters
System.Int32 index

The zero-based index at which item should be inserted.

T item

The object to insert.

Overrides
System.Collections.ObjectModel.Collection<T>.InsertItem(System.Int32, T)

Remove(Guid)

Removes the entity with the specified identity of the EntityList<T>.

Declaration
public void Remove(Guid id)
Parameters
System.Guid id

The unique identifier of the entity to remove.

RemoveItem(Int32)

Removes the element at the specified index of the EntityList<T>.

Declaration
protected override void RemoveItem(int index)
Parameters
System.Int32 index

The zero based index of the item to remove.

Overrides
System.Collections.ObjectModel.Collection<T>.RemoveItem(System.Int32)

SetItem(Int32, T)

Replaces an item at the specified index.

Declaration
protected override void SetItem(int index, T item)
Parameters
System.Int32 index

The zero-based index of the item to replace.

T item

The new value for the item at the specified index.

Overrides
System.Collections.ObjectModel.Collection<T>.SetItem(System.Int32, T)

Explicit Interface Implementations

IEntityList<T>.Initialize(IAggregateRoot)

Declaration
void IEntityList<T>.Initialize(IAggregateRoot aggregateRoot)
Parameters
IAggregateRoot aggregateRoot

Implements
IEntityList<T>.Initialize(IAggregateRoot)

Extension Methods

EnumerableExtensions.GroupAdjacentBy<T>(IEnumerable<T>, Func<T, T, Boolean>)
EnumerableExtensions.AddRange<T>(ICollection<T>, IEnumerable<T>)
EnumerableExtensions.Each<T>(IEnumerable<T>, Action<T>)
ObjectExtensions.DeepClone<T>(T)
AnnotationsExtensions.IsValid(Object)
Back to top Generated by DocFX