☝️Small business or a startup? See if you qualify for our special offer.
+
All documentation
Connecting to data source
  1. Supported data sources
  2. Connecting to other data sources

Referencing the Accelerator as a DLL

Flexmonster Accelerator can be integrated into your website's back end as a separate ASP.NET controller. The main benefits of referencing the Accelerator as a DLL directly from the ASP.NET project are:

  • No need to run an installer.
  • Easy to update to the latest version.
  • No firewall settings.
  • No dependency on Microsoft Windows services.

Prerequisites

Run a sample project from GitHub

Follow the steps below to run a sample application demonstrating how to use Flexmonster Accelerator as a DLL:

Step 1. To get our sample project, download it as ZIP or clone it with the following command:

git clone https://github.com/flexmonster/pivot-accelerator-dll

Step 2. Open the project in Visual Studio using the pivot-accelerator-dll/Flexmonster Accelerator MVC.sln file.

Step 3. Run the project by selecting the IIS Express button on the toolbar:

The IIS Express button on the toolbar

To see the result, open http://localhost:55158/ in your browser.

Integrate Flexmonster Accelerator into an existing project

Follow the steps below to integrate Flexmonster Accelerator into an existing ASP.NET project:

Step 1. Install Flexmonster Accelerator

Install the Flexmonster.Accelerator package with NuGet — Visual Studio's package manager:

  1. Open the project's context menu and select the Manage NuGet Packages item:
    Screenshot shows how to find the Manage NuGet Packages item in the project's context menu
  2. In the Browse tab, search for the Flexmonster.Accelerator package and install it:
    The screenshot shows how to find the Flexmonster.Accelerator package and install it

Step 2. Create a controller for the Accelerator

Inside the Controllers/ folder, create an AcceleratorController class that extends FlexmonsterProxyController. This class will handle Flexmonster Pivot’s requests to the Accelerator:

using Flexmonster.Accelerator.Models;

public class AcceleratorController :
Flexmonster.Accelerator.Controllers.FlexmonsterProxyController {
public override void OnRequest(BaseArgs args) {
base.OnRequest(args);
}
}

Check out how the AcceleratorController class is implemented in our GitHub sample project.

Step 3. Provide connection information

Specify the connection string to your SSAS cube for the Accelerator. It can be done inside the Application_Start() method of the Global.asax.cs file:

protected void Application_Start()
{
// Other configs
Flexmonster.Accelerator.Controllers.FlexmonsterProxyController
.ConnectionString = "Data Source=<your data source>";
}

If you are connecting to Azure Analysis Services, specify the authentication info in addition to the connection string:

protected void Application_Start()
{
// Other configs
Flexmonster.Accelerator.Controllers.FlexmonsterProxyController
.ConnectionString = "Data Source=asazure://aspaas.asazure.windows.net/myserver";

Flexmonster.Accelerator.Controllers.FlexmonsterProxyController
.AuthHelper = new AzureAuthHelper(
// ResourceURL
// Must match the region from the data source specified in the ConnectionString
"https://aspaas.asazure.windows.net",
// AzureAuthority
"https://login.microsoftonline.com/<your_azure_domain>",
// AzureClientId
"00000000-0000-0000-0000-000000000000",
// AzureClientSecret
"XXXXXXXXXXXXX"
);
}

Learn more about the AzureAuthHelper class.

Note To separate the Accelerator’s configurations from other code, you can create a class with a static method where all the configurations will be set. Then, call this method in Application_Start(). We used this approach in our sample GitHub project. Open FlexmonsterConfig.cs and Global.asax.cs files to see the example.

Step 4. (optional) Configure caching for the Accelerator

You can enable caching for the Accelerator and set a cache memory limit using CacheManager.Enabled and CacheManager.MemoryLimit properties. For example:

protected void Application_Start()
{
// Other configs
Flexmonster.Accelerator.Controllers.FlexmonsterProxyController
.ConnectionString = "Data Source=<your data source>";

Flexmonster.Accelerator.Utils.CacheManager.Enabled = true;
Flexmonster.Accelerator.Utils.CacheManager
.MemoryLimit = 10 * 1024 * 1024; // MB to bytes
}

Learn more about the Accelerator’s configurations.

Step 5. Run your server

Run your server with the Accelerator from Visual Studio.

Step 6. Embed Flexmonster Pivot into your webpage

If Flexmonster is not yet embedded, set up an empty component in your webpage:

In pure JavaScript

