I have setup entity framework 4.4.0 (EF5) code first migrations for a MySql database but when I run Add-Migration command I always get dbo prepended to the tablenames like so:
CreateTable(
"dbo.Fields",
c => new
{
FieldId = c.Int(nullable: false, identity: true),
FieldTypeId = c.Int(nullable: false),
Name = c.String(nullable: false, unicode: false),
Description = c.String(unicode: false),
CodeList = c.String(unicode: false),
Mask = c.String(unicode: false),
})
.PrimaryKey(t => t.FieldId)
.ForeignKey("dbo.FieldTypes", t => t.FieldTypeId, cascadeDelete: true)
.Index(t => t.FieldTypeId);
I'm using the Devart database provider and my migrations configuration class looks like this:
internal sealed class Configuration : DbMigrationsConfiguration<mydbcontext>
{
public Configuration()
{
// Create a custom connection to specify the database and set a SQL generator for MySql.
var connectionInfo =
MySqlConnectionInfo.CreateConnection("<<myconnectionstring>>");
TargetDatabase = connectionInfo;
SetSqlGenerator(connectionInfo.GetInvariantName(), new MySqlEntityMigrationSqlGenerator());
var config = MySqlEntityProviderConfig.Instance;
config.Workarounds.IgnoreSchemaName = true;
AutomaticMigrationsEnabled = false;
}
protected override void Seed(CloudDataSetDbContext context)
{
}
}
For some reason the IgnoreSchemaName = true is not taken into account.
I added the Devart database provider to the web.config file like so:
<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.MySql" />
<add name="dotConnect for MySQL" invariant="Devart.Data.MySql" description="Devart dotConnect for MySQL" type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=6.80.350.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
And I also added an assembly redirect because Devart needs this like so:
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="4.3.1.0" newVersion="4.4.0.0" />
</dependentAssembly>
Can anybody help me out here? Thx, Steven.