Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to create a sqllocaldb instance in c#?

Tags:

c#

sql-server

Is there a way in c# to directly create a SQLLOCALDB instance? At the moment, we use sqllocaldb.exe, but need to be able to do it without using the external executable.

like image 878
Dale K Avatar asked Sep 05 '13 13:09

Dale K


People also ask

How do I create a LocalDB instance?

Check and create a LocalDB instance To do that, locate SqllocalDB.exe and run the following command in a command prompt: You will see a list of available LocalDB instances on the server. This command creates an instance of LocalDB named DEVELOPMENT by using SQL Server 2017 binaries and starts the instance.

Can LocalDB be used in production?

LocalDB is absolutely supported in production. From the performance point of view it is identical to SQL Server Express, as they share the same database engine. Now, for a site running in full IIS I would recommend using service-based instance of SQL Server Express.

What is LocalDB instance?

An instance of SQL Server Express LocalDB is an instance created by a user for their use. Any user on the computer can create a database using an instance of LocalDB, store files under their user profile, and run the process under their credentials. By default, access to the instance of LocalDB is limited to its owner.

Can I use SQL without a server?

You don't need to buy SQL Server, you need to create a SQL instance in it to use it.


1 Answers

You could use the SQL LocalDB Wrapper library.

It wraps the native APIs exposed by SQL LocalDB in a .NET 4.0 assembly.

It is also now available via NuGet.

Disclaimer: I maintain this library.

like image 196
Martin Costello Avatar answered Sep 26 '22 18:09

Martin Costello