WCF/WPF best practice - WCF ChannelFactory and PRISM

I'm new to the PRISM framework so my question may be a bit off topic.

I've established a WCF service composed of two projects.

  1. The WCF .svc and Web.config project just contains the service definitions.
  2. The service type project that defines the WCF service interface and the service type.

In the client side, I am a little apprehensive as to how I should implement a single, long-lived proxy to the service.

My approach is to create a channel to the service using the ChannelFactory<T> and registering this to the Unity container within my module. This means that my Module must reference the Service Type project to get the service interface (is this the right way?).

The question is "what is the best way to manage this channel when we need to provide authentication to create a channel and how to handle disconnections/re-connections."

Answers


The proxy should not be IMO a singleton (or unity-based-singleton) but instead should be created by demand. that way each logical module can create it at will, while not interfering with other modules.

other than that you're approach is very much correct. the proxy should have a reference to the ServiceType project, etc.

if you want to implement an authentication "service", then I would create another Class called AuthenticationService, and register that in Unity as a singleton. This, in turn, would get a reference to a new proxy, and would deal with everything related to authentication/authorazation.

The idea is to let each logic module behave as if it's the only thing in the application, without needing to worry about the other modules other than its dependecies. so this way if you have two Views, each could obtain their own IAuthenticationService, which would be the same (and they shouldn't care about it), while the AuthenticationService itself is dependant on the proxy, and it would hold a reference to it through-out its life.


Need Your Help

How can I view a list of current dependies for a project in Android Studio?

android maven gradle android-studio android-gradle

I am currently using the latest version of Android Studio and I have a (Gradle) project. I am struggling to find a way to view some kind of list of all the dependecies for such project in Android S...

ARM assembly inline C mutex impelmentation

c assembly arm mutex xilinx

I am working on an embedded systems project using the Xilinx Zedboard. The board has the ability to asymmetrically split it's dual core ARM A9 processor to run two separate programs simultaneously....

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.