Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How does WCF resolve which concrete class is used when its service is called?

Posted on 2014-03-06
3
Medium Priority
?
690 Views
Last Modified: 2014-03-07
I began my WCF web service with the standard Service.cs and IService.cs.  I have since made enhancements to the individual methods (OperationContracts) in a new MyService.cs file that also inherits from IService.cs.

I looked through the App.Config and found that the "contract" being referenced is the interface class but see no code, yet, that choses which concrete implementation class should be used when its called.

Does ,NET WCF always call the use the class that is the same name as the interfaces(minus the "I")?
0
Comment
Question by:Bruce
3 Comments
 
LVL 25

Assisted Solution

by:apeter
apeter earned 1000 total points
ID: 39912016
No it is not always just the minus. You can have any name for your concrete class.

You can use a concrete class as service contract but below are the benefits you get when using interfaces. All your .svc file markup has attribute "Service" which points to the class implements the service. So when you use the address to create proxy class using "add reference" or  client channel factory, run time knows which class to invoke.


•Service contract interfaces can extend any number of other service contract interfaces.
• A single class can implement any number of service contracts by implementing those service contract interfaces.
• You can modify the implementation of a service contract by changing the interface implementation, while the service contract remains the same.
• You can version your service by implementing the old interface and the new one. Old clients connect to the original version, while newer clients can connect to the newer version.
0
 
LVL 16

Accepted Solution

by:
SriVaddadi earned 1000 total points
ID: 39912152
In short, It is resolved from the fully qualified service name specified in the configuration that is implementing the service contract specified in the configuration.

You do not need to use the same name but what ever the name you use, your service configuration should be updated accordingly.
0
 
LVL 1

Author Closing Comment

by:Bruce
ID: 39912666
Thank you!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task of choosing a web design company to build a website for your business should never be taken in a light manner. Provided the fact that your website will act as a representative to your business and will be responsible for imposing an online …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question