internal static void ReplaceDataContractSerializer(ContractDescription contractDescription, IPreserveObjectReferences preserverObjectReferences) { foreach (var operation in contractDescription.Operations) { ReplaceDataContractSerializer(operation, preserverObjectReferences); } }
internal static void ReplaceDataContractSerializer(OperationDescription operation, IPreserveObjectReferences preserverObjectReference) { if (operation.Behaviors.Remove(typeof(DataContractSerializerOperationBehavior)) || operation.Behaviors.Remove(typeof(PreserveObjectReferenceSerializerOperationBehavior))) { operation.Behaviors.Add(new PreserveObjectReferenceSerializerOperationBehavior(operation, preserverObjectReference.MaxItemsInObjectGraph, preserverObjectReference.IgnoreExtensionDataObject)); } }