EntityFramework does not create tables

I have been using EF for a while, always in Model-First . Now I come across Code-First lands. The fact is that I had problems with automatic table creation.

For some sites this is possible. And I tried their approach without success.

Here is one of the things I tried: Database.CreateIfNotExists()

Bad luck...

My connection string is perfect and working. If I add the table manually, it will work. The problem is that I do not have a table. It just isn't being created, as I said.

My classes are correctly designed. (Again: it works when I created the database)

Any suggestions? Does this feature really work?

I use:

Visual Studio 2010 Professional

EntityFramework 4.3.1 (although I also tried with 4.1)

SQL Server 2008 R2

Thanks in advance.

+5
1

, , IDatabaseInitializer<Context>. :

  • CreateDatabaseIfNotExist ( )
  • DropCreateDatabaseWhenModelChanges
  • DropCreateDatabaseAlways

, API , , . , , , , .

Nuget EFCodeFirst.CreateTablesOnly

- , .

+5

All Articles