I have a method called GetObjectsRelatedToAType, e.g. GetCarsRelatedToDealership. Which approach is better from a web services or general method signature standpoint:
List<Cars> GetCarsRelatedToDealership( Dealership dealership );
or
List<Cars> GetCarsRelatedToDealership( id dealership );
I tend to like the object approach because it is a little more forceful about making sure the source input to the method is valid. Thoughts/advice?
For the web services I try to minimize how much data is being sent over the wire. If you also need a method I would probably make member method “GetRelatedCars” for the “Dealership” class/interface. When the web service call comes you could validate it is a real “Dealership” (and the caller has rights to it) by getting that object based on the id and for the call the “GetRelatedCars” method on the object.