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
- WindowsTokenRoleProvider.cs
- KeyMatchBuilder.cs
- fixedPageContentExtractor.cs
- XmlProcessingInstruction.cs
- HasCopySemanticsAttribute.cs
- ProjectedSlot.cs
- DataBindingCollectionEditor.cs
- PageContent.cs
- PersonalizationEntry.cs
- WindowClosedEventArgs.cs
- RsaSecurityToken.cs
- ResumeStoryboard.cs
- EntityTypeBase.cs
- ButtonColumn.cs
- InkCanvasAutomationPeer.cs
- CharStorage.cs
- ContextMenuStripGroupCollection.cs
- X509PeerCertificateAuthentication.cs
- WebService.cs
- SimpleApplicationHost.cs
- XmlDataDocument.cs
- DefaultTraceListener.cs
- ViewCellRelation.cs
- DataGridState.cs
- HtmlElementErrorEventArgs.cs
- SessionSwitchEventArgs.cs
- Wildcard.cs
- Registration.cs
- PassportAuthenticationEventArgs.cs
- ResourceContainer.cs
- ListSurrogate.cs
- BoolExpression.cs
- WorkflowApplicationIdleEventArgs.cs
- connectionpool.cs
- FrameworkElementFactoryMarkupObject.cs
- SourceInterpreter.cs
- XmlElementAttribute.cs
- NullableConverter.cs
- Image.cs
- ProjectionNode.cs
- LoadItemsEventArgs.cs
- ActiveXHelper.cs
- WinFormsSpinner.cs
- FormDesigner.cs
- ListenUriMode.cs
- documentsequencetextcontainer.cs
- CorrelationService.cs
- TypeLoadException.cs
- XslUrlEditor.cs
- OracleCommandSet.cs
- MoveSizeWinEventHandler.cs
- ClientOptions.cs
- ColorTranslator.cs
- BitmapDownload.cs
- WebPartConnectionsCancelVerb.cs
- ConfigXmlCDataSection.cs
- SqlConnectionManager.cs
- SystemUnicastIPAddressInformation.cs
- LocalIdCollection.cs
- IxmlLineInfo.cs
- ValueSerializerAttribute.cs
- SiteMapNodeItem.cs
- TableItemPatternIdentifiers.cs
- PrePostDescendentsWalker.cs
- Utilities.cs
- ClosableStream.cs
- Mouse.cs
- TemplateLookupAction.cs
- MimeTypeAttribute.cs
- GridViewCommandEventArgs.cs
- ListCollectionView.cs
- Transactions.cs
- EntityKeyElement.cs
- ComProxy.cs
- COM2IDispatchConverter.cs
- SmtpCommands.cs
- Process.cs
- CapabilitiesSection.cs
- ExpandedWrapper.cs
- WebCategoryAttribute.cs
- OperationPickerDialog.cs
- WorkflowWebService.cs
- HttpProfileGroupBase.cs
- EntityDataSourceWrapperCollection.cs
- MulticastOption.cs
- SmtpFailedRecipientsException.cs
- ConfigurationValidatorBase.cs
- DataTemplate.cs
- DataBoundControl.cs
- CollaborationHelperFunctions.cs
- ThemeableAttribute.cs
- EncoderBestFitFallback.cs
- Pkcs7Recipient.cs
- DBBindings.cs
- MailDefinition.cs
- Rect3DValueSerializer.cs
- DesignerAdapterAttribute.cs
- XmlReader.cs
- Perspective.cs
- DockingAttribute.cs