We have a large project that has nearly 20 modules on it. We want to use WCF for the business layer.
We have thought of three ways to implement WCF our project:
- Use only one datacontract and one operation contract. Send
ClassName, MethodName to operation and create class by reflection
then invoke the method in WCF side. - Put all the modules in one wcf application, and create their
data contracts, operation contracts. - Create a seperate wcf application for each module and
host them seperatly.
We use web services because, we need call business layer in java and c#.
Which one is the best way? I need your ideas.
1
Assuming that the 20 modules are not completely unrelated, the second way is the normal approach.
Ideally, you would like calling your services via WCF to feel very similar to calling methods in a DLL. That’s the whole point of the WCF (and going back to earlier days, webservice) client proxies.
The first idea – using one contract and sending the class name and method name – is just horrible.
The third idea is just more work for no apparent reason, unless the 20 modules are so unrelated that it makes no sense for them to be in a single application.
- Don’t, It will be a mess.
- If you need all modules everytime do it.
- On my side I have several services serving different usecase domain.
I want them to be injected in my app through an abstract interface so our app can use local implementation, wcf distant implementation or anyother transport.
It looks like this: