DEV Community

José Pablo Ramírez Vargas
José Pablo Ramírez Vargas

Posted on

One More to the List of Things EF Does "For Me"

So if you have browsed my profile, you'll see an entire article why I dislike Entity Framework for REST development.

Well, a couple of days ago it did it again! Oh so helpful EF with their navigation properties produced an infinite loop when serializing a complex response, making the pod consume the processor and eventually restarting.

Awesome. Just the kind of help I look for in an ORM. <Insert sarcastic smiley here>

Top comments (5)

Collapse
 
scorpio69 profile image
Manik

Hi @webjose bit more insight into it or the two-line code example. What caught my eye was serializing a complex response. Was it running in a monolith or one of the services in distributed design?

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

It was a microservice. Class X had a collection of Y, and Y had a navigation property to X.

Collapse
 
scorpio69 profile image
Manik

If X and Y represent tables One Repo One table then I am lost :)...... so my guess is they are complex models constructed out of n number of tables.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

Don't get lost. The lesson here for me was: Navigation properties get you in trouble when you least expect them. This EF "feature" has gotten in my way one more time. This is why I'd rather use Dapper because it does not provide things to me that I don't need. Cheers!

Thread Thread
 
scorpio69 profile image
Manik • Edited

Buy one get one free :) I think you know that by now I am staying away from EF as much as possible. Dapper has been my friend since 2016.