Recreate entity framework tables, not databases?
Through the entity framework, I would like it to recreate my tables, and not my databases. The reason for this is that I have no permission to drop an entire database, whereas I do have permission 开发者_如何学Cto create and drop tables.
I don't think there is such an initializer for EF 4.1 from MS.
This comes closest to your needs:
class BlogContext : DbContext
{
public BlogContext()
{
System.Data.Entity.Database.SetInitializer(new CreateDatabaseIfNotExists<BlogContext>());
}
}
To implement it yourself: http://dotnet.dzone.com/news/creating-code-first-database?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+zones%2Fcss+%28CSS+Zone%29
精彩评论