ODataDB Application Settings
ODataDB reads the configuration from the JSON configuration files like appsettings.json and appsettings.Production.json.
The appsettings.json file contains settings for all environments. The appsettings.Production.json file contains settings for the Production environment.
See details at JSON Configuration Provider.
The appsettings.json file can be empty:
{ }
Below is a sample of the appsettings.Production.json file:
{ "AllowedHosts": "*", "Kestrel": { "EndPoints": { "Http": { "Url": "http://localhost:5002" } } }, "Logging": { "LogLevel": { "Default": "Warning", "System": "Information", "Microsoft": "Information" } }, "ODataDB": { "WebRoot": "wwwroot", "ApiRoot": "v4", "EditRoots": "edit", "EditPages": { "edit": "edit.htm" }, "MaxPageSize": 1000, "UppercaseNamesInLowercase": true, "DefaultContainerName": "default", "DisableMetadataCache": false, "DisableEditPageCache": false, "IncludeAnnotations": true, "PublishConfigurationObjects": true, "PublishEditProcedures": true, "EnableCodeBrowser": true, "BinaryAsHex": false, "BigNumbersAsString": false, "FunctionPrefixes": "xl_validation_list_, xl_parameter_values_", "FunctionSuffixes": "_select", "LanguageParameters": "data_language, DataLanguage" "TraceSQL": true, "StopEnabled": false }, "ODataDBW": { "WebRoot": "wwwroot", "StopEnabled": true }, "ConnectionStrings": { "mssql": { "AllowDatabaseChange": true, "ProviderName": "System.Data.SqlClient", "ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=master;User ID=user;Pwd=pass" }, "mssql-011": { "Offline": false, "Home": "en-us/sample01.htm", "QueryList": "", "HiddenSchemas": "logs doc xls", "ProviderName": "System.Data.SqlClient", "ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=AzureDemo100;User ID=sample01_user1;Pwd=Usr_2011#_Xls4168" } } }
Keys and sections:
- AllowedHosts
- See details at Host filtering with ASP.NET Core Kestrel web server.
Use * to serve all endpoints. - 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.
- ODataDB
- This group contains ODataDB settings.
- ODataDBW
- This group overrides settings for ODataDB for .NET Framework.
It can contains the WebRoot and StopEnabled settings only. - WebRoot
- This value defines a folder with website contents.
The default value is "wwwroot". - 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 the maximum number of records returned in the response.
- UppercaseNamesInLowercase
- This value enables converting uppercase object and column names to lowercase.
ODataDB leaves mixed-case names as is. - DefaultContainerName
- This value defines an entity container and its schema name.
- DisableMetadataCache
- This value allows disabling the metadata model cache.
Developers can use it to load the model from a database every time.
Note that you can use the URL system parameter $reloadMetadata=true instead. - DisableEditPageCache
- This value allows disabling the edit page cache.
Developers can use it when developing edit pages. - IncludeAnnotations
- This value allows disabling the $metadata annotations.
The built-in ODataDB client does not depend on this option. - PublishConfigurationObjects
- This value enables publishing configuration objects like xls.objects, xls.handlers and other objects of the SaveToDB Framework.
The default value is false. - PublishEditProcedures
- This value enables publishing edit procedures like usp_cashbook2_insert, usp_cashbook2_update, and usp_cashbook2_delete.
The default value is false. - EnableCodeBrowser
- This value allows getting object definitions using the /$definition URL segment.
The default value is false. - BinaryAsHex
- This value allows serializing binary data as hex strings by default contrary to base64.
Note that you can use the URL system parameter $binaryAsHex=true instead. - BigNumbersAsString
- This value allows serializing big numbers that lose precision in JavaScript as strings.
Note that you can use the URL system parameter $bigNumbersAsString=true instead. - FunctionPrefixes
- This comma-separated value defines prefixes of stored procedure names to assign the function type instead of the default action type.
The used 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 used 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 used value contains language-context parameters used by the SaveToDB add-in. - TraceSQL
- This value enables SQL command tracing.
- StopEnabled
- This value allows stopping the application using the /v4/$stop request.
- 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. - AllowDatabaseChange
- This value allows changing a database via the connection name in URL in the form like <connection>:<database>.
For example, a user can use the URL like /edit/mssql:AzureDemo100/ to connect to the AzureDemo100 database.
The default value is false. - Offline
- This value allows disabling the endpoint.
ODataDB immediately returns an offline message without trying to connect to the database. - Home
- This value allows setting the homepage.
ODataDB redirects to it when a user clicks the Home button.
To open the default page, hold the Ctrl key while clicking the Home button. - QueryList
- This value defines a view in the SaveToDB QueryList format to advertise the view objects only in the service document.
Use this feature to configure the entity container and keep the service root clear. - HiddenSchemas
- This space-separated value defines a list of schemas not to advertise their objects in the service document.