Complete the Integrating Flexmonster guide. Your code should look similar to the following example:

const pivot = new Flexmonster({
  container: "pivotContainer",
 toolbar: true
});

In React

Complete the Integration with React guide. Your code should look similar to the following example:

<FlexmonsterReact.Pivot
 toolbar={true}
/>

In Angular

Complete the Integration with Angular guide. Your code should look similar to the following example:

<fm-pivot
 [toolbar]="true">
</fm-pivot>

In Vue

Complete the Integration with Vue guide. Your code should look similar to the following example:

<Pivot
 toolbar
/>

Step 7. Configure the report

Create a report where the proxyUrlcatalog, and cube parameters are set to your specific values:

const pivot = new Flexmonster({
container: "pivotContainer",
toolbar: true,
report: {
dataSource: {
type: "microsoft analysis services",
// Flag to use the Accelerator instead of XMLA
binary: true,
// URL to Flexmonster Accelerator
proxyUrl: "http://localhost:50005",
// Catalog name for multidimensional models
// Database name for tabular models
catalog: "Adventure Works DW Standard Edition",
// Cube name for multidimensional models
// Model name for tabular models
cube: "Adventure Works"
}
}
});

See the full list of Flexmonster properties that you can use in the dataSource object.

Now open the webpage in the browser to see the pivot table with your SSAS data.

Available Accelerator configurations

Property/TypeDescription
ConnectionString
String
The connection string for Microsoft Analysis Services. Example: Data Source=localhost;.
Access this property through the Flexmonster.Accelerator.Controllers.FlexmonsterProxyController object.
CacheManager.Enabled
Boolean
optional Specifies whether caching is enabled.
Access this property through the Flexmonster.Accelerator.Utils object.
Default value: true (caching is enabled).
CacheManager.MemoryLimit
Integer
optional The maximum memory size available for caching (in bytes).
Access this property through the Flexmonster.Accelerator.Utils object.
Default value: 0 (unlimited).
AuthHelper
AzureAuthHelper
optional Required when connecting to Azure Analysis Services. Sets authentication parameters for Azure Analysis Services.
Access this property through the Flexmonster.Accelerator.Controllers.FlexmonsterProxyController object.

AzureAuthHelper class

This class is necessary when connecting to Azure Analysis Services. Its constructor has the following parameters:

Parameter/TypeDescription
ResourceURL
String
The URL of your Azure Analysis Services instance. Must be specified as https://<domain name>, where <domain name> is the region from the data source specified in the connection string. Example: https://aspaas.asazure.windows.net.
AzureAuthority
String
The Azure authority URL (e.g., https://login.microsoftonline.com/<your_domain>). Learn more in the Microsoft guide.
AzureClientId
String
The client ID of the service principal registered in Azure Active Directory.
AzureClientSecret
String
The client secret of the service principal registered in Azure Active Directory.

Enable logging

By default, logging is disabled in the Accelerator as a DLL. To enable logging, you need to implement the Flexmonster.Accelerator.Utils.ILogger interface:

Step 1. In your project, create a C# class for the logger (e.g., MyLogger.cs).

Step 2. Open the created file (e.g., MyLogger.cs) and import Flexmonster.Accelerator.Utils:

using Flexmonster.Accelerator.Utils;

Step 3. Implement the Flexmonster.Accelerator.Utils.ILogger interface by implementing the Error, Info, Trace, and Warn methods. Your code should look similar to the following:

using Flexmonster.Accelerator.Utils;

namespace Project_Namespace
{
public class MyLogger : ILogger
{
public void Error(string message)
{
System.Diagnostics.Debug.WriteLine(message);
}

public void Error(string message, params object[] args)
{
System.Diagnostics.Debug.WriteLine(message);
}

// Info, Trace, and Warn methods can be implemented similarly
}
}

Notice that the Error method is overloaded, so it is implemented twice. The same applies to Info, Trace, and Warn methods. Overall, you should have eight methods implemented in your class.

Step 4. Go to the file where the Accelerator is configured (e.g., Global.asax.cs) and add your logger implementation to other Accelerator configs:

protected void Application_Start()
{
// Other configs
Flexmonster.Accelerator.Controllers.FlexmonsterProxyController
.ConnectionString = "Data Source=<your data source>";

Flexmonster.Accelerator.Utils.LoggerLocator.SetLogger(new MyLogger());
}

Logging is now enabled for the Accelerator as a DLL.

See also