Class ADTObjectCollectionT<T>
- Namespace
- ArcanaDevelopment.adTempus.Client.Collections
- Assembly
- ArcanaDevelopment.adTempus.Client.dll
public abstract class ADTObjectCollectionT<T> : ObjectCollectionT<T> where T : ADTObject
Type Parameters
| Name | Description |
|---|---|
T |
- Inheritance
-
objectADTObjectCollectionT<T>
- Derived
Constructors
ADTObjectCollectionT()
protected ADTObjectCollectionT()
Fields
NavigatorName
protected string NavigatorName
Field Value
- string
ParentFacade
protected ADTObject ParentFacade
Field Value
Properties
this[object]
Gets the object with the specified OID or numeric index.
public virtual T this[object index] { get; }
Parameters
| Name | Type | Description |
|---|---|---|
index |
object |
Property Value
- T
Remarks
Returns null if no object with the requested OID is found.
Exceptions
- ArgumentOutOfRangeException
Thrown if
indexis a numeric value that is outside the bounds of the collection.- ArgumentException
Thrown if
indexis not an integer, string, or OID.
- See Also
Methods
Add(T)
Adds an item to the System.Collections.Generic.ICollection<T>.
public override void Add(T newVal)
Parameters
| Name | Type | Description |
|---|---|---|
newVal |
T |
Exceptions
- NotSupportedException
The System.Collections.Generic.ICollection<T> is read-only.
CanAdd(T)
protected virtual bool CanAdd(T obj)
Parameters
| Name | Type | Description |
|---|---|---|
obj |
T |
Returns
- bool
CanRemove(T)
protected virtual bool CanRemove(T obj)
Parameters
| Name | Type | Description |
|---|---|---|
obj |
T |
Returns
- bool
Clear()
Removes all items from the System.Collections.Generic.ICollection<T>.
public override void Clear()
Exceptions
- NotSupportedException
The System.Collections.Generic.ICollection<T> is read-only.
Contains(OID)
public virtual bool Contains(OID targetOID)
Parameters
| Name | Type | Description |
|---|---|---|
targetOID |
OID |
Returns
- bool
CreateCollectionReadOnlyException()
public static NotSupportedException CreateCollectionReadOnlyException()
Returns
- NotSupportedException
EnsureCanReferenceAndThrow(ADTObject)
protected void EnsureCanReferenceAndThrow(ADTObject objectToReference)
Parameters
| Name | Type | Description |
|---|---|---|
objectToReference |
ADTObject |
GetAt(int)
public T GetAt(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index |
int |
Returns
- T
GetEnumerator()
Returns an enumerator that iterates through the collection.
public virtual IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator that can be used to iterate through the collection.
GetItem(object)
Gets the object with the specified OID or numeric index.
public virtual T GetItem(object index)
Parameters
| Name | Type | Description |
|---|---|---|
index |
object |
Returns
- T
Remarks
Returns null if no object with the requested OID is found.
Exceptions
- ArgumentOutOfRangeException
Thrown if
indexis a numeric value that is outside the bounds of the collection.- ArgumentException
Thrown if
indexis not an integer, string, or OID.
GetItemByOID(OID)
Returns the item in the collection that matches the specified OID.
protected virtual T GetItemByOID(OID targetOID)
Parameters
| Name | Type | Description |
|---|---|---|
targetOID |
OID |
Returns
- T
The requested item, or null if the item does not exist in the collection.
Remarks
This method is used by both this[], GetItem, Contains, Remove, etc. Override it to modify the way searches by OID are done.
For example, a collection of joins may want to be able to match on the OID of the join object or one of the objects the join points to.
GetObject(OID)
Gets the object with the specified OID.
public virtual ADTObject GetObject(OID oid)
Parameters
| Name | Type | Description |
|---|---|---|
oid |
OID | The OID of the object to get from the collection. |
Returns
- ADTObject
The requested object, or null (Nothing) if the object is not found in the collection.
Insert(int, T)
public override void Insert(int index, T newVal)
Parameters
| Name | Type | Description |
|---|---|---|
index |
int | |
newVal |
T |
OnObjectAdded(T, int)
protected virtual void OnObjectAdded(T newVal, int index)
Parameters
| Name | Type | Description |
|---|---|---|
newVal |
T | |
index |
int |
OnObjectRemoved(T)
protected virtual void OnObjectRemoved(T newVal)
Parameters
| Name | Type | Description |
|---|---|---|
newVal |
T |
Remove(object)
public void Remove(object index)
Parameters
| Name | Type | Description |
|---|---|---|
index |
object |
Remove(T)
Removes the first occurrence of a specific object from the System.Collections.Generic.ICollection<T>.
public override bool Remove(T ObjectToRemove)
Parameters
| Name | Type | Description |
|---|---|---|
ObjectToRemove |
T |
Returns
- bool
true if
itemwas successfully removed from the System.Collections.Generic.ICollection<T>; otherwise, false. This method also returns false ifitemis not found in the original System.Collections.Generic.ICollection<T>.
Exceptions
- NotSupportedException
The System.Collections.Generic.ICollection<T> is read-only.
RemoveAt(int)
public override void RemoveAt(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index |
int |
RemoveByOID(OID)
public virtual bool RemoveByOID(OID targetOID)
Parameters
| Name | Type | Description |
|---|---|---|
targetOID |
OID |
Returns
- bool
RenumberContents()
Updates sequence numbers for all items in collection. This method must be explicitly called to renumber contents.
public virtual void RenumberContents()
Remarks
RenumberContents iterates through all items in the collection if they implement the ISequencedCollectionMember. If so, ISequencedCollectionMember.SetSequenceNumber is called. This is used, for example, in a collection of JobSteps, where the StepNumber needs to be set on each step to keep them in the correct order.
UpdateFrom(IEnumerable<T>)
Updates the collection to match the specified source by adding, deleting, and reordering contents as needed.
public virtual void UpdateFrom(IEnumerable<T> src)
Parameters
| Name | Type | Description |
|---|---|---|
src |
IEnumerable<T> |
UpdateFrom(IEnumerable, bool)
Updates the collection to match the specified source by adding, deleting, and reordering contents as needed.
public virtual void UpdateFrom(IEnumerable source, bool throwOnMismatch)
Parameters
| Name | Type | Description |
|---|---|---|
source |
IEnumerable | An enumerable collection to add from |
throwOnMismatch |
bool | If true, the method throws an InvalidOperationException if it encounters an item that is not of type T. If false, invalid items are silently ignored. |
Events
EntityAdded
public event ADTObjectCollectionT<T>.CollectionOperationEvent EntityAdded
Event Type
EntityRemoved
public event ADTObjectCollectionT<T>.CollectionOperationEvent EntityRemoved
Event Type
ObjectAdding
public event ADTObjectCollectionT<T>.CancelableCollectionOperationEvent ObjectAdding
Event Type
ObjectRemoving
public event ADTObjectCollectionT<T>.CancelableCollectionOperationEvent ObjectRemoving