Single service vs Multiple services for CRUD operations

Oct 26, 2009 at 11:48 AM

When we are talking about some simple apps it is clear that nothing difficult to create service for CRUD operations (let's call it Data Access Service) for each type of entity/DTO in our solution. But when we take a look for something like enterprise size app it is really confusing because the count of possible entity/dto types is hundred and more.

So now i'm asking myself about what is the correct way to implement CRUD operations for enterprise level apps?..

The first way is to make all entities inherited from something base (the common practice) and create one WCF service with CRUD methods for base entity type. To solve the problem with unexpected type when calling methods we can add our types at runtime into the ServiceKnownType collection (adding it in the contract definition is really boring and looks not so good).


The second way is to create hundred with something services inherited from base generic implementation and create some proxy on client side which will call the needed service dynamicly depending on entity type.


I'd like to know Your opinnion about mentioned problem.