DeleteDatabase is not supported by the provider

2019-08-28 06:16发布

问题:

I'm using EF Code First with SQL Express 2012.

Everything worked fine until now. I'm getting this error:

DeleteDatabase is not supported by the provider.

public class SqlServerContext : DbContext
{
    public DbSet<Estimate> Estimates { get; set; }

    public SqlServerContext(String connectionString)
    :base(connectionString)
    {
           Database.SetInitializer(new SqlServerContextInitializer());
    }
}

public class SqlServerContextInitializer : DropCreateDatabaseAlways<SqlServerContext>
{
}

Did anyone have similar problem?