Show / Hide Table of Contents

Class ErpConnectionHandlerFacade

A facade for the WCF calls to the actual connector

Inheritance
object
ConnectionHandlerFacadeBase
ErpConnectionHandlerFacade
Inherited Members
ConnectionHandlerFacadeBase._ConnectionId
ConnectionHandlerFacadeBase.SaveActorsAsync(ErpSyncActor[], bool)
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.ErpSync
Assembly: SuperOffice.Services.Implementation.dll
Syntax
public class ErpConnectionHandlerFacade : ConnectionHandlerFacadeBase

Properties

ErpConnectorId

A facade for the WCF calls to the actual connector

Declaration
public int ErpConnectorId { get; }
Property Value
Type Description
int

Methods

CreateActorAsync(ErpSyncActor, ErpActorType)

Creates a new actor and returns the actor from the connection as if looks after the create operation (e.g. with a new ErpKey and timestamp, etc)

Declaration
public override Task<ErpSyncActor> CreateActorAsync(ErpSyncActor act, ErpActorType actorType)
Parameters
Type Name Description
ErpSyncActor act
ErpActorType actorType
Returns
Type Description
Task<ErpSyncActor>
Overrides
ConnectionHandlerFacadeBase.CreateActorAsync(ErpSyncActor, ErpActorType)

CreateConnectionAsync(int, Guid, Dictionary<string, string>)

Saves a new connection to a specified connector. NOTE: Does not save the connection row or the configuration data to the CRM database.

Declaration
public static Task<PluginResponseInfo> CreateConnectionAsync(int erpConnectorId, Guid connectionId, Dictionary<string, string> configData)
Parameters
Type Name Description
int erpConnectorId
Guid connectionId
Dictionary<string, string> configData
Returns
Type Description
Task<PluginResponseInfo>

DeleteConnectionAsync(Guid)

Deletes a connection from the CRM database, and calls DeleteConnection on the connector

Declaration
public static Task<PluginResponseInfo> DeleteConnectionAsync(Guid connectionId)
Parameters
Type Name Description
Guid connectionId
Returns
Type Description
Task<PluginResponseInfo>

DeleteConnectionAsync(int)

Deletes a connection from the CRM database, and calls DeleteConnection on the connector

Declaration
public static Task<PluginResponseInfo> DeleteConnectionAsync(int erpConnectionId)
Parameters
Type Name Description
int erpConnectionId
Returns
Type Description
Task<PluginResponseInfo>

GetActorAsync(Guid, ErpActorType, string, string[])

Retrieves a specified actor from a connection, with a given set of fields

Declaration
public static Task<ErpSyncActor> GetActorAsync(Guid connectionId, ErpActorType actorType, string erpKey, string[] fieldKeys)
Parameters
Type Name Description
Guid connectionId
ErpActorType actorType
string erpKey
string[] fieldKeys
Returns
Type Description
Task<ErpSyncActor>

GetActorAsync(int, ErpActorType, string, string[])

Retrieves a specified actor from a connection, with a given set of fields

Declaration
public static Task<ErpSyncActor> GetActorAsync(int erpConnectionId, ErpActorType actorType, string erpKey, string[] fieldKeys)
Parameters
Type Name Description
int erpConnectionId
ErpActorType actorType
string erpKey
string[] fieldKeys
Returns
Type Description
Task<ErpSyncActor>

GetActorAsync(int, int, string[])

Retrieves a specified actor from a connection (based on the primary key from ErpInternalKey), with a given set of fields

Declaration
public static Task<ErpSyncActor> GetActorAsync(int erpConnectionId, int internalKeyId, string[] fieldKeys)
Parameters
Type Name Description
int erpConnectionId
int internalKeyId
string[] fieldKeys
Returns
Type Description
Task<ErpSyncActor>

GetActorsAsync(ErpActorType, string[])

Retrieves a specified set of actors.

Declaration
public override Task<ErpSyncActor[]> GetActorsAsync(ErpActorType actorType, string[] ErpKeys)
Parameters
Type Name Description
ErpActorType actorType
string[] ErpKeys
Returns
Type Description
Task<ErpSyncActor[]>
Overrides
ConnectionHandlerFacadeBase.GetActorsAsync(ErpActorType, string[])

GetActorsAsync(ErpActorType, string[], string[])

Retrieves a specified set of actors from a connection with a specified set of fields

Declaration
public Task<ErpSyncActor[]> GetActorsAsync(ErpActorType actorType, string[] ErpKeys, string[] fieldKeys)
Parameters
Type Name Description
ErpActorType actorType
string[] ErpKeys
string[] fieldKeys
Returns
Type Description
Task<ErpSyncActor[]>

