Class EntityList<T>
Represents a strongly typed list of entities.
Inherited Members
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()
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
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 |
T
item
The object to insert. |
Overrides
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
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
Explicit Interface Implementations
IEntityList<T>.Initialize(IAggregateRoot)
Declaration
void IEntityList<T>.Initialize(IAggregateRoot aggregateRoot)
Parameters
IAggregateRoot
aggregateRoot
|