Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>We've run up against the same problem. I've not found a solution to this either.</p> <p>Here's two things I've seen people do (or we've done):</p> <p><strong>Manual Service Endpoint Registration</strong></p> <p>Create an application service registry that says how to make a ChannelFactory from a T. Each Module can contribute to this in IModule Initialize by calling <code>RegisterService&lt;T&gt;</code> and all subordinate views of that Module can get their Channel Factories from it:</p> <pre><code>public interface IServiceRegistry { void RegisterService&lt;T&gt;(ServiceEndpoint ep); ChannelFactory&lt;T&gt; GetService&lt;T&gt;(); } </code></pre> <p>Instead of returning <code>ChannelFactory&lt;T&gt;</code> here you could just return <code>T</code> of course (caveat emptor). View/ViewModels would simply ask for an IServiceRegistry as a dependency and grab their service proxies this way. This also provides a convenient place for isolation when writing unit tests.</p> <p><strong>Embedded Config</strong></p> <p>A system of conventions roughly doing the same thing as above, but based on config embedded in the DLL (as you suggested) and utilizing named configurations. You'd consume this in the same way as above, but it would be a slightly different experience. We use the convention "Endpoints.config" embedded in our DLL and read from that.</p> <pre><code>public interface IServiceChannelFactoryFactory //I'm terrible at naming { //This is much like the generated concrete class when you use "Add Service Reference" //Except there is no method with an empty parameter ChannelFactory&lt;T&gt; GetService&lt;T&gt;(string endpointName); } </code></pre> <p>Our "Endpoints.config" has multiple endpoints per endpointName with attributes added that make that endpoint unique for the environment (DEV, QA, Staging, Production). I don't know if this is a concern for you, but it was a convenient place to put this kind of config.</p> <p>Both work. It's surprising to me that I've not seen more people talk about this. Great question.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload