Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello every one.

I'm newbe in WCF. In one of my projects I had to add a methode in a WCF Service.
This service is in a DLL and I don't have access to the code.

I would like to know how I can extend the svc file to expose my new methode if it's possible.

Thanks for helping me

Best regards.
Posted
Comments
Sergey Alexandrovich Kryukov 29-Jul-15 10:32am    
Not clear. What "extending a file" should possibly mean and how it can be related to exposing any methods?
—SA
clemhindie 29-Jul-15 10:57am    
I'm using a service that inherits from a WCF service. I need to add a new method.
This method must be visible from outside.
How can I update the svc file and the svc.cs file in my service ?

1 solution

You could create a WCF service decorator (which by itself is also a WCF service). This service can then simply expose all methods of the original (pass-through) and decorate it with your additional method(s).

Good luck!
 
Share this answer
 
Comments
clemhindie 29-Jul-15 11:18am    
What do you mean by a WCF service decorator ?
E.F. Nijboer 29-Jul-15 11:46am    
Lets say you have a service called svc with methods a(), b() and c(). Now you want to add a new method d() but you cannot add it directly because you don't have the source of svc? A solution to this problem is to create a decorator service, called svc2. You add the methods a(), b() and c() to your svc2 and when called you redirect the call directly to svc (and the return value from svc back to the client). in svc2 you can now also expose your new method d() with your own implementation. Now svc2 is a decorator for svc, as it enhances the original svc with all the existing stuff and also adding new stuff. Also google for decorator pattern.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900