FireBootCamp has been an amazing experience.
After 9 weeks of intense training, the FireBootCampers present the solutions that they built during the course, celebrate their successes with a glass of Champagne and mingle with potential employers.
When working with the Entity Framework Code First I will often get the error below:
An exception of type “System.Data.SqlClient.SqlException’ occurred in EntityFramework.dll but was not handled by in user code’
Additional information: Cannot drop database [database name] because it is currently in use.
To force a delete of the database, follow the steps below.
Figure: This exception is common after you have opened a LocalDb database in Visual Studio.
Open Library Package Manager and Stop the LocalDb instance
a: Select Tools | Library Package manager | Package Manager Console
b: Execute the following two statements
sqllocaldb stop v11.0
sqllocaldb delete v11.0
Figure: The steps above will stop and delete the LocalDb instance.
Delete the database file from the database
Figure: Open the Solution Explorer and choose Show All Files
Figure: Delete the mdf from the App_Data folder