Application Settings

Application Settings

ODataDB reads the configuration from the JSON configuration files like appsettings.json and appsettings.Production.json.

See details at JSON Configuration Provider.

Below is a default appsettings.json file:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "DefaultContainerName":  "default",
  "FunctionPrefixes": "xl_validation_list_, xl_parameter_values_",
  "FunctionSuffixes": "_select",
  "LanguageParameters": "data_language, DataLanguage"
}

Keys and sections:

Logging
See details at Logging Configuration.
DefaultContainerName
This value defines an entity container and its schema name.
FunctionPrefixes
This comma-separated value defines prefixes of stored procedure names to assign the function type instead of the default action type.
The default value contains prefixes for SaveToDB and ODataDB examples.
FunctionSuffixes
This comma-separated value defines suffixes of stored procedure names to assign the function type instead of the default action type.
The default value contains suffixes for SaveToDB and ODataDB examples.
LanguageParameters
This comma-separated value defines language context parameter names.
ODataDB does not publish such parameters in the model and passes two-character language values automatically.
ODataDB detects a language by a URL segment like /en-us/, /en-gb/, or just /en/.
The default value contains language-context parameters used by the SaveToDB add-in.

Below is a sample of appsettings.Production.json file:

{
  "Kestrel": {
    "EndPoints": {
      "Http": {
        "Url": "http://localhost:5002"
      }
    }
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning",
      "System": "Information",
      "Microsoft": "Information"
    }
  },
  "ApiRoot": "v4",
  "EditRoots": "edit trip-pin",
  "EditPages": {
    "edit": "edit.htm",
    "trip-pin": "edit-trip-pin.htm"
  },
  "MaxPageSize": 1000,
  "DisableMetadataCache": false,
  "ConnectionStrings": {
    "mssql": {
      "ProviderName": "System.Data.SqlClient",
      "ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=AzureDemo90;User ID=user;Pwd=pass"
    },
    "mssql-011": {
      "HiddenSchemas": "logs doc xls",
      "ProviderName": "System.Data.SqlClient",
      "ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=AzureDemo90;User ID=sample01_user1;Pwd=Usr_2011#_Xls4168"
    }
  }
}

Keys and sections:

Kestrel
See details at Kestrel web server implementation in ASP.NET Core.
Use it to change the endpoint port.
Logging
See details at Logging Configuration.
ApiRoot
This value defines an API root, like 'v4' in the /v4/mssql/ endpoint.
The value is common for all endpoints.
EditRoots
This space-separated value defines edit roots, like 'edit' in the /edit/mssql/ endpoint.
EditPages
This dictionary defines HTML pages for edit roots.
For example, ODataDB returns the edit.htm page content for the /edit/mssql/ endpoint.
MaxPageSize
This value defines a maximum number of records returned in on response.
DisableMetadataCache
This value allows disabling the metadata model cache. Developers may use it to load the model from a database every time.
ConnectionStrings
This dictionary defines connection names and related connection strings.
ODataDB uses connection names to configure endpoints. For example, the sample defines base endpoints like /v4/mssql/ and /v4/mssql-011/.
ProviderName
This value defines a provider name.
ConnectionString
This value defines a connection string.
Use a real username and password or the 'user' and 'pass' placeholders.
In the last case, ODataDB requires a username and password when a user connects to the endpoint.
HiddenSchemas
This space-separated value defines a list of schemas not to advertise their objects in the service document.