Get Free Trial
  1. API reference
Connecting to Data Source
  1. Supported data sources
  2. Connecting to other data sources
Configuring the component
  • Documentation for older versions
  • Table of contents

    DLL configurations reference

    This guide describes the available options for Flexmonster.DataServer.Core.dll. For the Data Server DLL, it is possible to configure data sources and set the data refresh time.

    Available configurations

    Flexmonster.DataServer.Core.dll can be configured via the ASP.NET configuration file (e.g., appsettings.json). In addition to the Flexmonster Data Server configuration, it can contain any other settings needed for the project, as long as they do not conflict with each other. The Data Server configuration has the following properties:

    • "DataSources" – Array of objects. Options for configuring the data sources. Each object has the following properties:
      • "Type" – String. The type of the data source: "json", "csv", "database", or your custom type (for the custom parser).
      • "DatabaseType" optional – String. The type of the database: "mysql", "mssql", "postgresql", or "oracle". Only for the "database" data source type.
      • "ConnectionString" optional – String. A connection string for the database. Only for the "database" data source type.
      • "Indexes" – Object. Contains a list of datasets. Each dataset is represented by a "key": "value" pair, where "key" is a dataset name, and "value" is an object. The "value" can either be null (only for the custom data source type) or have the following properties:
        • "Path" optional – String. The path to the file with data. Only for "json" and "csv" data source types.
        • "Query" optional – String. The query to execute (e.g., "SELECT * FROM tablename"). It can contain a stored procedure. Only for the "database" data source type.
        • "Delimiter" optional – String. Defines the specific fields separator to split each CSV row. There is no need to define it if the CSV fields are separated by ,. This property is required only if another character separates fields. Default value: ",".
        • "DecimalSeparator" optional – String. Defines the specific character used to separate decimal parts of numbers. For example, to import CSV data with commas used to separate decimal parts of numbers (e.g., 3,14), set the "DecimalSeparator" property to ","Default value: ".".
        • "ThousandsSeparator" optional – String. Defines the specific character used to separate groups of digits in numbers. For example, to import CSV data with periods used to separate groups of digits in numbers (e.g., 1.000 for one thousand), set the "ThousandsSeparator" property to "."Default value: ",".
    • "DataStorageOptions" optional – Object. Allows configuring options for data storage. It has the following properties:
      • "DataRefreshTime" optional – Number. Defines how often the data is reloaded from a file or a database. The refresh time is set in minutes. If "DataRefreshTime" is not specified, the data will not be reloaded.
      • "CacheSizeLimit" optional – Number. The maximum number of cached server responses for every index defined in the "DataSources" property. When set to 0, the Data Server does not cache the responses. Default value: 100.

    Example

    Here is an example of a configured appsettings.json file with the custom parser:

    {
    "DataSources": [
    {
    "Type": "custom-parser",
    "Indexes": {
    "custom-index": null
    }
    },
    {
    "Type": "json",
    "Indexes": {
    "first-json-index": {
    "Path": "data/data.json"
    },
    "second-json-index": {
    "Path": "data/another-data.json"
    }
    }
    },
    {
    "Type": "csv",
    "Indexes": {
    "csv-index": {
    "Path": "data/data.csv",
    "Delimiter": ";",
    "DecimalSeparator": "."
    }
    }
    }
    ],
    "DataStorageOptions": {
    "DataRefreshTime": 60,
    "CacheSizeLimit": 150
    }
    }

    What’s next?

    You may be interested in the following articles: