Para un kit de herramientas que usa un servicio WCF remoto, he configurado un ChannelFactory<IMyService>
en UnityContainer.Configure un MaxItemsInObjectGraph de un cliente WCF al usar Unity
Ahora quiero configurar el comportamiento de punto final de este canal a través de código (Unity) para aplicar este comportamiento:
<behaviors>
<endpointBehaviors>
<behavior name="BigGraph">
<dataContractSerializer maxItemsInObjectGraph="1000000" />
</behavior>
</endpointBehaviors>
</behaviors>
me encontré con este ejemplo en 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();
pero ahora estoy atascado tratando de hacer esto en una configuración de Unity. ¿Debería investigar Intercepción?
Por ahora acabo de construir la fábrica, aplicar el comportamiento y agregarlo como una instancia al contenedor. – veertien