0

Asp.net MVC + EF: When I try to send back to client from controller, a collection that I retrieve from EF, I get an error on client. debug shows that the details are not sent appropriately. it does work fine when I copy the data into any other DTOs that I created and send them instead. just init another object and send it works. why ???

thanks !!!

1
  • It's usually because you have lazy loading enabled and the serializer tries to read a collection, whish should be lazy loaded, when the context no longer exists. Commented Jun 6, 2014 at 0:08

1 Answer 1

0

so this is how it should work. reason: poco ef objects can't be serialize properly because of relationships conventions, and we use dto instead to return only required properties.

WebApi Controller returned value in Entity Framework 5 and MVC 4 project

hope it helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.