How can I disable code first migrations

set the Database.SetInitializer to null.

public class DatabaseContext: DbContext
{
    //the base accepts the name of the connection string provided in the web.config as a parameter
    public DatabaseContext()
        : base("DatabaseContext")
    {
        //disable initializer
        Database.SetInitializer<DatabaseContext>(null);
    }

Leave a Comment