The latest EF Code First NuGet package comes with a custom implementation of IDatabaseInitializer
called DontDropDbJustCreateTablesIfModelChanged
. As the name implies, when a model change is detected, it will not drop and recreate the whole database, just drop and recreate the tables.
Say I have this model class:
public class User
{
public string Username { get; set; }
// This property is new; the model has changed!
public string OpenID { get; set; }
}
How would one go about implementing an IDatabaseInitializer
that doesn t drop any tables either. In this case, it would just add an OpenID
column to the User table?