How does an Entity Framework .edmx.sql file generate database in a deployed application?

6.3k views Asked by At

I'm building a c# application in Visual Studio 2010, that uses database. To create the database I used Entity Framework model-to-databse approach.

So in VS i added a "ADO.NET Entity Data Model" file, then i designed the model, then clicked the "generate database from model" button. After I did that VS generate a new edmx.sql file, then right clicked on this file and chose "Execure SQL", and it created the database in SQL Server with all the tables.

I had to do all of this actions manually in VS to create the database in SQL Server. BUT how does the database get created after I deploy the app? I mean if i create an installer to my app, then I install it on a different computer, how can I make my app create the database in that computer?

1

There are 1 answers

0
Ladislav Mrnka On

You must either create the database manually as you did on your development machine (by running the script) or you must put much bigger effort to your installer and add custom action to create database from included script.