Show / Hide Table of Contents

Class LinksHelper

Helper class for links management on entities

Inheritance
Object
NestedPersist
NestedPersistFacade
EntityDetailsHelper<TableRowBase, RelationsRow>
LinksHelper
ActivityLinksHelper
Implements
INestedPersist
Inherited Members
EntityDetailsHelper<TableRowBase, RelationsRow>.Add(RelationsRow)
EntityDetailsHelper<TableRowBase, RelationsRow>.Remove(RelationsRow)
EntityDetailsHelper<TableRowBase, RelationsRow>.SetChildren(RelationsRow[])
EntityDetailsHelper<TableRowBase, RelationsRow>.FindChildInItems(RelationsRow)
EntityDetailsHelper<TableRowBase, RelationsRow>.IsSameChild(RelationsRow, RelationsRow)
EntityDetailsHelper<TableRowBase, RelationsRow>.hasChanged(RelationsRow, RelationsRow)
EntityDetailsHelper<TableRowBase, RelationsRow>.GetFacadingItems()
EntityDetailsHelper<TableRowBase, RelationsRow>.OnPreIdUpdate()
EntityDetailsHelper<TableRowBase, RelationsRow>.OnIdUpdate()
EntityDetailsHelper<TableRowBase, RelationsRow>.OnSaved(Boolean)
EntityDetailsHelper<TableRowBase, RelationsRow>.OnParentPreIdUpdate(TableRowBase)
EntityDetailsHelper<TableRowBase, RelationsRow>.OnChildPreIdUpdate(TableRowBase, RelationsRow, Boolean)
EntityDetailsHelper<TableRowBase, RelationsRow>.OnParentIdUpdate(TableRowBase)
EntityDetailsHelper<TableRowBase, RelationsRow>.OnChildIdUpdate(TableRowBase, RelationsRow, Boolean)
EntityDetailsHelper<TableRowBase, RelationsRow>.LoadChildItems(TableRowBase)
EntityDetailsHelper<TableRowBase, RelationsRow>.Items
EntityDetailsHelper<TableRowBase, RelationsRow>.RemovedItems
EntityDetailsHelper<TableRowBase, RelationsRow>.Parent
EntityDetailsHelper<TableRowBase, RelationsRow>.Children
EntityDetailsHelper<TableRowBase, RelationsRow>.IsDirty
EntityDetailsHelper<TableRowBase, RelationsRow>.OnEntityDetailsHelperAdded
EntityDetailsHelper<TableRowBase, RelationsRow>.OnEntityDetailsHelperRemoved
NestedPersistFacade.OnPreIdUpdate()
NestedPersistFacade.OnPrimaryKeyRequest(PKContainer)
NestedPersistFacade.OnPrimaryKeyUpdate(PKContainer)
NestedPersistFacade.OnIdUpdate()
NestedPersistFacade.OnSave(BatchSave)
NestedPersistFacade.OnSaved(Boolean)
NestedPersistFacade.GetFacadingItems()
NestedPersistFacade.IsDirty
NestedPersist._saveOwner
NestedPersist._isSaving
NestedPersist.SetSaveOwner(INestedPersist)
NestedPersist.Save()
NestedPersist.INestedPersist.OnPreIdUpdate()
NestedPersist.INestedPersist.OnPrimaryKeyRequest(PKContainer)
NestedPersist.INestedPersist.OnPrimaryKeyUpdate(PKContainer)
NestedPersist.INestedPersist.OnIdUpdate()
NestedPersist.INestedPersist.OnSave(BatchSave)
NestedPersist.INestedPersist.OnSaved(Boolean)
NestedPersist.IsSaving
NestedPersist.IsMarkedForDelete
NestedPersist.OnElementSaved
NestedPersist.OnElementIdUpdate
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: SuperOffice.CRM.Entities
Assembly: SoDataBase.dll
Syntax
public abstract class LinksHelper : EntityDetailsHelper<TableRowBase, RelationsRow>, INestedPersist

Constructors

LinksHelper(TableRowBase)

Default constructor setting the link source info

Declaration
protected LinksHelper(TableRowBase sourceEntityRow)
Parameters
Type Name Description
TableRowBase sourceEntityRow

The row object of the source entity

Properties

IsDeleted

Declaration
public override bool IsDeleted { get; }
Property Value
Type Description
Boolean
Overrides
NestedPersist.IsDeleted

SourceTableId

Declaration
protected short SourceTableId { get; }
Property Value
Type Description
Int16

Methods

AddLink(TableRowBase, String)

Adds a link relation to the entity. If the source does not match the LinkHelper source an exception is thrown.

Declaration
protected RelationsRow AddLink(TableRowBase targetEntityRow, string relationComment)
Parameters
Type Name Description
TableRowBase targetEntityRow

The target/destination data row

String relationComment

Any relation comment

Returns
Type Description
RelationsRow

The saved RelationsRow or null if the target did not exist

AddLink(TableInfo, Int32, String)

Adds a link relation to the entity. If the source does not match the LinkHelper source an exception is thrown.

Declaration
protected RelationsRow AddLink(TableInfo targetTableInfo, int targetEntityId, string relationComment)
Parameters
Type Name Description
TableInfo targetTableInfo

The target/destination table info

Int32 targetEntityId

The target/destination entity id

String relationComment

Any relation comment

Returns
Type Description
RelationsRow

AddLink(Int16, Int32, String)

Declaration
protected RelationsRow AddLink(short targetTableId, int targetEntityId, string relationComment)
Parameters
Type Name Description
Int16 targetTableId
Int32 targetEntityId
String relationComment
Returns
Type Description
RelationsRow

