Class EntityDetailsHelper<TParent, TChild>
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Inheritance
Implements
Inherited Members
Namespace: SuperOffice.CRM.Entities
Assembly: SoDataBase.dll
Syntax
public abstract class EntityDetailsHelper<TParent, TChild> : NestedPersistFacade, INestedPersist where TParent : class, INestedPersist where TChild : class, INestedPersist
Type Parameters
Name | Description |
---|---|
TParent | Type of parent, normally a row or entity. |
TChild | Type of child, normally a row or entity. |
Constructors
EntityDetailsHelper(TParent)
Constructor called by the implementation
Declaration
protected EntityDetailsHelper(TParent parent)
Parameters
Type | Name | Description |
---|---|---|
TParent | parent | Parent object owning the children. |
Properties
Children
Get all the child items.
Declaration
protected TChild[] Children { get; }
Property Value
Type | Description |
---|---|
TChild[] |
IsDirty
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public override bool IsDirty { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Items
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected List<TChild> Items { get; }
Property Value
Type | Description |
---|---|
List<TChild> |
Parent
Get the parent object.
Declaration
protected TParent Parent { get; }
Property Value
Type | Description |
---|---|
TParent |
RemovedItems
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected List<TChild> RemovedItems { get; }
Property Value
Type | Description |
---|---|
List<TChild> |
Methods
Add(TChild)
Add a child to the collection.
Declaration
protected TChild Add(TChild child)
Parameters
Type | Name | Description |
---|---|---|
TChild | child | Instance of the child to add. |
Returns
Type | Description |
---|---|
TChild | The item actually added. |
Remarks
Override IsSameChild(TChild, TChild) if a custom implementation is required for comparing two child items. This is used when checking if the child was previously removed and now can be re-added.
add_OnEntityDetailsHelperAdded(EntityDetailsHelperModified<TParent, TChild>)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public void add_OnEntityDetailsHelperAdded(EntityDetailsHelperModified<TParent, TChild> value)
Parameters
Type | Name | Description |
---|---|---|
EntityDetailsHelperModified<TParent, TChild> | value |
add_OnEntityDetailsHelperEdited(EntityDetailsHelperModified<TParent, TChild>)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public void add_OnEntityDetailsHelperEdited(EntityDetailsHelperModified<TParent, TChild> value)
Parameters
Type | Name | Description |
---|---|---|
EntityDetailsHelperModified<TParent, TChild> | value |
add_OnEntityDetailsHelperRemoved(EntityDetailsHelperModified<TParent, TChild>)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public void add_OnEntityDetailsHelperRemoved(EntityDetailsHelperModified<TParent, TChild> value)
Parameters
Type | Name | Description |
---|---|---|
EntityDetailsHelperModified<TParent, TChild> | value |
Edit(TChild)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected void Edit(TChild child)
Parameters
Type | Name | Description |
---|---|---|
TChild | child |
FindChildInItems(ref TChild)
Find a child in the list of items and return the found one. Note that IsSameChild(TChild, TChild) is called to determine equivalence, so that the found instance may be different from the one being looked for.
Declaration
protected bool FindChildInItems(ref TChild foundEquivalent)
Parameters
Type | Name | Description |
---|---|---|
TChild | foundEquivalent | Child to search for, updated with the one actually found |
Returns
Type | Description |
---|---|
Boolean | True if there exists an equivalent child to the one searched for. |
GetFacadingItems()
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected override IEnumerable<INestedPersist> GetFacadingItems()
Returns
Type | Description |
---|---|
IEnumerable<INestedPersist> |
Overrides
hasChanged(TChild, TChild)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected virtual bool hasChanged(TChild child1, TChild child2)
Parameters
Type | Name | Description |
---|---|---|
TChild | child1 | |
TChild | child2 |
Returns
Type | Description |
---|---|
Boolean |
IsSameChild(TChild, TChild)
Determine if two children are the same. This base implementation uses the == operator if the child type; override if you need different behaviour (see IsSameChild(RelationsRow, RelationsRow) for an example override).
Declaration
protected virtual bool IsSameChild(TChild child1, TChild child2)
Parameters
Type | Name | Description |
---|---|---|
TChild | child1 | |
TChild | child2 |
Returns
Type | Description |
---|---|
Boolean |
LoadChildItems(TParent)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public abstract void LoadChildItems(TParent parent)
Parameters
Type | Name | Description |
---|---|---|
TParent | parent |
OnChildIdUpdate(TParent, TChild, Boolean)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected abstract void OnChildIdUpdate(TParent parent, TChild child, bool isRemoved)
Parameters
Type | Name | Description |
---|---|---|
TParent | parent | |
TChild | child | |
Boolean | isRemoved |
OnChildPreIdUpdate(TParent, TChild, Boolean)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected abstract void OnChildPreIdUpdate(TParent parent, TChild child, bool isRemoved)
Parameters
Type | Name | Description |
---|---|---|
TParent | parent | |
TChild | child | |
Boolean | isRemoved |
OnIdUpdate()
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected override void OnIdUpdate()
Overrides
OnParentIdUpdate(TParent)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected virtual void OnParentIdUpdate(TParent parent)
Parameters
Type | Name | Description |
---|---|---|
TParent | parent |
OnParentPreIdUpdate(TParent)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected virtual void OnParentPreIdUpdate(TParent parent)
Parameters
Type | Name | Description |
---|---|---|
TParent | parent |
OnPreIdUpdate()
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected override void OnPreIdUpdate()
Overrides
OnSaved(Boolean)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected override void OnSaved(bool bSucceeded)
Parameters
Type | Name | Description |
---|---|---|
Boolean | bSucceeded |
Overrides
Remove(TChild)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
protected void Remove(TChild child)
Parameters
Type | Name | Description |
---|---|---|
TChild | child |
remove_OnEntityDetailsHelperAdded(EntityDetailsHelperModified<TParent, TChild>)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public void remove_OnEntityDetailsHelperAdded(EntityDetailsHelperModified<TParent, TChild> value)
Parameters
Type | Name | Description |
---|---|---|
EntityDetailsHelperModified<TParent, TChild> | value |
remove_OnEntityDetailsHelperEdited(EntityDetailsHelperModified<TParent, TChild>)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public void remove_OnEntityDetailsHelperEdited(EntityDetailsHelperModified<TParent, TChild> value)
Parameters
Type | Name | Description |
---|---|---|
EntityDetailsHelperModified<TParent, TChild> | value |
remove_OnEntityDetailsHelperRemoved(EntityDetailsHelperModified<TParent, TChild>)
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public void remove_OnEntityDetailsHelperRemoved(EntityDetailsHelperModified<TParent, TChild> value)
Parameters
Type | Name | Description |
---|---|---|
EntityDetailsHelperModified<TParent, TChild> | value |
SetChildren(TChild[])
Set the desired new children collection. This method uses the virtual IsSameChild(TChild, TChild) to compare each incoming child with existing children, and determines children to be added, removed or left unchanged. It will only add children that are new according to IsSameChild regardless of whether the underlying TChild instances are the same. Existing children that are not in the new set are marked for deletion, but may be resurrected by a later SetChildren or AddChild call.
Declaration
protected void SetChildren(params TChild[] children)
Parameters
Type | Name | Description |
---|---|---|
TChild[] | children | Children that should be the new set |
Events
OnEntityDetailsHelperAdded
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public event EntityDetailsHelperModified<TParent, TChild> OnEntityDetailsHelperAdded
Event Type
Type | Description |
---|---|
EntityDetailsHelperModified<TParent, TChild> |
OnEntityDetailsHelperEdited
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public event EntityDetailsHelperModified<TParent, TChild> OnEntityDetailsHelperEdited
Event Type
Type | Description |
---|---|
EntityDetailsHelperModified<TParent, TChild> |
OnEntityDetailsHelperRemoved
Helper class for maintaining child items of type INestedPersist belonging to a parent item of type INestedPersist. Remember to call LoadChildItems from your subclass constructor
Declaration
public event EntityDetailsHelperModified<TParent, TChild> OnEntityDetailsHelperRemoved
Event Type
Type | Description |
---|---|
EntityDetailsHelperModified<TParent, TChild> |