Getting started with the .NET API

Contents[Hide]

1. Overview

This article demonstrates how to use the Dundas BI .NET API in a new or existing Visual Studio project.

2. Prerequisites

  • A version of Microsoft .NET compatible with your version of Dundas BI.
  • This article describes using Visual Studio as your IDE.

Dundas BI version 9 and below installed on Windows use the .NET Framework, while version 10 and higher and all other platforms use .NET Core, now also known as simply .NET. For more details, check the system requirements for your version of Dundas BI.

3. Setup

  • With your project open in Visual Studio, right-click References or Dependencies in the Solution Explorer.
  • The most common package or assembly to use is Dundas.BI.Core, which includes the Dundas BI Engine and various services you may wish to access. You may also be accessing types from one of the other two assemblies as listed in the .NET API Reference Language Reference.

Referencing Dundas BI assemblies
Referencing Dundas BI assemblies

4. Start the engine

We can start up the Dundas BI Engine using the .NET API as demonstrated with the sample code below.

The AppDataPath property must be set to the path to the App_Data folder of the Dundas BI web application. The article List of installed folders provides more details. Then the ILogOnService.LogOn method is called without a session in order to obtain one.

// Create the CreateEngineOptions object.
CreateEngineOptions createEngineOptions = new CreateEngineOptions();
// Path to the application's data folder. Type: System.String
createEngineOptions.AppDataPath = appDataPath;

EngineManager.CreateEngine(createEngineOptions);

EngineManager.StartEngine();

using (Engine.Current.GetService<ICallerContextService>().CreateAndSetCurrentContext(null))
{
    LogOnResult logOnResult = Engine.Current.GetService<ILogOnService>().LogOn(
        // The account name. Type: String
        accountName, 
        // The password. Type: String
        password, 
        // Delete other logon sessions for the logon to succeed. Type: Boolean
        deleteOtherSessions, 
        // Culture to associate with the logon session, or null. Type: CultureInfo
        explicitCulture
    );

    Engine.Current.GetService<ICallerContextService>().CurrentContext.SetCurrentSessionId(
        logOnResult.Session.Id
    );

    // Now you can access services as the logged on user.
}

5. See also

Dundas Data Visualization, Inc.
400-15 Gervais Drive
Toronto, ON, Canada
M3C 1Y8

North America: 1.800.463.1492
International: 1.416.467.5100

Dundas Support Hours:
Phone: 9am-6pm, ET, Mon-Fri
Email: 7am-6pm, ET, Mon-Fri