DBGate Application Settings
DBGate reads the configuration from the JSON configuration files like appsettings.json and appsettings.Production.json.
See details at JSON Configuration Provider.
The appsettings.json file can be empty:
{ }
Keys and sections:
- Logging
- See details at Logging Configuration.
Below is a sample of the appsettings.Production.json file:
{ "AllowedHosts": "*", "Kestrel": { "EndPoints": { "Http": { "Url": "http://localhost:5003" } } }, "Logging": { "LogLevel": { "Default": "Warning", "System": "Information", "Microsoft": "Information" } }, "DBGate": { "WebRoot": "wwwroot", "ApiRoot": "v4", "EditRoots": "edit", "EditPages": { "edit": "edit.htm" }, "MaxPageSize": 1000, "UppercaseNamesInLowercase": true, "DisableMetadataCache": false, "DisableEditPageCache": false, "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 }, "DBGateW": { "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-201": { "Offline": false, "Home": "en-us/sample20.htm", "QueryList": "", "HiddenSchemas": "logs doc xls", "ProviderName": "System.Data.SqlClient", "ConnectionString": "Data Source=mssql.savetodb.com;Initial Catalog=AzureDemo100;User ID=sample20_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.
- DBGate
- This group contains DBGate settings.
- DBGateW
- This group overrides settings for DBGate 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 'api' in the /api/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, DBGate 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.
DBGate leaves mixed-case names as is. - 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. - 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 DBGate 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 DBGate examples. - LanguageParameters
- This comma-separated value defines language context parameter names.
DBGate does not publish such parameters in the model and passes two-character language values automatically.
DBGate 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 /api/$stop request.
- ConnectionStrings
- This dictionary defines connection names and related connection strings.
DBGate uses connection names to configure endpoints. For example, the sample defines base endpoints like /api/mssql/ and /api/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, DBGate 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.
DBGate immediately returns an offline message without trying to connect to the database. - Home
- This value allows setting the homepage.
DBGate 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.