We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.
All documentation
  • Introduction
  • Connecting to data source
    1. Supported data sources
    2. Connecting to other data sources
  • Browser compatibility
  • Documentation for older versions
  • Getting started with the Data Server as a DLL

    Flexmonster Data Server can be embedded into your project as a DLL — a separate flexible module. You can download the Data Server DLL from NuGet.

    The advantages of using the Data Server as a DLL are the following:

    • No need to launch the executable file.
    • Easy software updates.
    • Can be customized to fit different server architectures and use cases.
    • Can be used to connect to any data source using your custom parser.
    • Security can be configured according to a necessary standard.
    • Data can be filtered on the server using custom conditions sent from the client.
      For example, access to certain data can be restricted using custom roles.
    • Available for Windows (32-bit and 64-bit), macOS (64-bit and ARM64), and Ubuntu/Linux (64-bit and ARM64).

    For a quick start with Flexmonster Data Server as a DLL, have a look at the sample .NET Core application with the Data Server embedded. 

    To embed Flexmonster Data Server into an existing or new .NET Core application, follow this guide: Referencing the Data Server as a DLL.

    Integration example

    Flexmonster.DataServer.Core.dll is a flexible solution that can be used in many ways. To demonstrate how the Data Server can be used, we created an ASP.NET Core application with a custom server using Flexmonster.DataServer.Core.dll

    The application repository contains a solution file DemoDataServerCore.sln, so the sample can be opened and launched with Visual Studio.

    Prerequisites

    Step 1. Run the sample project

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

    git clone https://github.com/flexmonster/flexmonster-data-server-dll
    cd flexmonster-data-server-dll

    Step 1.2. Then, start the sample application with the following commands:

    cd DemoDataServerCore
    dotnet restore
    dotnet run

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

    Step 2. Check out the project's structure

    Our sample project is based on an ASP .NET Core Web template project, so most of the project’s files are the same as in the template. 

    Now take a look at the files in the DemoDataServerCore/ folder specific to our sample project:

    Server

    • Controllers/ — API controllers used for handling web API requests:
      • Flexmonster API controller (FlexmonsterAPIController.cs)
        Also contains server filter configurations.
    • CustomParser.cs — a custom parser that demonstrates how to connect to your own data source.
    • Startup.cs — configures services and the app's request pipeline.
    • appsettings.json — contains the project's settings, including configurations for the Data Server as a DLL.

    Client

    • Views/ — HTML templates with embedded Razor markup:
      • Homepage with a container for Flexmonster Pivot (Home/index.cshtml)
    • wwwroot/ — the app's Web Root folder containing the project's public static assets:
      • Configurations for Flexmonster Pivot (js/site.js)

    Use cases

    Role-based access to data using a server filter

    With Flexmonster.DataServer.Core.dll, you can restrict access to the data to certain roles using the server filter. On the http://localhost:5000/ page, there is a pivot table and a dropdown menu. Select a role from the menu to see how it affects the data shown in Flexmonster Pivot.

    To see how the server-side filtering is implemented in the sample server, refer to the FlexmonsterAPIController.cs file.

    To learn more about the server filter, read through the Implementing the server filter guide.

    Custom parser for connecting to any data source

    This custom server also demonstrates how to load data from a custom data source. To work with a custom data source, implement an appropriate parser for the data. An example of a custom parser is shown in this CustomParser.cs file.

    In the sample project, the data shown on the grid is from the custom parser, but "csv", "json", and "database" parser types can also be used. To make the server use multiple parsers, add a new object to the DataSources property in the appsettings.json file. For example:

    "DataSources": [
      {
        "Type": "custom",
        "Indexes": {
          "custom-index": null
        }
      }, 
      {
        "Type": "json",
        "Indexes": {
          "json-index": {
            "Path": "data.json"
        }
      }
    ],

    To learn more about the custom parser, see the Implementing the custom parser guide.

    What's next?

    You may be interested in the following articles: