Sage API

Overview

These public interfaces are used in Sage components. They are provided for implementing advanced functionality in your scripts. In order for you to use these interfaces in your project, you have to reference CozyRoc.SSISPlus.dll and Sage.SData.Client.dll libraries. Also include CozyRoc.SqlServer.SSIS and CozyRoc.Sage namespaces.

IConnection / ISageConnection

When you call Sage Connection Manager AcquireConnection method, it returns object implementing IConnection interface. This is the interface used for interaction with Sage SData service.

Connect method

Connects to Sage SData service. The method result is object implementing ISDataService interface.

Close method

Closes the connection to Sage SData service. Use always after you finish working with the service.

IsConnected method

Returns true if connected to the service.

GetEntityList method

Gets entity list for specific operation. These are the method parameters:

  • operation (uint) – It can be one of the options listed in the following table.

    Value Description
    0 Return entities, which can be read.
    1 Return entities, which support record creation/update.
    2 Return entities, which can be deleted.

GetCompositeEntityList method (1.6 SR-1)

Gets specified entity composite entities list. These are the method parameters:

  • root (string) – entity name.

GetEntity method

Get object used to manipulate Sage SData entity. The method returns IEntity object. These are the method parameters:

  • name (string) – entity name.

ServerHost property (string)

Specify the name or IP address of the Sage SData server.

ApplicationName property (string)

Specify application identifier.

ContractName property (string)

Specify contract identifier.

DataSet property (string)

Specify dataset.

ServerUser property (string)

Specify user name to access the Sage SData service.

ServerPassword property (string)

Specify user password to access the Sage SData service.

ServerTimeout property (int)

Specify the number of seconds before timing out session connect. The default value of this property is 100 seconds.

RetainSameConnection property (bool)

Specify if all clients should use the same connection. This property has the options listed in the following table.

Value Description
True All clients use same connection (default).
False Every client uses different connection.

ProxyHost property (string)

Specify the name or IP address of the proxy server.

ProxyPort property (int)

Specify the port number on the proxy server to use for the connection.

ProxyUser property (string)

Specify user name to access the proxy server.

ProxyPassword property (string)

Specify password to access the proxy server.

IProperty / ISageProperty

This interface is used to retrieve Sage SData property information.

Name property (string)

Returns property name.

IsKey property (bool)

Returns true if property is entity key.

IsReadOnly property (bool)

Returns true if property is read-only.

PropertyType property (DataType)

Returns property type.

Length property (int)

Returns property length.

Precision property (int)

Returns property precision.

Scale property (int)

Returns property scale.

RawPropery property (object)

Returns internal SDataSchemaValueProperty object.

IEntity / ISageEntity

This interface is used for Sage SData entity management.

GetProperties method

Get entity properties. The method returns array of IProperty objects.

NewEntity method

Constructs in-memory entity (AtomEntry) instance.

SetPropertyValue method

Sets property value in in-memory entity. These are the method parameters:

  • entity (object) – in-memory entity instance.
  • property (string) – property name.
  • value (string) – property value.

GetPropertyValue method

Returns property value from in-memory object. These are the method parameters:

  • entity (object) – in-memory entity instance.
  • property (string) – property name.

Read method

Retrieves data from Sage SData service. The result is IEnumerable object. These are the method parameters:

  • query (object) – If data is retrieved from regular Sage entity, the query parameter should contain list of SData query parameters. Multiple parameters are separated with newline. If data is retrieved from composite entity, the query parameter should contain entity identifier or object. Multiple identifiers are separated with semicolon (;).
  • batchSize (int) – batch size.

Create method

Creates record(s) in entity. The result is a list of newly created records key. If record creation fails, error code is reported instead. These are the method parameters:

  • entity (object) – single entity or list of entities.

Update method

Updates existing record(s) in entity. The result is a list of updated records key. If record update fails, error code is reported instead. These are the method parameters:

  • entity (object) – single entity or list of entities.

UpdateComposite method

Updates existing records in composite entity. These are the method parameters:

  • entity (object) – Sage entity object.
  • id (string) – entity identifier. Multiple identifiers are separated with semicolon (;).
  • list (object array) – array of Sage entity objects with update data.

Delete method

Deletes record(s) in object. The result is a list of deleted records key. If record deletion fails, error code is reported instead. These are the method parameters:

  • id (object) – single entity or list of entities.

Name property (string)

Returns the entity name.

IsComposite property (bool)

Returns true if composite entity.