JDIBO
JDIBO

Reputation: 67

Entity Framework Child Delete - but still I can see the row in parent

I've a project using EF and repository pattern. I have the old same relation --> 1 to many.... I can delete the child row from parent. In DB is completely deleted.

But still I see the reference to this object in parent.

I can't really figure it out...

I'm novice with EF

Thanks

JDIBO

Upvotes: 0

Views: 205

Answers (1)

Andy
Andy

Reputation: 8562

It sounds like you're not throwing away your DbContext after you've done SaveChanges. DbContextes represent units of work, and should be destoried as soon as you are done with them. Create a new DbContext to query the data after your update.

Upvotes: 1

Related Questions