Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Description / TransactedBatchingBehavior.cs / 1 / TransactedBatchingBehavior.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Description { using System.ServiceModel.Dispatcher; using System.ServiceModel.Channels; public class TransactedBatchingBehavior : IEndpointBehavior { int maxBatchSize; public TransactedBatchingBehavior(int maxBatchSize) { if (maxBatchSize < 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maxBatchSize", maxBatchSize, SR.GetString(SR.ValueMustBeNonNegative))); } this.maxBatchSize = maxBatchSize; } public int MaxBatchSize { get { return this.maxBatchSize; } set { if (value < 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", value, SR.GetString(SR.ValueMustBeNonNegative))); } this.maxBatchSize = value; } } void IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint) { BindingElementCollection bindingElements = serviceEndpoint.Binding.CreateBindingElements(); bool transactedElementFound = false; foreach (BindingElement bindingElement in bindingElements) { ITransactedBindingElement txElement = bindingElement as ITransactedBindingElement; if (null != txElement && txElement.TransactedReceiveEnabled) { transactedElementFound = true; break; } } if (! transactedElementFound) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SfxTransactedBindingNeeded))); } void IEndpointBehavior.AddBindingParameters(ServiceEndpoint serviceEndpoint, BindingParameterCollection bindingParameters) { } void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher) { if (endpointDispatcher.DispatchRuntime.ReleaseServiceInstanceOnTransactionComplete) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoBatchingForReleaseOnComplete))); if (serviceEndpoint.Contract.SessionMode == SessionMode.Required) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoBatchingForSession))); } void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior) { if (serviceEndpoint.Contract.SessionMode == SessionMode.Required) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoBatchingForSession))); behavior.CallbackDispatchRuntime.ChannelDispatcher.MaxTransactedBatchSize = this.MaxBatchSize; } } } // 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
- ReadOnlyNameValueCollection.cs
- MonikerProxyAttribute.cs
- AuthenticationConfig.cs
- SelectionChangedEventArgs.cs
- EnumerableRowCollectionExtensions.cs
- LoadedOrUnloadedOperation.cs
- StatusBarPanel.cs
- SrgsElementFactoryCompiler.cs
- HtmlHead.cs
- SpotLight.cs
- CaseExpr.cs
- TextProperties.cs
- Win32Exception.cs
- HttpCapabilitiesSectionHandler.cs
- XmlDataSource.cs
- DigestTraceRecordHelper.cs
- WizardStepBase.cs
- ModuleConfigurationInfo.cs
- WindowsFont.cs
- PageEventArgs.cs
- smtppermission.cs
- ListViewInsertedEventArgs.cs
- DelegateHelpers.cs
- SqlLiftWhereClauses.cs
- ControlPaint.cs
- SelectionChangedEventArgs.cs
- IList.cs
- OracleCommandBuilder.cs
- DebugController.cs
- FormViewPageEventArgs.cs
- SoapEnumAttribute.cs
- SiteMap.cs
- DeclaredTypeElementCollection.cs
- PrintPreviewGraphics.cs
- TraceContextRecord.cs
- DynamicUpdateCommand.cs
- FontEmbeddingManager.cs
- InArgument.cs
- ConnectionPoint.cs
- GreaterThanOrEqual.cs
- DataGridViewRowConverter.cs
- SupportsEventValidationAttribute.cs
- XmlException.cs
- DataGridDesigner.cs
- _ConnectOverlappedAsyncResult.cs
- FrameworkElement.cs
- DownloadProgressEventArgs.cs
- GridViewPageEventArgs.cs
- ConfigurationException.cs
- ParagraphResult.cs
- QueryOperationResponseOfT.cs
- returneventsaver.cs
- RegexStringValidator.cs
- KeyInstance.cs
- DataGridState.cs
- CorrelationManager.cs
- EventSinkHelperWriter.cs
- WindowsTooltip.cs
- ZoneMembershipCondition.cs
- SemanticResolver.cs
- NetworkInterface.cs
- DataGridToolTip.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- TableRow.cs
- Decorator.cs
- EnterpriseServicesHelper.cs
- XmlArrayItemAttributes.cs
- TextTreeText.cs
- AppearanceEditorPart.cs
- Header.cs
- StrokeCollectionConverter.cs
- TextBoxLine.cs
- PersonalizationDictionary.cs
- QualifiedCellIdBoolean.cs
- CaseCqlBlock.cs
- Accessible.cs
- DataKeyCollection.cs
- IndexedGlyphRun.cs
- CodeTypeReferenceSerializer.cs
- EntityContainer.cs
- DocumentViewerBase.cs
- FullTextState.cs
- Deflater.cs
- SafeArrayTypeMismatchException.cs
- GeneralTransformCollection.cs
- ResourceLoader.cs
- ToolStripContainerActionList.cs
- InputReport.cs
- MouseBinding.cs
- UnicastIPAddressInformationCollection.cs
- CreateUserErrorEventArgs.cs
- ToolStripInSituService.cs
- SQLByteStorage.cs
- XPathNavigatorKeyComparer.cs
- EdmFunction.cs
- XmlUtilWriter.cs
- SignerInfo.cs
- FormsAuthenticationUserCollection.cs
- HierarchicalDataSourceControl.cs
- WebConfigurationManager.cs