Dear All,
How to apply migration in Live Production Site using MVC5 code first entity framework, When i am doing Update-Database after adding extra field in model class then table is generating one field. But how to migration changes to add in local to live production server.
I have uploaded all projects files into live server without the publishing files and I restore local db to live db server.
But my problem is how to upload the migration files after migration in local system, now i am replacing all files directly without publishing and db also restoring local Database to live Database, because not live data is there now.
Below is DBContext Class details
namespace Sample.Models
{
public class SampleDbContext :DbContext
{
public SampleDbContext()
: base("Sample_ConnectionString")
{
Database.SetInitializer<SampleDbContext>(new CreateDatabaseIfNotExists<SampleDbContext>());
}
public DbSet<City> Cities { get; set;}
public DbSet<State> States { get; set; }
}
}
Below is my migration configuration file
internal sealed class Configuration : DbMigrationsConfiguration<Sample.Models.SampleDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = false;
ContextKey = "Sample.Models.SampleDbContext";
}
protected override void Seed(Sample.Models.SampleDbContext context)
{
}
}