Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4586394
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:37:59+00:00 2026-05-21T21:37:59+00:00

For a toolkit that uses a remote WCF service, I have configured a ChannelFactory<IMyService>

  • 0

For a toolkit that uses a remote WCF service, I have configured a ChannelFactory<IMyService> in a UnityContainer.

Now I want to configure this channel’s endpoint behavior through code (using Unity) to apply this behavior:

<behaviors>
    <endpointBehaviors>
        <behavior name="BigGraph">
            <dataContractSerializer maxItemsInObjectGraph="1000000" />
        </behavior>
        </endpointBehaviors>
</behaviors>

I found this example on MSDN (http://msdn.microsoft.com/en-us/library/ms732038.aspx)

ChannelFactory<IDataService> factory = new ChannelFactory<IDataService>(binding, address);
foreach (OperationDescription op in factory.Endpoint.Contract.Operations)
{
    vardataContractBehavior = op.Behaviors.Find<DataContractSerializerOperationBehavior>() as DataContractSerializerOperationBehavior;
    if (dataContractBehavior != null)
    {
        dataContractBehavior.MaxItemsInObjectGraph = 100000;
    }
}
IDataService client = factory.CreateChannel();

but now I am stuck trying to do this in a Unity configuration. Should I look into Interception?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:38:00+00:00Added an answer on May 21, 2026 at 9:38 pm

    We are using a build policy extension in unity to add behaviors on the service host. On the client we have a ServiceFactory.

    /// <summary>
    /// Factory for creating application service proxies used on the workstation
    /// </summary>
    /// <typeparam name="TInterface">Interface for the service contract</typeparam>
    public class ServiceFactory<TInterface> where TInterface : class
    {
        private readonly List<IEndpointBehavior> m_Behaviors = new List<IEndpointBehavior>();
    
        /// <summary>
        /// Add a behavior that is added to the proxy endpoint when the channel is created.
        /// </summary>
        /// <param name="behavior">An <see cref="IEndpointBehavior"/> that should be added</param>.
        public void AddBehavior(IEndpointBehavior behavior)
        {
            m_Behaviors.Add(behavior);
        }
    
        /// <summary>
        /// Creates a channel of type <see cref="CommunicationObjectInterceptor{TInterface}"/> given the endpoint address which 
        /// will recreate its "inner channel" if it becomes in a faulted state.
        /// </summary>
        /// <param name="url">The endpoint address for the given channel to connect to</param>.
        public TInterface CreateChannel(string url)
        {
            // create the channel using channelfactory adding the behaviors in m_Behaviors
        }
    }
    

    Then we configure unity with an InjectionFactory

    new InjectionFactory(c =>
                {
                    var factory = new ServiceFactory<TInterface>();
                    factory.AddBehavior(c.Resolve<IClientTokenBehavior>());
                    return factory.CreateChannel(url);
                });
    

    By doing it this way you can also resolve your behavior through unity if you have some dependencies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a fairly graphical intensive application that uses the FOX toolkit and OpenSceneGraph,
I have an ASP.NET page that uses the ASP.NET Ajax Control Toolkit TabContainer .
I want to make an app that uses Google Web Toolkit and Google App
I have a project that uses the wxwidget toolkit (wxThread, wxString, wxEvent, wxDateTime, wxLog
I have a toolkit that has many methods often taking Expression<Func<T,TProperty>> as parameters. Some
I have a Google Web Toolkit application that I am deploying to Google App
I have an Android app, that is using the SIM Toolkit. The application has
Is there a standard way, now that the MySQL migration toolkit is no longer
When I first open my window that uses the wpf toolkit datepicker it has
I want to migrate my existing desktop Windows .NET 3.5 app. that uses MySQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.