Will EF :: attach (entity) resolve objectContext already running?

I am keeping some EF objects in a cache that I wrote.

When I fetch them from the cache, I sometimes get the "contextObject isposed" error.

using this can solve the problem?

if (maMDBEntities.Entry(group).State == EntityState.Detached)
{
    maMDBEntities.Groups.Attach(group);
}

return group;

      

And if not, what would solve my mistake?

Include()

?

group

has nested references to objects in it (a couple of levels)

0


source to share





All Articles