Wednesday, September 26, 2018

EF Core best practices for returning nested JSON.

I have a client who needs a backend for an SPA that produces a specific JSON response. Something like this:

{ "avatar" : { "id" : 1234 "url" : "www.example.com/1.jpg" }, "dob" : { "month" : 1, "day" : 1, "year" : 1987 } } 

Except with a lot more nested objects that contain properties for each user. To make a quick PoC so I can test, I created an avatar class, and a dob class etc, and linked them to the user. I'm wondering if this will end up creating unnecessary complex joins that will drag down performance at scale, and if there is a better or more standard way to return class properties in a nested format - it seems like kind of a waste to create a class to hold essentially 3 key value pairs for a date of birth. Any advice would be appreciated.

EF Core best practices for returning nested JSON. Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team