I have an Entity Framework (v4) entity with several multi-layered navigation properties included. It’s potentially a very deep object. The resulting entity can be small, or pretty significant in size. It’s never super-large; never megabytes of data or whatever.
Also, I am NOT trying to solve a problem with payload size or any error I am receiving. I am simply trying to determine which is the best solution for this type of situation.
Let’s call my Entity Framework entity a Project record.
Is it smartest to build a WCF method like this:
public Project GetProject(int projectId) { }
Or like this:
public Project GetProject(int ProjectId) { }
public Project GetProjectPart1(int ProjectId) { }
public Project GetProjectPart2(int ProjectId) { }
public Project GetProjectPart3(int ProjectId) { }
public Project GetProjectPart4(int ProjectId) { }
I guess it’s a question of Chunky versus Chatty.
Is this just an “it depends” sort of situation or is there a General Rule of Thumb in these design decisions? I’ve heard arguments for chatty and I have heard arguments for chunk. To be honest, they both seem to make sense; both with benefits and both with negatives.
I suppose it could depend on the environment. If this is a public WCF method, then sending larger amounts of information over http could be problematic. However, in a local environment, you have other options.
Programatically, I would probably go for the chunky option, without the overhead of having to piece the project together with 4 seperate calls.
Decisions, decisions.