Entity Framework Create Database & Tables At Runtime

Posted by dhsto on Stack Overflow See other posts from Stack Overflow or by dhsto
Published on 2012-07-06T21:11:19Z Indexed on 2012/07/06 21:15 UTC
Read the original article Hit count: 183

Filed under:
|

I created some tables in an .edmx file and have been generating the database by selecting "Generate Database From Model" and manually executing an .edmx.sql file on the database to build the tables.

Now, however, I am creating a setup dialog that allows the user to connect the program up to their own database. I thought running context.CreateDatabase would be good enough to create the database, along with the tables, but the tables are not created.

What is the preferred method for creating the database and tables when the user specifies their own server and database to use, when originally starting with a model?

© Stack Overflow or respective owner

Related posts about c#

Related posts about entity-framework