Why does the Model First Entity Framework 4.0 require a database to be created before it is created?

I am reading an article on Entity Framework 4.0 that states the following:

"The model context menu has an option to 'Generate Database Script from
 Model'.  When you select this option you'll find that you do need to point
 to an existing database.  The script won't create the database itself,
 just the schema, which means that you'll need to create the database yourself
 in advance."

If an EF 4.0 developer generates SQL to clone an existing database, why do you need an existing database?

Thank,

Scott

+3
source share
1 answer

It will generate tables / indexes, etc. for you. You just need to provide an existing, empty database.

Otherwise, you will encounter the problem of chicken and eggs, since you will need, for example, specify a connection string pointing to an existing database in order to be able to connect to the database in the first place.

, , EF, , , . poiint EF , .

+5

Source: https://habr.com/ru/post/1735090/


All Articles