3
I am trying to use EF, using Code Frist, along with an Oracle database, for this I am using the Nuget package Oracle.ManagedDataAccess.Entityframework, but whenever I try to run the Update-Database
it gives the following error message:
System.Runtime.Serialization.Serializationexception: Type is not resolved for Member 'Oracle.ManagedDataAccess.Client.Oracleexception,Oracle.Manageddataaccess, Version=4.122.1.0, Culture=neutral, Publickeytoken=89b483f429c47342'.
At System.AppDomain.Docallback(Crossappdomaindelegate callBackDelegate) at System.Data.Entity.Migrations.Design.ToolingFacade.Run(Baserunner Runner) at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force) at System.Data.Entity.Migrations.Updatedatabasecommand.<>c__DisplayClass2. <. ctor>b__0() at System.Data.Entity.Migrations.Migrationsdomaincommand.Execute(Action command) Type is not resolved for Member 'Oracle.ManagedDataAccess.Client.Oracleexception,Oracle.Manageddataaccess, Version=4.122.1.0, Culture=neutral, Publickeytoken=89b483f429c47342'.
My context, my class and web.config are as follows:
public class MeuContext : DbContext
{
public MeuContext()
: base("OracleDbContext")
{
}
public DbSet<GrupoProduto> GrupoProdutos { get; set; }
protected override void OnModelCreating(DbModelBuilder dbModelBuilder)
{
base.OnModelCreating(dbModelBuilder);
dbModelBuilder.HasDefaultSchema("atlas");
dbModelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
Class:
public class GrupoProduto
{
[Key]
public Guid GrupoProdutoId { get; set; }
[Required]
[StringLength(200)]
[DisplayName("Nome")]
public String Nome { get; set; }
}
Web.Config:
<connectionStrings>
<add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=atlas;Password=atlas;Data Source=oracle" />
</connectionStrings>
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="oracle" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE))) " />
</dataSources>
</version>
</oracle.manageddataaccess.client>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</providers>
</entityFramework>
Just a comment, this DLL may be found inside the folder of nuget qnd if you install the ODP.Net library. Also I realized that it does not work with
AutomaticMigrationsEnabled
enabled, or I’m experiencing something wrong?– Jeferson Almeida
No, as I said, Oracle does not give due attention to its President. You Flfaz straight. Maybe it’s a bug. Try to report to Oracle, I think they will help more quickly.
– Thiago Lunardi