WCF / WPF Best Practices - WCF ChannelFactory and PRISM

I am new to the PRISM framework, so my question may be a bit incompatible.

I created a WCF service consisting of two projects.

  • The WCF.svc and Web.config project contains only service definitions.
  • A service type project that defines the WCF service interface and service type.

On the client side, I am a little worried about how I should implement one, long-lived proxy server for the service.

My approach is to create a channel for the service using ChannelFactory<T>and register this in the Unity container in my module. This means that my module must reference the service type project in order to get the service interface ( is this the right way? ).

Question : "What is the best way to manage this channel when we need to provide authentication to create the channel and how to handle disconnects / reconnections."

+3
source share
1 answer

A proxy should not be IMO single single (or singleton based unity), but instead should be created on demand. Thus, each logical module can create it at will, without interfering with other modules.

except that you are approaching, very right. the proxy must have a link to the ServiceType project, etc.

, AuthenticationService Unity singleton. , , - , /.

, , , , . , , IAuthenticationService, ( ), AuthenticationService -, .

+1

Source: https://habr.com/ru/post/1772796/


All Articles