Click or drag to resize

IDataProviderConnect Method

Request connection to the views service.

Namespace: AxiomCore2.Data
Assembly: Canary.Axiom.Session (in Canary.Axiom.Session.exe) Version: 25.6.0.25344+3070493948bf7d32a86bd3e9a8bcf4cc9a5b1929
Syntax
C#
void Connect(
	string server,
	Action<ConnectResult> action
)

Parameters

server  String
Server to connect to.
action  ActionConnectResult
Action to perform after a successful connection.
Example

Get connection to views service and retrieve aggregates.

C#
// NOTE: add this to using statements
using CanaryWebServiceHelper.HistorianWebService;

string serverName = "ServerName"; // replace with your server name
DataProvider.Connect(serverName, (connectResult) => {
    if (connectResult.IsConnected)
    {
        // see views documentation for information about view client interface
        var client = connectResult.Client;
        var aggregates = client.GetAggregateList4();
    }
    else
    {
        ClientLog.Warn($"Failed to connect to server '{serverName}'.");
    }
});
See Also