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
- InputBindingCollection.cs
- Pool.cs
- CapabilitiesPattern.cs
- DocumentViewerBaseAutomationPeer.cs
- ScriptControlDescriptor.cs
- SqlExpander.cs
- SizeAnimationBase.cs
- keycontainerpermission.cs
- ContractReference.cs
- SafeArchiveContext.cs
- BuilderElements.cs
- COM2ComponentEditor.cs
- Lease.cs
- ScaleTransform.cs
- XmlEnumAttribute.cs
- EndPoint.cs
- CriticalExceptions.cs
- BitmapEncoder.cs
- HtmlFormWrapper.cs
- HttpCacheVary.cs
- ClientViaElement.cs
- EditingCommands.cs
- TagPrefixAttribute.cs
- SHA512.cs
- AssemblyAttributes.cs
- Nodes.cs
- ValueType.cs
- TrustExchangeException.cs
- ConfigurationManagerInternal.cs
- CompiledAction.cs
- base64Transforms.cs
- StringToken.cs
- TransformDescriptor.cs
- ObjectDataSourceChooseMethodsPanel.cs
- TextFormatterHost.cs
- ListViewItemSelectionChangedEvent.cs
- PrintControllerWithStatusDialog.cs
- ScrollEvent.cs
- SafeEventLogWriteHandle.cs
- LabelDesigner.cs
- HebrewCalendar.cs
- BitSet.cs
- GenericWebPart.cs
- CodeDirectoryCompiler.cs
- DbRetry.cs
- SolidBrush.cs
- GAC.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- VirtualPathProvider.cs
- AsymmetricCryptoHandle.cs
- Preprocessor.cs
- ToolStripPanelDesigner.cs
- ToolStripProgressBar.cs
- DbBuffer.cs
- PageAdapter.cs
- panel.cs
- SelectionEditor.cs
- ServiceOperationListItem.cs
- XmlSchemaObject.cs
- Win32.cs
- ImageCodecInfoPrivate.cs
- ExpandCollapseProviderWrapper.cs
- DocumentPaginator.cs
- MethodBuilder.cs
- SpinLock.cs
- SHA1Managed.cs
- Wrapper.cs
- QilStrConcat.cs
- ObjectTag.cs
- SecondaryIndex.cs
- ApplyImportsAction.cs
- NamedPipeProcessProtocolHandler.cs
- StylusPointPropertyInfoDefaults.cs
- WmlCalendarAdapter.cs
- CannotUnloadAppDomainException.cs
- PackageRelationship.cs
- WpfPayload.cs
- BamlBinaryWriter.cs
- KnownTypesProvider.cs
- ValidationUtility.cs
- InputBinder.cs
- AssemblyHash.cs
- RtfControls.cs
- FeatureManager.cs
- GetRecipientRequest.cs
- NodeLabelEditEvent.cs
- CollectionConverter.cs
- Delay.cs
- SeparatorAutomationPeer.cs
- DataGridTextColumn.cs
- MaskedTextBoxDesignerActionList.cs
- CodeArrayIndexerExpression.cs
- HtmlTableCell.cs
- BaseParaClient.cs
- SynchronizedRandom.cs
- OdbcException.cs
- FlagsAttribute.cs
- PrintPreviewDialog.cs
- HashSetEqualityComparer.cs
- ProfileInfo.cs