In Microsoft’s own words: “LocalDB is an extension of SQL Express that offers an easy way to create multiple database instances. Since it runs in user mode and starts on demand, it is easy to configure it.”

It is a piece of cake to use an instance of LocalDB in a .Net app, especially when using Entity Framework. This post simply includes some basic reminders of how to refence it and use it in Entity Framework, Visual Studio, and SQL Server Management Studio.

View LocalDB in Visual Studio 2019:

Click “View” then “SQL Server Object Explorer” to open the window. In that window there will usually be one or two SQL Servers listed:

  • (localdb)\MSSQLLocalDB
  • (localdb)\ProjectsV13

If you only see ProjectsV13 and don’t see MSSQLLocalDB, you will need to manually add it to SQL Server Object Explorer by clicking the Add SQL Server icon in the toolbar, expanding “Local”, selecting “MSSQLLocalDB” from the list, and clicking “Connect”. If MSSQLLocalDB isn’t listed or you have other issues adding it, try the troubleshooting steps listed in this StackOverflow answer.

Connection String for Entity Framework To Use LocalDB:

"ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=SomeDbName;Trusted_Connection=True"
}

Open LocalDB in SQL Server Management Studio:

When connecting to LocalDB in SQL Server Management Studio, use the server name “(localdb)\MSSQLLocalDB”.