Using Entity 4.1 for a project, and couldn’t figure out where the DB file been stored inside my project.
I think I’ve read that Entity code first will still store your data in SQL Express DB at a default location, but couldn’t find out where it is.
What I did is:
-
create Entity DB project (Project A) in my solution, this project will have an Initializer to generate sample data for testing.
-
I also create a separate project (Project B) to save my Entity Code first data for testing by another application.
-
Then I create another WinForm project(Project C) in the same solution, and access DBContext from Project A.
I would assume that the DB should be somewhere in my Project C, and test projects in the solution shouldn’t make a difference?
With a default installation of SQL Server Express and no connection string the database will be created in the DATA directory of the installation, for example something like:
C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA(for 2008 R2 version). The name of the database isnamespace.contextname, for example:MyNamespace.MyContext.mdf(and .ldf). Under this name you can also find them in SQL Server Management Studio.