Reputation: 3522
I created a standard C# console application in 2010 Express, used the wizards to create a simple sql express db file which gets placed in the project dir, used the wizards to generate an entity data model based on the newly created db, wrote a few lines to test out entity.
Problem is each time I run the application it recreates the DB file in whatever dir the exe is in overwriting itself everytime and completly ignoring the original db file that sits in the project dir.
Does anyone know what I am missing here ?
Upvotes: 0
Views: 320
Reputation: 11
you must be using some way to find that file or some path parameter within the database connection that points to the database file. Now either you can have that parameter be generated by code or make the directory specific and make the database file copy at a specific location from the original location so that the only that particular database is accessed using the application. For doing that you can add another key in the application config file or at some other place so that the database your application is accessing is in the project directory itself at all times.
Upvotes: 1
Reputation: 19465
Not entirely sure about this but try it out.
Hope it works.
Upvotes: 1