I have a hierarchical DbContext
structure, where I would like a specialized DbContext
with its own DbSets
to inherit the DbSets
of a BaseDbContext
.
While accessing the underlying ObjectContext
with ((IObjectContextAdapter
)this).ObjectContext
it takes too long (several minutes) to receive the ObjectContext
.
Is there an issue with DbContext
in CT5, that getting an ObjectContext
from derived DbContext
i开发者_开发技巧s not performantly possible?
The structure is: DbContext(EF4) -> myBaseDbContext -> mySpecializedDbContext
.
Does anyone have an idea of what´s going on in this scenario? It´s just POCO (CF) with TPC and a little inheritance.
I didn't have performance issues with following and you don't have so many DbSets:
public class MyContext: DbContext
{
//your DbSets<> and other
public ObjectContext ObjectContext()
{
return (this as IObjectContextAdapter).ObjectContext;
}
}
精彩评论