Code First migrations and dotConnect for Oracle
Posted: Tue 05 Mar 2013 12:21
Hi - I'm attempting to upgrade my project to use Code First Migrations. Currently I have a VS 2012 MVC4 project using Entity Framework Code First 4.2 and DevArt dotConnect for Oracle version 6.8. I upgraded dotConnect to version 7 and EF to version 5 and had various issues for which I made the changes below:
I've added this code to my Configuration class constructor:
and this to my DbContext class:
and this to the app.config section of my DB project:
After doing all the above I deleted the Migrations folder in VS and ran Enable-Migrations again. This produced the Configuration class as well as a {Timestamp}_InitialCreate.cs so it seemed to be ok. I then ran 'Add-Migration TestMig2' without making any changes and I now get the error below:
Some questions:
- What version of Entity Framework and dotConnect should I be using?
- Do the config changes detailed above still apply?
- I'm seeing these changes scattered across various posts here and on Stackoverflow. Are all these changes detailed somewhere, or is there a blog post about using Code First migrations with dotConnect for Oracle and all the changes required?
If anyone has any tips or can point out something I might be doing wrong then I'd be grateful..thanks in advance.
I've added this code to my Configuration class constructor:
Code: Select all
SetSqlGenerator(OracleConnectionInfo.InvariantName, new OracleEntityMigrationSqlGenerator());
Code: Select all
var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
config.Workarounds.IgnoreSchemaName = true;
config.Workarounds.ColumnTypeCasingConventionCompatibility = true;
Code: Select all
<dependentAssembly>
<assemblyIdentity name="EntityFramework"
publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="4.4.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
Code: Select all
PM> Add-Migration TestMig2
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at MyAppDatabase.Migrations.Configuration..ctor()
- What version of Entity Framework and dotConnect should I be using?
- Do the config changes detailed above still apply?
- I'm seeing these changes scattered across various posts here and on Stackoverflow. Are all these changes detailed somewhere, or is there a blog post about using Code First migrations with dotConnect for Oracle and all the changes required?
If anyone has any tips or can point out something I might be doing wrong then I'd be grateful..thanks in advance.