I am using WCF with Entity Framework v4 and using POCO entities. Our entities have a large number of related entities. One object can have many children objects of a different type which then in turn of many children of different types. For example a Car has 1 or many drivers. Each driver has 0 or many children. Each child then has 0 or many friends. (Poor child with 0 friends). The example is a bit daft but you get the point.
If the client wanted to ask for a car it would make sense to return the car with a list of its drivers. It might or might not make sense to populate and return each driver's children. And the problem goes on and on.
Because your database almost always consists of only interconnected tables (leading to interconnected entities) how much of the object graph should we serialize?
- Is there a best practice when it comes to SOA?
- Should it only be the immediately related entities?
- Is there some sort of naming convention?
- Should we use different methods for example GetCar() and GetCarWithDrivers()?