-
-
Notifications
You must be signed in to change notification settings - Fork 43
Home
The System.Data.SqlLocalDb
assembly provides a managed .NET API for calling the native C/C++ API of Microsoft SQL Server LocalDB.
This makes it easy for .NET projects to use SQL LocalDB to more easily perform lightweight operations with SQL Server where access to a full installation of Microsoft SQL Server (Express) is either unavailable or undesirable.
For example, the primary motivation for this assembly to be created in the first place was to allow for use of SQL LocalDB instances to test .NET code for SQL Server-based data access in continuous integration test scenarios where I wanted to remove the overhead of maintaining an SQL Server instance on which to run such tests.
The assembly exposes all of the features of the SQL Server Express LocalDB Instance API as well as other convenience methods to provide a more object-oriented API that that of the native API. Other functionality is included to make it easy to connect to instances and use them, such as for manipulating connection strings.
The assembly targets .NET 2.0, so is supported for use in projects targeting .NET 2.0 and later. Both the 2012 and 2014 versions of Microsoft SQL Server LocalDB are supported by the assembly.
In the majority of cases, no additional configuration is required to use the assembly to manage SQL LocalDB instances.
The default behavior of SQL LocalDB, however, is to keep the files on-disk (such as logs) that are generated by SQL LocalDB instances during the existence. In a continuous integration usage scenario, where instances are frequently created and deleted, this may create large number of redundant files on the local file system that use up large amounts of disk space.
Since v1.11.0.0 it has been possible to change this behavior programmatically via the API surface.
From v1.13.0.0 it is possible to configure this behavior for the entire consuming application using the <system.data.sqlLocalDb>
configuration section. This is the recommended way to setup the assembly for such a usage scenario.
For further details about configuration settings see here.