GetActorsMappedAsync(ErpActorType, string[])

Retrieves a specified set of actors. Will use the field mapping for the given actor type and connection.

Declaration
public Task<ErpSyncActor[]> GetActorsMappedAsync(ErpActorType actorType, string[] erpKeys)
Parameters
Type Name Description
ErpActorType actorType
string[] erpKeys
Returns
Type Description
Task<ErpSyncActor[]>

GetConfigDataAsync()

A facade for the WCF calls to the actual connector

Declaration
protected override Task<FieldMetadataInfo[]> GetConfigDataAsync()
Returns
Type Description
Task<FieldMetadataInfo[]>
Overrides
ConnectionHandlerFacadeBase.GetConfigDataAsync()

GetConfigDataAsync(int, CancellationToken)

Retrieves a set of FieldMetadataInfo objects containing the fields needed to define a connection in a given connector.

Declaration
public static Task<FieldMetadataInfoArrayPluginResponse> GetConfigDataAsync(int connectorId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectorId

id which is mapped to a connection guid

CancellationToken cancellationToken
Returns
Type Description
Task<FieldMetadataInfoArrayPluginResponse>

Default value, field types, key names

GetConnectionIdAsync()

Get or set (set method is protected) the external connection ID for the connection handler. If set, it will use this to find its own internal ID (database key)

Declaration
public override Task<Guid> GetConnectionIdAsync()
Returns
Type Description
Task<Guid>
Overrides
ConnectionHandlerFacadeBase.GetConnectionIdAsync()

GetConnectionIdAsync(int, CancellationToken)

Map an ERP Connection to a GUID by looking in the database ErpConnection table.

Declaration
public static Task<Guid> GetConnectionIdAsync(int erpConnectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int erpConnectionId

Database id

CancellationToken cancellationToken
Returns
Type Description
Task<Guid>

GUID that is used with the Sync web service.

GetErpConnectionIdAsync()

Get or set (set method is protected) the internal connection ID (database key) for the connection handler. If set, it will use this to find its own external ID

Declaration
public override Task<int> GetErpConnectionIdAsync()
Returns
Type Description
Task<int>
Overrides
ConnectionHandlerFacadeBase.GetErpConnectionIdAsync()

GetErpConnectionIdAsync(Guid, CancellationToken)

Map GUID to an ERP Connection by looking in the database ErpConnection table.

Declaration
public static Task<int> GetErpConnectionIdAsync(Guid connectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
Guid connectionId

GUID that is used with the Sync web service

CancellationToken cancellationToken
Returns
Type Description
Task<int>

id for the corresponding connection. 0 if nothing is found

GetErpKey(int)

A facade for the WCF calls to the actual connector

Declaration
protected Task<string> GetErpKey(int internalKeyId)
Parameters
Type Name Description
int internalKeyId
Returns
Type Description
Task<string>

GetExternalKeyRowAsync(int)

A facade for the WCF calls to the actual connector

Declaration
protected Task<ErpExternalKeyRow> GetExternalKeyRowAsync(int internalKeyId)
Parameters
Type Name Description
int internalKeyId
Returns
Type Description
Task<ErpExternalKeyRow>

GetExternalKeyRowAsync(string, ErpActorType)

A facade for the WCF calls to the actual connector

Declaration
protected Task<ErpExternalKeyRow> GetExternalKeyRowAsync(string erpKey, ErpActorType actorType)
Parameters
Type Name Description
string erpKey
ErpActorType actorType
Returns
Type Description
Task<ErpExternalKeyRow>

GetFieldCacheAsync(CancellationToken)

A facade for the WCF calls to the actual connector

Declaration
public Task<ErpFieldCache> GetFieldCacheAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ErpFieldCache>

GetFieldsByInternalKeyIdAsync(int)

Retrieves all fields that are mapped for a given actor (as represented by the actor's ErpInternalKeyId)

Declaration
public Task<ErpSyncActorFieldCollection> GetFieldsByInternalKeyIdAsync(int internalKeyId)
Parameters
Type Name Description
int internalKeyId
Returns
Type Description
Task<ErpSyncActorFieldCollection>

GetFieldsForActorTypeAsync(ErpActorType, CancellationToken)

Retrieves all fields that are mapped for a given actor type

Declaration
public Task<ErpSyncActorFieldCollection> GetFieldsForActorTypeAsync(ErpActorType actorType, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ErpActorType actorType
CancellationToken cancellationToken
Returns
Type Description
Task<ErpSyncActorFieldCollection>

GetInternalKey(string, ErpActorType)

Retrieves the ErpInternalKeyId for a given ErpKey and actor type combination

Declaration
public Task<int> GetInternalKey(string localKey, ErpActorType actorType)
Parameters
Type Name Description
string localKey
ErpActorType actorType
Returns
Type Description
Task<int>

GetListAsync(int, string, CancellationToken)

Retrieves array of list item.

Declaration
public static Task<ListItemArrayPluginResponse> GetListAsync(int connectorId, string listName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectorId

id which is mapped to a connection guid

string listName
CancellationToken cancellationToken
Returns
Type Description
Task<ListItemArrayPluginResponse>

GetListAsync(string)

Retrieves an entire list with a given name

Declaration
public override Task<Dictionary<string, string>> GetListAsync(string listName)
Parameters
Type Name Description
string listName
Returns
Type Description
Task<Dictionary<string, string>>
Overrides
ConnectionHandlerFacadeBase.GetListAsync(string)

GetListItemDisplayValueAsync(int, string, string)

Retrieves the textual value (display value) of a given list item in a given list for a given connection

Declaration
public static Task<string> GetListItemDisplayValueAsync(int erpConnectionId, string listName, string listItemKey)
Parameters
Type Name Description
int erpConnectionId
string listName
string listItemKey
Returns
Type Description
Task<string>

GetListItemsAsync(int, string, string[], CancellationToken)

Retrieves a set of FieldMetadataInfo objects containing the fields needed to define a connection in a given connector.

Declaration
public static Task<ListItemArrayPluginResponse> GetListItemsAsync(int connectorId, string listName, string[] listItemKeys, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectorId

id which is mapped to a connection guid

string listName
string[] listItemKeys
CancellationToken cancellationToken
Returns
Type Description
Task<ListItemArrayPluginResponse>

GetListItemsAsync(string, string[])

Retrieves a specific set of list items from a given list

Declaration
public override Task<Dictionary<string, string>> GetListItemsAsync(string listName, string[] listItemKeys)
Parameters
Type Name Description
string listName
string[] listItemKeys
Returns
Type Description
Task<Dictionary<string, string>>
Overrides
ConnectionHandlerFacadeBase.GetListItemsAsync(string, string[])

GetSearchableFieldsAsync(ErpActorType, CancellationToken)

A facade for the WCF calls to the actual connector

Declaration
public Task<List<FieldMetadataInfo>> GetSearchableFieldsAsync(ErpActorType actorType, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ErpActorType actorType
CancellationToken cancellationToken
Returns
Type Description
Task<List<FieldMetadataInfo>>

GetSelectedErpFieldsAsync(bool, ErpActorType)

Retrieves all fields marked "Show In Gui" or "PromptUser" for a given actor type

Declaration
public Task<Dictionary<string, FieldMetadataInfo>> GetSelectedErpFieldsAsync(bool getPromptUserFields, ErpActorType erpActorType)
Parameters
Type Name Description
bool getPromptUserFields

Get fields marked as PromptUser instead of ShowInGui fields

ErpActorType erpActorType
Returns
Type Description
Task<Dictionary<string, FieldMetadataInfo>>

A dictionary with all matching fields

GetSupportedActorTypeFieldsAsync(ErpActorType)

Retrieves the supported fields for a given actor type

Declaration
public override Task<FieldMetadataInfo[]> GetSupportedActorTypeFieldsAsync(ErpActorType actorType)
Parameters
Type Name Description
ErpActorType actorType
Returns
Type Description
Task<FieldMetadataInfo[]>
Overrides
ConnectionHandlerFacadeBase.GetSupportedActorTypeFieldsAsync(ErpActorType)

GetSupportedActorTypesAsync()

Retrieves all actor types this connection supports.

Declaration
public override Task<string[]> GetSupportedActorTypesAsync()
Returns
Type Description
Task<string[]>
Overrides
ConnectionHandlerFacadeBase.GetSupportedActorTypesAsync()

GetSupportedShowInSearchFieldsAsync(ErpActorType, CancellationToken)

A facade for the WCF calls to the actual connector

Declaration
public Task<List<FieldMetadataInfo>> GetSupportedShowInSearchFieldsAsync(ErpActorType actorType, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ErpActorType actorType
CancellationToken cancellationToken
Returns
Type Description
Task<List<FieldMetadataInfo>>

GetUpdatedActorsAsync()

Retrieves all actors updated on or after the most recent timestamp stored in the CRM database.

Declaration
public override Task<ErpSyncActor[]> GetUpdatedActorsAsync()
Returns
Type Description
Task<ErpSyncActor[]>
Overrides
ConnectionHandlerFacadeBase.GetUpdatedActorsAsync()

OpenConnectionAsync(Guid, CancellationToken)

Retrieves or opens a connection object with the specified Connection ID

Declaration
public static Task<ErpConnectionHandlerFacade> OpenConnectionAsync(Guid connectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
Guid connectionId
CancellationToken cancellationToken
Returns
Type Description
Task<ErpConnectionHandlerFacade>

OpenConnectionAsync(int, CancellationToken)

Retrieves or opens a connection object with the specified ERPConnectionID

Declaration
public static Task<ErpConnectionHandlerFacade> OpenConnectionAsync(int erpConnectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int erpConnectionId
CancellationToken cancellationToken
Returns
Type Description
Task<ErpConnectionHandlerFacade>

SaveActorTimestampAsync(ErpSyncActor, CancellationToken)

If the timestamp of the given actor is larger than the currently stored timestamp from the database (ErpExternalKey row), the new timestamp is stored to the database.

Declaration
public override Task SaveActorTimestampAsync(ErpSyncActor act, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ErpSyncActor act
CancellationToken cancellationToken
Returns
Type Description
Task
Overrides
ConnectionHandlerFacadeBase.SaveActorTimestampAsync(ErpSyncActor, CancellationToken)

SaveActorsAsync(ErpSyncActor[])

Saves a set of actors to the connection and returns those same actors with their updated values from the ERP system (new timestamp, possibly new field values, etc)

Declaration
public override Task<ErpSyncActor[]> SaveActorsAsync(ErpSyncActor[] actors)
Parameters
Type Name Description
ErpSyncActor[] actors
Returns
Type Description
Task<ErpSyncActor[]>
Overrides
ConnectionHandlerFacadeBase.SaveActorsAsync(ErpSyncActor[])

SaveConnectionAsync()

Calls SaveConnection on the connector using the configuration data stored in the CRM database.

Declaration
public Task<PluginResponseInfo> SaveConnectionAsync()
Returns
Type Description
Task<PluginResponseInfo>

SaveConnectionAsync(Dictionary<string, string>)

Saves a set of configuration data to the active connection (either a new or an existing connection). NOTE: Does not save the configuration data to the CRM database.

Declaration
public override Task<PluginResponseInfo> SaveConnectionAsync(Dictionary<string, string> connectionInfo)
Parameters
Type Name Description
Dictionary<string, string> connectionInfo
Returns
Type Description
Task<PluginResponseInfo>
Overrides
ConnectionHandlerFacadeBase.SaveConnectionAsync(Dictionary<string, string>)

SaveConnectionAsync(int, Guid, Dictionary<string, string>)

Saves a set of configuration data to a given connection (either a new or an existing connection). NOTE: Does not save the configuration data to the CRM database.

Declaration
public static Task<PluginResponseInfo> SaveConnectionAsync(int erpConnectorId, Guid connectionId, Dictionary<string, string> connectionInfo)
Parameters
Type Name Description
int erpConnectorId
Guid connectionId
Dictionary<string, string> connectionInfo
Returns
Type Description
Task<PluginResponseInfo>

SaveConnectionTimestampAsync(ErpSyncActor, CancellationToken)

If the timestamp of the given actor is larger than the currently stored timestamp from the database (ErpConnection row), the new timestamp is stored to the database.

Declaration
public override Task SaveConnectionTimestampAsync(ErpSyncActor act, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ErpSyncActor act
CancellationToken cancellationToken
Returns
Type Description
Task
Overrides
ConnectionHandlerFacadeBase.SaveConnectionTimestampAsync(ErpSyncActor, CancellationToken)

SearchActorByParentAsync(ErpActorType, string, ErpActorType, string)

Searches for actors with a specified parent actor using a given search string. Will use the field mapping for the given actor type and connection.

Declaration
public override Task<ErpSyncActor[]> SearchActorByParentAsync(ErpActorType actorType, string searchText, ErpActorType parentActorType, string parentActorErpKey)
Parameters
Type Name Description
ErpActorType actorType
string searchText
ErpActorType parentActorType
string parentActorErpKey
Returns
Type Description
Task<ErpSyncActor[]>
Overrides
ConnectionHandlerFacadeBase.SearchActorByParentAsync(ErpActorType, string, ErpActorType, string)

SearchActorByParentAsync(ErpActorType, string, ErpActorType, string, string[])

Searches for actors with a specified parent actor using a given search string. Will use the field mapping for the given actor type and connection.

Declaration
public Task<ErpSyncActor[]> SearchActorByParentAsync(ErpActorType actorType, string searchText, ErpActorType parentActorType, string parentActorErpKey, string[] returnFields)
Parameters
Type Name Description
ErpActorType actorType
string searchText
ErpActorType parentActorType
string parentActorErpKey
string[] returnFields
Returns
Type Description
Task<ErpSyncActor[]>

SearchActorsAsync(ErpActorType, ArchiveRestrictionInfo[], string[])

Extended search, with search restrictions and operators per field (using the ArchiveRestrictionInfo class).

Declaration
public Task<ErpSyncActor[]> SearchActorsAsync(ErpActorType actorType, ArchiveRestrictionInfo[] archiveRestrictions, string[] returnFields)
Parameters
Type Name Description
ErpActorType actorType
ArchiveRestrictionInfo[] archiveRestrictions
string[] returnFields
Returns
Type Description
Task<ErpSyncActor[]>

SearchActorsAsync(ErpActorType, string)

Searches for actors using a given search string. Will use the field mapping for the given actor type and connection to determine which fields to return

Declaration
public override Task<ErpSyncActor[]> SearchActorsAsync(ErpActorType actorType, string searchText)
Parameters
Type Name Description
ErpActorType actorType
string searchText
Returns
Type Description
Task<ErpSyncActor[]>
Overrides
ConnectionHandlerFacadeBase.SearchActorsAsync(ErpActorType, string)

SearchActorsAsync(ErpActorType, string, string[])

Searches for actors using a given search string, and asks the connector to return a given set of fields

Declaration
public override Task<ErpSyncActor[]> SearchActorsAsync(ErpActorType actorType, string searchText, string[] returnFields)
Parameters
Type Name Description
ErpActorType actorType
string searchText
string[] returnFields
Returns
Type Description
Task<ErpSyncActor[]>
Overrides
ConnectionHandlerFacadeBase.SearchActorsAsync(ErpActorType, string, string[])

SetConnectionIdAsync(Guid)

Get or set (set method is protected) the external connection ID for the connection handler. If set, it will use this to find its own internal ID (database key)

Declaration
protected override Task SetConnectionIdAsync(Guid value)
Parameters
Type Name Description
Guid value
Returns
Type Description
Task
Overrides
ConnectionHandlerFacadeBase.SetConnectionIdAsync(Guid)

SetErpConnectionIdAsync(int)

Get or set (set method is protected) the internal connection ID (database key) for the connection handler. If set, it will use this to find its own external ID

Declaration
protected override Task SetErpConnectionIdAsync(int value)
Parameters
Type Name Description
int value
Returns
Type Description
Task
Overrides
ConnectionHandlerFacadeBase.SetErpConnectionIdAsync(int)

SupportsAdvancedSearchAsync(ErpActorType)

A facade for the WCF calls to the actual connector

Declaration
public Task<bool> SupportsAdvancedSearchAsync(ErpActorType actorType)
Parameters
Type Name Description
ErpActorType actorType
Returns
Type Description
Task<bool>

TestConfigDataAsync(int, Dictionary<string, string>, CancellationToken)

Asks a given connector to check if a set of connection configuration data is valid.

Declaration
public static Task<PluginResponseInfo> TestConfigDataAsync(int connectorId, Dictionary<string, string> configData, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectorId

id which is mapped to a connection guid

Dictionary<string, string> configData

keys and values as defined by the GetConfigDataAsync(int, CancellationToken) call

CancellationToken cancellationToken
Returns
Type Description
Task<PluginResponseInfo>

Ok or error

TestConnectionAsync()

Asks the Connector to see if the connection is up and running, using the connector's own stored configuration data.

Declaration
public override Task<PluginResponseInfo> TestConnectionAsync()
Returns
Type Description
Task<PluginResponseInfo>
Overrides
ConnectionHandlerFacadeBase.TestConnectionAsync()

TestConnectorURLAsync(string, CancellationToken)

Checks an URL to see if there's a valid connector on the other side

Declaration
public static Task<PluginResponseInfo> TestConnectorURLAsync(string url, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string url
CancellationToken cancellationToken
Returns
Type Description
Task<PluginResponseInfo>

UpdateConnectionFieldsAsync()

Asks the connector about all supported fields for all supported actor types, and updates the relevant CRM tables (adds missing fields and updates existing ones)

Declaration
public Task UpdateConnectionFieldsAsync()
Returns
Type Description
Task
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top