Now I'm starting to develop a wcf service bus, which is now small, but will grow as our business grows, so I am worried about some problems with dirt, and I also try not too much YAGNI. It is an ecommerce platform. The problem is that I have too many second thoughts about where to put things. I will give a script to demonstrate all my questions.
We have an e-commerce site that sells products and ultimately delivers them. To do this, we have a PlaceOrder service, which, among other parameters, expects an Address object, which in this context (our site places an order) is made of City, Street and ZipCode.
We also do business with partners who use our platform to sell products only. They take care of the delivery. For this scenario, we have a PlaceOrderForPartner service, which, among other objects, expects an Address object. However, in this context (the partner placing the order), the Address object consists of various information related only to the order placed by the partner.
Given this scenario, I have a few questions:
1) How to organize DataContracts objects in namespaces and folders in my solution? I was thinking about having a folder for the context (Partner, Customer, etc.) To save services and DataContracts.
So I would have
- MySolution.sln
- Partner (folder)
- PartnetService.svc
- DataContracts (folder)
- Address
- Customer (folder)
- Customer.svc
- DataContracts (folder)
- Address
Using this method, I would have a namespace to host all of my data related to a specific content.
2) What about service design? Should I create a service for everyone that can place and order, and create a PlaceOrder method inside it as follows:
Partner.svc / PlaceOrder
Customer.svc / PlaceOrder
or create an order service using PlaceOrderForPartner and PlaceInternalOrder as follows:
Order.svc / PlaceOrderForPartner
Order.svc / PlaceOrderForCustomer
3) Assuming that I take the first option in the last question, what should I do with the operations that are carried out in the order and are normal for the Partner and the Client?
4) Should I put the DataContracts and the service definition in the same assembly? One for everyone? Everything with the implementation of the service?
5) What are the names of input and output messages for operations? Should I use the objects themselves or use the template OperationNameRequest and OperationNameResponse?
In conclusion, my wonderful question: how to "organize" data and services related to the creation of the service?
Thanks in advance for any thoughts on this!