Getting started with the .NET API
1. Overview
This article demonstrates how to use the Dundas BI .NET API in a new or existing Visual Studio project.
2. Prerequisites
- Microsoft Visual Studio Microsoft .NET Framework 4.5
- You must be a member of the System Administrators group in Dundas BI
3. Setup
- Open a new or existing Visual Studio project
- In the Solution Explorer, right click on References and Add Reference
- Select Browse on the Reference Manager
- Locate the Dundas BI sdk bin folder here:
\Program Files\Dundas Data Visualization Inc\Dundas BI\Instances\[instance name]\sdk\bin - Select all three files found here and Add them to the Reference folder
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.
// 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(); Engine.Current.GetService<ICallerContextService>().CreateAndSetCurrentContext(null); LogOnResult logOnResult = Engine.Current.GetService<ILogOnService>().LogOn( // The account name. Type: System.String accountName, // The password. Type: System.String password, // Delete other logon sessions for the logon to succeed. Type: System.Boolean deleteOtherSessions, // Culture to associate with the logon session, or null. Type: System.Globalization.CultureInfo explicitCulture ); Engine.Current.GetService<ICallerContextService>().CurrentContext.SetCurrentSessionId( logOnResult.Session.Id );