Item updated in database after savechanges but linq to entity query can't find update

Hello Experts,

In my controller, I have an ActionResult method that calls an Add and after that does SaveChanges.

When I query the database in SQL server, I get the item with all the fields updated properly. But, when I run the query in linq, I can't get the item (it returns 0 for the entries it found for a specific id). However, querying for other items works fine.

Is there another call I need to make to update the EF from the database update? What else could be the problem?

Thanks a ton!
Who is Participating?
freezegravityConnect With a Mentor Author Commented:
Ah ... figured it out ... it was updating right and there is nothing I need to do additionally to get the data back to EF. My query from linq was bad .. it was querying another table/class and looking for the id as a foreign key ... corrected it and things work!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.