Class RowForeignKeyHelper
Implements
Inherited Members
Namespace: SuperOffice.CRM.Rows.Util
Assembly: SoDataBase.dll
Syntax
public class RowForeignKeyHelper : NestedPersistFacade, INestedPersist
Constructors
RowForeignKeyHelper(TableRowBase)
Constructor
Declaration
public RowForeignKeyHelper(TableRowBase sourceEntityRow)
Parameters
Type | Name | Description |
---|---|---|
TableRowBase | sourceEntityRow | Table to reflect foreignkeys from |
Properties
IsDeleted
This object do not support full delete. ForeignKeys need to be deleted individually
Declaration
public override bool IsDeleted { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
IsDirty
Do we have any changes
Declaration
public override bool IsDirty { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
IsMarkedForDelete
This object do not support full delete. ForeignKeys need to be deleted individually
Declaration
public override bool IsMarkedForDelete { get; set; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Methods
Get(int, string)
Get the value of a foreign key
Declaration
public string Get(int deviceId, string foreignKey)
Parameters
Type | Name | Description |
---|---|---|
int | deviceId | Owner device identifier |
string | foreignKey | Name of foreign key |
Returns
Type | Description |
---|---|
string |
GetAll()
Get all associated foreign keys
Declaration
public IEnumerable<ForeignKeyRow> GetAll()
Returns
Type | Description |
---|---|
IEnumerable<ForeignKeyRow> |
GetAllKeys(int)
Get all associated keys for one device
Declaration
public string[] GetAllKeys(int deviceId)
Parameters
Type | Name | Description |
---|---|---|
int | deviceId |
Returns
Type | Description |
---|---|
string[] | A string array containing the keys |
GetFacadingItems()
Implement this method to expose items that needs to be persisted.
Declaration
protected override IEnumerable<INestedPersist> GetFacadingItems()
Returns
Type | Description |
---|---|
IEnumerable<INestedPersist> | Collection of items that needs to be persisted. |
Overrides
GetForeignAppRow(string)
Get a foreign app row from the database. If the row is not found, one is created
Declaration
public static ForeignAppRow GetForeignAppRow(string appName)
Parameters
Type | Name | Description |
---|---|---|
string | appName |
Returns
Type | Description |
---|---|
ForeignAppRow |
GetForeignDeviceRow(int, string, string)
Get a foreign device row from the database. If the row is not found, one is created
Declaration
public static ForeignDeviceRow GetForeignDeviceRow(int foreignAppId, string deviceName, string deviceId)
Parameters
Type | Name | Description |
---|---|---|
int | foreignAppId | Id of "parent" foreign app row |
string | deviceName | Name of device |
string | deviceId | Device id |
Returns
Type | Description |
---|---|
ForeignDeviceRow |
MergeValue(params string[])
Take a string splitted with SplitValue(string) and merge it back to a long string.
Declaration
public static string MergeValue(params string[] valueParts)
Parameters
Type | Name | Description |
---|---|---|
string[] | valueParts | Fragments to be joined into one part. |
Returns
Type | Description |
---|---|
string | Long string merged back from its' individual parts. |
Remarks
The current implementation does not address trailing white space, but future implementations will.
See Also
OnIdUpdate()
Update related objects with correct id's to make sure that relations are consistent before saving to the database.
Declaration
protected override void OnIdUpdate()
Overrides
OnPreIdUpdate()
Allow for "fake id's" to be forced upon related objects.
Declaration
protected override void OnPreIdUpdate()
Overrides
Remarks
In order to figure out which objects taking part of the nested save operation that actually needs to be saved, this method allows for "fake id's" to be forced upon related objects. Upon receiving the "fake id", the objects receiving such an id can determine if they needs to be persisted (e.g. saved) to the database. However, the fake id's forced upon related objects must be set to correct id's in the OnIdUpdate method taking place later in the save operation.
OnPrimaryKeyUpdate(PKContainer)
Update primary key.
Declaration
protected override void OnPrimaryKeyUpdate(PKContainer pkContainer)
Parameters
Type | Name | Description |
---|---|---|
PKContainer | pkContainer | Collection of objects getting a primary key. |
Overrides
OnSave(BatchSave)
Add the object to the collection of objects that are to be saved within the transaction.
Declaration
protected override void OnSave(BatchSave batchSave)
Parameters
Type | Name | Description |
---|---|---|
BatchSave | batchSave | An object holding all the objects that needs to be persisted. |
Overrides
OnSaved(bool)
Called after the save operation has completed. A boolean value is passed to notify whether or not the save operation succeeded. The complete save operation is rolled back if Save operation failed.
Declaration
protected override void OnSaved(bool bSucceeded)
Parameters
Type | Name | Description |
---|---|---|
bool | bSucceeded | True if the save operation succeeded and false if the save operation failed and rolled back. |
Overrides
Remove(int, string)
Remove a foreign key
Declaration
public void Remove(int deviceId, string foreignKey)
Parameters
Type | Name | Description |
---|---|---|
int | deviceId | |
string | foreignKey |
Set(int, string, string)
Add/edit a foreignkey
Declaration
public void Set(int deviceId, string foreignKey, string foreignValue)
Parameters
Type | Name | Description |
---|---|---|
int | deviceId | |
string | foreignKey | |
string | foreignValue |
SplitValue(string)
The filed in the database storing the foreign key values are limited, hence; long values needs to be splits in parts. Due to database issues with trailing white spaces, some additional logic needs to be performed.
Declaration
public static string[] SplitValue(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | Value in foreign key to be split into separate parts that fits into the database. |
Returns
Type | Description |
---|---|
string[] | Value split into parts that fit into the database. |
Remarks
The current implementation does not address trailing white space, but future implementations will.