I'm working with asp.net mvc3 & Entity Framework5.
My database has been designed with the Code-First.
Entity Code
public class User { public int Id { get; set; } public string Name { get; set; } } public class EFDbContext : DbContext { public DbSet<User> Users { get; set; } } Create DB Option
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<EFDbContext>()); I use this option, the database has been created.
After the database has been created, I need a Role table was.
So I had to modify the code as follows.
Entity Code
public class User { public int Id { get; set; } public string Name { get; set; } } public class Role { public int Id { get; set; } public string Name { get; set; } } public class EFDbContext : DbContext { public DbSet<User> Users { get; set; } public DbSet<Role> Roles { get; set; } } I use Create DB Option again.
In this case, the existing Users table will be deleted after regeneration.
I would like to be added to the Role table, but leave data in the table Users.
What should I do?