I am struggling with generating conditional code enabling a single migration to target multiple providers - in our project we use EF6 with MSSQL and PostgreSQL.
Is there a way to determine the active provider on adding new migration level?
Something like this:
public partial class TestMigration: DbMigration
{
protected override void Up()
{
if(ActiveProvider == "Microsoft.EntityFrameworkCore.SqlServer")
{
// do something SQL Server - specific
}
if(ActiveProvider == "Microsoft.EntityFrameworkCore.PostgreSQL")
{
// do something PostgreSQL- specific
}
}
}
Here is a great example of how to do it using EF Core but is there any equivalent in EF6?