c# - Configure a WCF client's MaxItemsInObjectGraph when using Unity -
For a toolkit using a remote WCF service, I have the ChannelFactory & lt; IMyService & gt;
A Unity Container.
Now I want to configure this channel's endpoint behavior by using the code (using Integration) to implement this behavior:
& lt ; Behaviors & gt; & Lt; Endpoint beehaviors & gt; & Lt; Behavior name = "big graph" & gt; & Lt; Data contractor maxItemsInObjectGraph = "1000000" /> & Lt; / Behavior & gt; & Lt; / EndpointBehaviors & gt; & Lt; / Behavior & gt;
I found this example on MSDN ()
ChannelFactory
But now I am trying to do this in a Unity configuration. Should I consider interceptions?
We are using a build policy extension in unity to add behavior to the host. We have a service provider on the customer.
/// & lt; Summary & gt; To create an application service proxy used on /// workstation, the factory /// & lt; / Summary & gt; /// & lt; Typename name = "t interface" & gt; Interface for service agreement & lt; / Typermum & gt; Public category service provider & lt; TInterface & gt; Where TInterface: Class {Private Redondly List & lt; IEndpointBehavior & gt; M_Behaviors = New list & lt; IEndpointBehavior & gt; (); /// & lt; Summary & gt; /// Add a behavior that is added to the proxy endpoint when the channel is created. /// & lt; / Summary & gt; /// & lt; Ultimate name = "behavior" & gt; A & lt; See cref = "IEndpointBehavior" /> It should be added & lt; / Param & gt; Public Zero AddBehavior (IEndpointBehavior behavior) {m_Behaviors.Add (behavior); } /// & lt; Summary & gt; /// A channel type & lt; Cref = "see communication object interceptor {TInterface}" & gt; The given endpoint address is given to us who will /// rebuild its "inner channel" if it is in the event of a mistake. /// & lt; / Summary & gt; /// & lt; Param name = "url" & gt; Endpoint address given to the given channel is & lt; / Param & gt; To connect with After adding the behavior to public TInterface CreateChannel (string url) {// channel m_Behaviors}}
, we can create a InjectionFactory
New Injection Factor (C = & gt; {Factor = New Service Factor & lt; TInterface & gt; (); Factory Advisive (C. Resolve & LT; ICalent Tokens Bichelier & gt; ()) ; Return Factory; Crelet Channel (URL);});
By doing this you can solve your behavior by unity if you have certain dependencies.
Comments
Post a Comment