Setup: Entity framework code first to new database.
Scenario: I'm playing around with EF and I add a bunch of elements to my database. I then change the entity model, and while I know that I could do migrations, I just want to start from scratch and basically wipe the database from the earth.
The database used by default was (localdb)\v11.0.
My question is:
Can I go somewhere and just delete a file, or start some kind of manager to delete that database and start from scratch?
LocalDB is its own separate server (its name suggests that it is just a database in some other server instance but this is not the case). In SQL Server 2014 Express you connect to it using server name "(localdb)\MSSQLLocalDB", just as you would connect to any ordinary database server. If you connect using SQL Server Management Studio then you have all the power of SSMS available to you.
If you're using Entity Framework Core, you can enter this in the Package Manager Console:
It will drop the current database. This command will tell you which one:
This is also handy:
I think you want to delete an individual database, not a LocalDB instance. If so, just issue a drop database command:
You can do this from
sqlcmd
, Management Studio, your application code, maybe even Visual Studio...From Visual Studio => Click View => SQL Server Object Explorer=> Right click the desired database and choose delete and it will be deleted or do whatever you want
Yes you can. In VS 2015/2017 press Ctrl+Q, type "object explorer". The "SQL Server Object Explorer" should open, where you'll see your local DB instances. Expand the DB instance, and you'll see the different databases. Select one database perform a right click and choose "Delete".
For additional information check this link.
Hope that helps.
Just go in command prompt with admin rights and type: