Hello people,
I have coded my EF5 dbcontext RadGrid datasource as this:
and all runs fine in EF5 but ....
... I'm migrating to EF6. And, as you know, they are several namespaces ported to EntityFramework.dll.
My issue is, than, in EF6, an error is raised in this line of code:
e.Context = TryCast(ctx, IObjectContextAdapter).ObjectContext
The issue is than e.Context and TryCast(ctx, IObjectContextAdapter).ObjectContext, both are ObjectContext objects, the same type, but declared in separate namespace. The error “Value of type 'System.Data.Objects.ObjectContext' cannot be converted to 'System.Data.Entity.Core.Objects.ObjectContext'“ occurs.
My question:
What is the right way to set dbcontext datasource for radgrind in EF6?
thanks in advance!
I have coded my EF5 dbcontext RadGrid datasource as this:
<telerik:RadGrid ID="RadGrid1"
runat="server"
CellSpacing="0" DataSourceID="edsMainGrid"
...
<asp:EntityDataSource ID="edsMainGrid" runat="server"
OnContextCreating="edsMainGrid_ContextCreating"
EntitySetName="myCollection">
</asp:EntityDataSource>
Protected Sub edsMainGrid_ContextCreating(sender As Object, e As EntityDataSourceContextCreatingEventArgs)
Dim ctx As myEntities = myEntities()
e.Context = TryCast(ctx, IObjectContextAdapter).ObjectContext
End Sub
and all runs fine in EF5 but ....
... I'm migrating to EF6. And, as you know, they are several namespaces ported to EntityFramework.dll.
My issue is, than, in EF6, an error is raised in this line of code:
e.Context = TryCast(ctx, IObjectContextAdapter).ObjectContext
The issue is than e.Context and TryCast(ctx, IObjectContextAdapter).ObjectContext, both are ObjectContext objects, the same type, but declared in separate namespace. The error “Value of type 'System.Data.Objects.ObjectContext' cannot be converted to 'System.Data.Entity.Core.Objects.ObjectContext'“ occurs.
My question:
What is the right way to set dbcontext datasource for radgrind in EF6?
thanks in advance!