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
- CodeNamespaceImport.cs
- DbConnectionPoolOptions.cs
- Guid.cs
- ButtonFlatAdapter.cs
- Visual3DCollection.cs
- ValuePattern.cs
- SqlLiftIndependentRowExpressions.cs
- Error.cs
- GridLengthConverter.cs
- ToolStripControlHost.cs
- relpropertyhelper.cs
- PasswordRecoveryAutoFormat.cs
- ResourceAssociationSetEnd.cs
- Function.cs
- WebSysDisplayNameAttribute.cs
- SafeBuffer.cs
- TimeEnumHelper.cs
- ConfigXmlSignificantWhitespace.cs
- Quaternion.cs
- Set.cs
- XmlDesignerDataSourceView.cs
- PackageProperties.cs
- AvTraceFormat.cs
- ImageMap.cs
- DbException.cs
- GradientSpreadMethodValidation.cs
- Lease.cs
- X509CertificateCollection.cs
- HttpRequestTraceRecord.cs
- HostingEnvironmentSection.cs
- TypeDependencyAttribute.cs
- Blend.cs
- ShowExpandedMultiValueConverter.cs
- TrimSurroundingWhitespaceAttribute.cs
- XPathScanner.cs
- HtmlControl.cs
- XmlIterators.cs
- Emitter.cs
- ComponentEditorForm.cs
- WSHttpBindingElement.cs
- UpdatableWrapper.cs
- SmtpNegotiateAuthenticationModule.cs
- PieceDirectory.cs
- Int32Animation.cs
- ParameterSubsegment.cs
- ErrorHandler.cs
- LayoutEngine.cs
- control.ime.cs
- MouseEventArgs.cs
- coordinatorfactory.cs
- SourceFileInfo.cs
- HostedElements.cs
- InfiniteTimeSpanConverter.cs
- WindowAutomationPeer.cs
- PositiveTimeSpanValidatorAttribute.cs
- CaseStatementSlot.cs
- XamlReader.cs
- EncodingStreamWrapper.cs
- SystemGatewayIPAddressInformation.cs
- DataGridViewLinkColumn.cs
- CriticalHandle.cs
- DataGridViewElement.cs
- BCryptHashAlgorithm.cs
- SrgsGrammar.cs
- HttpCachePolicyElement.cs
- DbDataReader.cs
- ItemMap.cs
- EdmScalarPropertyAttribute.cs
- BamlCollectionHolder.cs
- Identity.cs
- HttpResponse.cs
- ProvidePropertyAttribute.cs
- PageThemeParser.cs
- ScriptControlManager.cs
- Models.cs
- ReadWriteObjectLock.cs
- XamlToRtfParser.cs
- HttpInputStream.cs
- StatusBarAutomationPeer.cs
- DataTrigger.cs
- MetadataProperty.cs
- DataGridViewLayoutData.cs
- UpdateProgress.cs
- MetabaseServerConfig.cs
- CannotUnloadAppDomainException.cs
- DocumentGridContextMenu.cs
- XmlSchemaSearchPattern.cs
- FixedFlowMap.cs
- PaintValueEventArgs.cs
- SchemaElementLookUpTable.cs
- TaskSchedulerException.cs
- CaseStatementProjectedSlot.cs
- WindowsScroll.cs
- JsonMessageEncoderFactory.cs
- ISAPIApplicationHost.cs
- SecurityCriticalDataForSet.cs
- RoutedUICommand.cs
- TimeoutValidationAttribute.cs
- odbcmetadatafactory.cs
- URLIdentityPermission.cs