Is it good from your real experience to define a service contract with one method that will take some object as a request form and return some other object as a result of this request. What I mean, instead of having a method for creating, deleting, editing, and finding clients, I would include these actions in DataContracts and what the service will do after receiving such a DataContract, some work will be done. But the service interface would be simple:
interface ISomeService
{
IMessageResult Process(IMessageRequest msg);
}
So, IMessageRequest would give the name OperationType = OperationTypes.CreateCustomer, and the rest of the fields would provide enough information for the service, which could create a Customer object or record in the database or something else. And IMessageResult may have a field with some code to indicate that the client is created or not.
What I'm trying to achieve thanks to this design is the ability to easily delegate IMessageRequest to other internal services that the client is not even aware of. Another advantage that I see is that if we have to add some operation to clients, we provide an additional DataContract for this operation and should not change anything on the side of the service interface (I want to avoid this at all costs, I mean not new operations, but changing the service interface :)
, ? -? , .
- , , , , .