Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / DataContractSerializerServiceBehavior.cs / 1 / DataContractSerializerServiceBehavior.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System.ServiceModel.Channels; using System.ServiceModel; using System.ServiceModel.Description; using System.Runtime.Serialization; using System.Collections.ObjectModel; using System.Collections.Generic; internal class DataContractSerializerServiceBehavior : IServiceBehavior, IEndpointBehavior { bool ignoreExtensionDataObject; int maxItemsInObjectGraph; internal DataContractSerializerServiceBehavior(bool ignoreExtensionDataObject, int maxItemsInObjectGraph) { this.ignoreExtensionDataObject = ignoreExtensionDataObject; this.maxItemsInObjectGraph = maxItemsInObjectGraph; } public bool IgnoreExtensionDataObject { get { return this.ignoreExtensionDataObject; } set { this.ignoreExtensionDataObject = value; } } public int MaxItemsInObjectGraph { get { return this.maxItemsInObjectGraph; } set { this.maxItemsInObjectGraph = value; } } void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase) { } void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collectionendpoints, BindingParameterCollection parameters) { } void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase) { ApplySerializationSettings(description, ignoreExtensionDataObject, maxItemsInObjectGraph); } void IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint) { } void IEndpointBehavior.AddBindingParameters(ServiceEndpoint serviceEndpoint, BindingParameterCollection parameters) { } void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime) { ApplySerializationSettings(serviceEndpoint, ignoreExtensionDataObject, maxItemsInObjectGraph); } void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher) { ApplySerializationSettings(serviceEndpoint, ignoreExtensionDataObject, maxItemsInObjectGraph); } internal static void ApplySerializationSettings(ServiceDescription description, bool ignoreExtensionDataObject, int maxItemsInObjectGraph) { foreach (ServiceEndpoint endpoint in description.Endpoints) { if(!ServiceMetadataBehavior.IsMetadataEndpoint(description, endpoint)) { ApplySerializationSettings(endpoint, ignoreExtensionDataObject, maxItemsInObjectGraph); } } } internal static void ApplySerializationSettings(ServiceEndpoint endpoint, bool ignoreExtensionDataObject, int maxItemsInObjectGraph) { foreach (OperationDescription operation in endpoint.Contract.Operations) { foreach (IOperationBehavior ob in operation.Behaviors) { if (ob is DataContractSerializerOperationBehavior) { DataContractSerializerOperationBehavior behavior = (DataContractSerializerOperationBehavior)ob; if (behavior != null) { if (!behavior.IgnoreExtensionDataObjectSetExplicit) { behavior.ignoreExtensionDataObject = ignoreExtensionDataObject; } if (!behavior.MaxItemsInObjectGraphSetExplicit) { behavior.maxItemsInObjectGraph = maxItemsInObjectGraph; } } } } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScrollEventArgs.cs
- ParsedAttributeCollection.cs
- ApplicationDirectoryMembershipCondition.cs
- HostingPreferredMapPath.cs
- CellIdBoolean.cs
- GcHandle.cs
- WebPartConnectionsCloseVerb.cs
- UnsafeNativeMethodsTablet.cs
- VirtualPathExtension.cs
- MobileSysDescriptionAttribute.cs
- XmlDomTextWriter.cs
- ValidationHelper.cs
- SqlError.cs
- KeyedByTypeCollection.cs
- WebHttpSecurity.cs
- ValidatorAttribute.cs
- AutomationElementIdentifiers.cs
- Schema.cs
- DataPagerFieldItem.cs
- ParamArrayAttribute.cs
- FirstQueryOperator.cs
- ScrollData.cs
- DiscreteKeyFrames.cs
- TableRowGroup.cs
- DataListItem.cs
- CellConstant.cs
- ValueExpressions.cs
- wgx_render.cs
- RectIndependentAnimationStorage.cs
- XmlSchemaImport.cs
- SystemEvents.cs
- UrlPath.cs
- NameValuePair.cs
- RequestDescription.cs
- ProviderBase.cs
- ImmutableObjectAttribute.cs
- InvokePattern.cs
- AsyncPostBackTrigger.cs
- MasterPageCodeDomTreeGenerator.cs
- XPathSingletonIterator.cs
- BitmapEffectInputData.cs
- Span.cs
- UntrustedRecipientException.cs
- XamlInterfaces.cs
- FrameAutomationPeer.cs
- ActivationWorker.cs
- WCFServiceClientProxyGenerator.cs
- MenuItemCollection.cs
- DataGridViewControlCollection.cs
- TableRowCollection.cs
- IndexOutOfRangeException.cs
- DiffuseMaterial.cs
- HtmlTableCell.cs
- DataRecordInfo.cs
- XslCompiledTransform.cs
- FunctionImportMapping.cs
- SqlConnectionPoolProviderInfo.cs
- IndexOutOfRangeException.cs
- ValidationSummaryDesigner.cs
- tooltip.cs
- DelegateBodyWriter.cs
- Type.cs
- ToolStripControlHost.cs
- GPRECT.cs
- _AutoWebProxyScriptWrapper.cs
- controlskin.cs
- HttpModulesSection.cs
- XamlSerializationHelper.cs
- QilStrConcatenator.cs
- FormViewCommandEventArgs.cs
- BinaryFormatter.cs
- HttpRuntime.cs
- HatchBrush.cs
- DoubleLinkList.cs
- SqlVersion.cs
- PerformanceCounterLib.cs
- TextTrailingWordEllipsis.cs
- Quaternion.cs
- UnsafeMethods.cs
- BitmapEffectInput.cs
- VirtualPathProvider.cs
- ObjectTypeMapping.cs
- PTProvider.cs
- SerialReceived.cs
- WindowsScroll.cs
- StatusBarDesigner.cs
- ValidationRule.cs
- SchemaRegistration.cs
- TextEffect.cs
- DataGridViewMethods.cs
- ClassHandlersStore.cs
- BrowserDefinition.cs
- StringAnimationUsingKeyFrames.cs
- RegexWorker.cs
- WinFormsComponentEditor.cs
- SafeMILHandle.cs
- WebContext.cs
- LinkArea.cs
- NativeMethods.cs
- basecomparevalidator.cs