private void ReplaceSerializerContractOperation(ContractDescription contract) { foreach (OperationDescription od in contract.Operations) { DataContractSerializerOperationBehavior dcsob = od.Behaviors.Find<DataContractSerializerOperationBehavior>(); if (null != dcsob) od.Behaviors.Remove(dcsob); DefaultJsonSerializerOperationBehavior newBehavior = new DefaultJsonSerializerOperationBehavior(od, m_IsCompress, m_ContentType); //newBehavior.MaxItemsInObjectGraph = WcfConfigManager.NetworkParameter.MaxItemsInObjectGraph; od.Behaviors.Add(newBehavior); } }
private void ReplaceSerializerOperationBehavior(OperationDescription description) { DataContractSerializerOperationBehavior dcs = description.Behaviors.Find<DataContractSerializerOperationBehavior>(); if (dcs != null) description.Behaviors.Remove(dcs); DefaultJsonSerializerOperationBehavior newBehavior = new DefaultJsonSerializerOperationBehavior(description, m_IsCompress, m_ContentType); //newBehavior.MaxItemsInObjectGraph = WcfConfigManager.NetworkParameter.MaxItemsInObjectGraph; description.Behaviors.Add(newBehavior); }