Solved

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

Posted on 2014-03-06
3
647 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 250 total points
Comment Utility
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 250 total points
Comment Utility
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
Comment Utility
Thank you!!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
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…
This video discusses moving either the default database or any database to a new volume.

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now