Entity Framework, Code First: where is the database?

Posted by Marko Apfel on Geeks with Blogs See other posts from Geeks with Blogs or by Marko Apfel
Published on Sat, 20 Oct 2012 15:26:00 GMT Indexed on 2012/10/22 11:02 UTC
Read the original article Hit count: 157

Filed under:

With Entity Framework 5 in Visual Studio 2012 the code first feature could let you come to the question “Where is the automatically created database located?”

I run in the question after changing the model which throws during the next run this error:

“The model backing the 'MyContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).”

Okay – clear I thought “delete the database”. But where is the database and what type is it???

In this constellation the frameworks generates a localDB.

You could access this database via SQL Server Object Explorer. For the first time you have to add this localDB. The server name is “(localdb)\v11.0”:

image

And so we could browse through the content of this database. It got the same name like the context class.

image

© Geeks with Blogs or respective owner