AddLinks(RelationsRows)

Adds link relations to the entity. If the source does not match the LinkHelper source an exception is thrown.

Declaration
public virtual RelationsRows AddLinks(RelationsRows relationsRows)
Parameters
Type Name Description
RelationsRows relationsRows

Collection of Relation Rows to save

Returns
Type Description
RelationsRows

The saved RelationsRows

AddSimilarLink(RelationsRow)

Add similar link

Declaration
public RelationsRow AddSimilarLink(RelationsRow relationsRow)
Parameters
Type Name Description
RelationsRow relationsRow
Returns
Type Description
RelationsRow

The new link

CopyTo(LinksHelper)

Remove all the links from the other LinksHelper, and create new links identical with this one.

Declaration
public void CopyTo(LinksHelper otherLinksHelper)
Parameters
Type Name Description
LinksHelper otherLinksHelper

The links helper to apply the links on.

DeleteLinks(Int32[])

Deletes the links if the link belongs to the source entity

Declaration
public virtual void DeleteLinks(params int[] linkIds)
Parameters
Type Name Description
Int32[] linkIds

DeleteSimilarLink(RelationsRow)

Delete similar link if it exists.

Declaration
public void DeleteSimilarLink(RelationsRow relationsRow)
Parameters
Type Name Description
RelationsRow relationsRow

Relations row pointing to the item to remove link to.

GetLinks()

Gets all links (Relation rows) that belong to the source entity

Declaration
public RelationsRows GetLinks()
Returns
Type Description
RelationsRows

All links (Relation rows) that belong to the source entity

hasChanged(RelationsRow, RelationsRow)

Declaration
protected override bool hasChanged(RelationsRow child1, RelationsRow child2)
Parameters
Type Name Description
RelationsRow child1
RelationsRow child2
Returns
Type Description
Boolean
Overrides
SuperOffice.CRM.Entities.EntityDetailsHelper<SuperOffice.CRM.Rows.TableRowBase, SuperOffice.CRM.Rows.RelationsRow>.hasChanged(SuperOffice.CRM.Rows.RelationsRow, SuperOffice.CRM.Rows.RelationsRow)

IsSameChild(RelationsRow, RelationsRow)

Two links records are equivalent if their sources and destinations match, and they refer to the same relation definition

Declaration
protected override bool IsSameChild(RelationsRow child1, RelationsRow child2)
Parameters
Type Name Description
RelationsRow child1
RelationsRow child2
Returns
Type Description
Boolean
Overrides
SuperOffice.CRM.Entities.EntityDetailsHelper<SuperOffice.CRM.Rows.TableRowBase, SuperOffice.CRM.Rows.RelationsRow>.IsSameChild(SuperOffice.CRM.Rows.RelationsRow, SuperOffice.CRM.Rows.RelationsRow)

LoadChildItems(TableRowBase)

Load the Relations items, based on our (parent) table type and primary key

Declaration
public override void LoadChildItems(TableRowBase parent)
Parameters
Type Name Description
TableRowBase parent

Parent on whose behalf we are loading relations

Overrides
SuperOffice.CRM.Entities.EntityDetailsHelper<SuperOffice.CRM.Rows.TableRowBase, SuperOffice.CRM.Rows.RelationsRow>.LoadChildItems(SuperOffice.CRM.Rows.TableRowBase)
Remarks

To support two-way links (i.e., a row in the relations table should be present in the Links collections of both the source AND the destination entity), we load in two stages. First stage is the normal left-to-right; second stage is right-to-left. In the second stage, we set the RelationsRowImplementation.SuperOffice.CRM.Rows.Implementation.RelationsRowImplementation.IsRightToLeft flag, which causes all access to the Source and Destination properties to be mirrored. In this way, we make the right-to-left links appear as though they were ordinary left-to-right links.

OnChildIdUpdate(TableRowBase, RelationsRow, Boolean)

Declaration
protected override void OnChildIdUpdate(TableRowBase parent, RelationsRow child, bool isRemoved)
Parameters
Type Name Description
TableRowBase parent
RelationsRow child
Boolean isRemoved
Overrides
SuperOffice.CRM.Entities.EntityDetailsHelper<SuperOffice.CRM.Rows.TableRowBase, SuperOffice.CRM.Rows.RelationsRow>.OnChildIdUpdate(SuperOffice.CRM.Rows.TableRowBase, SuperOffice.CRM.Rows.RelationsRow, System.Boolean)

OnChildPreIdUpdate(TableRowBase, RelationsRow, Boolean)

Declaration
protected override void OnChildPreIdUpdate(TableRowBase parent, RelationsRow child, bool isRemoved)
Parameters
Type Name Description
TableRowBase parent
RelationsRow child
Boolean isRemoved
Overrides
SuperOffice.CRM.Entities.EntityDetailsHelper<SuperOffice.CRM.Rows.TableRowBase, SuperOffice.CRM.Rows.RelationsRow>.OnChildPreIdUpdate(SuperOffice.CRM.Rows.TableRowBase, SuperOffice.CRM.Rows.RelationsRow, System.Boolean)

SetLinks(RelationsRows)

Sets link relations to the entity. Existing relations are deleted or updated If the source does not match the LinkHelper source an exception is thrown.

Declaration
public virtual void SetLinks(RelationsRows relationsRows)
Parameters
Type Name Description
RelationsRows relationsRows

Collection of Relation Rows to save

Implements

INestedPersist

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top