MartinCostello.SqlLocalDb 4.0.0

dotnet add package MartinCostello.SqlLocalDb --version 4.0.0
                    
NuGet\Install-Package MartinCostello.SqlLocalDb -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MartinCostello.SqlLocalDb" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MartinCostello.SqlLocalDb" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MartinCostello.SqlLocalDb" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MartinCostello.SqlLocalDb --version 4.0.0
                    
#r "nuget: MartinCostello.SqlLocalDb, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MartinCostello.SqlLocalDb&version=4.0.0
                    
Install MartinCostello.SqlLocalDb as a Cake Addin
#tool nuget:?package=MartinCostello.SqlLocalDb&version=4.0.0
                    
Install MartinCostello.SqlLocalDb as a Cake Tool

SQL LocalDB Wrapper

SQL LocalDB Wrapper is a .NET library providing interop with the Microsoft SQL Server LocalDB Instance API from managed code using .NET APIs.

NuGet NuGet Downloads

Build status codecov

Introduction

This library exposes types that wrap the native SQL LocalDB Instance API to perform operations on SQL LocalDB such as for managing instances (create, delete, start, stop) and obtaining SQL connection strings for existing instances.

Microsoft SQL Server LocalDB 2012 and later is supported for both x86 and x64 on Microsoft Windows.

While the library can be compiled and referenced in .NET applications on non-Windows operating systems, SQL LocalDB is only supported on Windows. Non-Windows Operating Systems can query to determine that the SQL LocalDB Instance API is not installed, but other usage will cause a PlatformNotSupportedException to be thrown.

Basic Example

using MartinCostello.SqlLocalDb;

using var localDB = new SqlLocalDbApi();

ISqlLocalDbInstanceInfo instance = localDB.GetOrCreateInstance("MyInstance");
ISqlLocalDbInstanceManager manager = instance.Manage();

if (!instance.IsRunning)
{
    manager.Start();
}

using SqlConnection connection = instance.CreateConnection();
connection.Open();

// Use the SQL connection...

manager.Stop();

Feedback

Any feedback or issues for this package can be added to the issues in GitHub.

License

This package is licensed under the Apache 2.0 license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on MartinCostello.SqlLocalDb:

Package Downloads
Luxoft.Framework.AutomationCore

Package Description

IsolatedSqlDb

Package Description

CSharpSqlTests

A simple framework for running sql tests against a temprary localdb instance, optionally deploying a dacpac, using a nice fluent c# api

Alethic.SqlServer.Deployment

Package Description

FlakEssentials.SqlEx

Package Description

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on MartinCostello.SqlLocalDb:

Repository Stars
ardalis/Specification
Base class with tests for adding specifications to a DDD model
MoonStorm/FastCrud
fast .NET ORM for strongly typed people
SQLStreamStore/SQLStreamStore
Stream Store library targeting RDBMS based implementations for .NET
lithnet/access-manager
Access Manager provides web-based access to local admin (LAPS) passwords, BitLocker recovery keys, and just-in-time administrative access to Windows computers in a modern, secure, and user-friendly way.
Version Downloads Last updated
4.0.0 4,370 4/30/2025
3.4.0 362,669 2/2/2024
3.3.0 94,394 11/14/2023
3.2.0 385,461 4/1/2022
3.1.0 138,058 11/8/2021
3.0.1 154,770 7/12/2021
3.0.0 349,934 10/10/2019
2.0.0 364,356 10/1/2018
2.0.0-beta1 1,441 8/12/2018