?
Solved

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

Posted on 2014-03-06
3
Medium Priority
?
678 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

When ransomware hits your clients, what do you do?

MSPs: Endpoint security isn’t enough to prevent ransomware.
As the impact and severity of crypto ransomware attacks has grown, Webroot fought back, not just by building a next-gen endpoint solution capable of preventing ransomware attacks but also by being a thought leader.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
To properly understand GitHub, let’s divide it into two words ‘Git’ and ‘Hub’. Git is basically a ‘Distribution Version Control’ (DVC) and ‘Source Code Management’ (SCM) system widely used by software programmers while Hub means the efficient centre…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 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