-
-
Notifications
You must be signed in to change notification settings - Fork 42
Configuration
This wiki page documents the configuration options available for
MartinCostello.SqlLocalDb
.
Note: New settings are documented as they are added, so may not be available in the current released version. Where this is the case, it is noted.
The default options for SqlLocalDbOptions
are equivalent to the below code
snippet.
var options = new SqlLocalDbOptions
{
AutomaticallyDeleteInstanceFiles = false,
Language = null,
NativeApiOverrideVersion = "",
StopOptions = StopInstanceOptions.None,
StopTimeout = TimeSpan.FromMinutes(1)
};
These values apply to creating an instance of SqlLocalDbOptions
using the
default constructor as well as creating an instance of SqlLocalDbApi
using the
SqlLocalDbApi(ILoggerFactory loggerFactory)
constructor.
The AutomaticallyDeleteInstanceFiles
property determines whether the files on
disk associated with SQL Server LocalDB instances are deleted when an instance
is deleted.
By default SQL Server LocalDB leaves files associated with instances on disk after the instance itself is deleted using the SQL Server LocalDB Instance API.
Instance file deletion is performed on a best attempt basis - any files that are locked or otherwise unable to be deleted are left on disk as-is.
Enabling this option will cause the library to delete all files stored in %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Local DB\Instances
that are associated with a SQL Server LocalDB instance being deleted.
The Language
property sets the culture used for format error messages from the
SQL Server LocalDB Instance API if the default value (generally the Windows
defaults) are undesirable.
Any value that can be parsed to create a CultureInfo
instance is supported,
but standard culture codes are recommended (e.g. en-US
, fr-FR
etc.).
No validation is performed on whether the value specified is supported by the
SQL Server LocalDB Instance API itself, so values chosen by the user may cause
errors when the Language
property's locale ID (LCID
) is used at runtime.
By default MartinCostello.SqlLocalDb
loads the highest available version of
the SQL Server LocalDB Instance API library found by enumerating the Windows
Registry. If a specific version of the library is desired, use this property to
specify the version number needed.
If the version specified is not available, a warning will be logged and the highest available version will be loaded instead.
The StopOptions
property specifies the behaviour used when stopping instances
using the SQL Server LocalDB Instance API. By default, the Instance API waits
for the instance to stop and the process hosting the LocalDB instance to exit.
To alter this behaviour, specify values as bitwise flags from the
StopInstanceOptions
enumeration.
Supported values are:
-
KillProcess
(maps to theLOCALDB_SHUTDOWN_KILL_PROCESS
flag) -
NoWait
(maps to theLOCALDB_SHUTDOWN_WITH_NOWAIT
flag)
The StopTimeout
property specifies the maximum amount of time the SQL Server
Instance API will wait for a LocalDB instance to stop before the native function
call returns.
This behaviour can be changed by specifying a non-negative TimeSpan
value.
Whilst this setting is a TimeSpan
, the resolution of the value is only used to
a granularity of seconds.