0

Recently upgraded my project to EF6 from EF4. We are using Miniprofiler for database profiling and we have a function to create profiled context and are using StackExchange.Profiling.Data.ObjectContextUtils.CreateObjectContext function to create object context. The problem i am facing is that this function generic type has a constrain that it should be of type System.Data.Objects.ObjectContext but as we have migrated to ef6 this is moved to System.Data.Entity.Core.Objects.ObjectContext and hence is breaking the code.

Can someone advise how this can be fixed. The code is given below.

    protected override System.Data.Entity.Core.Objects.ObjectContext CreateProfiledObjectContext(EFProfiledDbConnection connection)
    {

        return StackExchange.Profiling.Data.ObjectContextUtils.CreateObjectContext<MyDbContext>(connection);
    }

This works for EF4 as MyDbContext is derived from System.Data.Objects.ObjectContext but when we moved to EF6 it is derived from System.Data.Entity.Core.Objects.ObjectContext and hence is breaking the code.

Regards

iaq
  • 173
  • 1
  • 2
  • 10

0 Answers0