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
- GACIdentityPermission.cs
- SoundPlayer.cs
- EntityRecordInfo.cs
- SectionXmlInfo.cs
- PersistenceContext.cs
- ListenerConstants.cs
- BaseDataList.cs
- StylusPlugInCollection.cs
- XsltCompileContext.cs
- ProjectionCamera.cs
- FunctionUpdateCommand.cs
- MD5CryptoServiceProvider.cs
- DataRelation.cs
- SqlBuilder.cs
- FrameworkContentElement.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- NavigationProgressEventArgs.cs
- XmlChildNodes.cs
- Maps.cs
- DbConnectionPoolGroup.cs
- ContainerUtilities.cs
- TransactionException.cs
- DataMemberListEditor.cs
- ToolBarTray.cs
- ToggleProviderWrapper.cs
- X509Certificate2Collection.cs
- UIHelper.cs
- JoinSymbol.cs
- LogicalExpr.cs
- DataServiceResponse.cs
- LambdaCompiler.Generated.cs
- TemplateXamlParser.cs
- ReaderWriterLock.cs
- ImageKeyConverter.cs
- ToolStripDropDownMenu.cs
- FixedSOMPage.cs
- HtmlImageAdapter.cs
- StylusSystemGestureEventArgs.cs
- ProcessHostConfigUtils.cs
- SqlErrorCollection.cs
- RouteValueExpressionBuilder.cs
- XPathItem.cs
- Stroke2.cs
- TraceListeners.cs
- InvalidPrinterException.cs
- Label.cs
- DataShape.cs
- DataTableCollection.cs
- PersonalizationAdministration.cs
- FileCodeGroup.cs
- BounceEase.cs
- BookmarkInfo.cs
- StateItem.cs
- SqlDelegatedTransaction.cs
- BitmapEffectDrawingContextState.cs
- ExtentCqlBlock.cs
- SortableBindingList.cs
- LongMinMaxAggregationOperator.cs
- XPathDescendantIterator.cs
- FrameworkPropertyMetadata.cs
- DCSafeHandle.cs
- DiscreteKeyFrames.cs
- MethodBuilder.cs
- InstanceNormalEvent.cs
- EventLogger.cs
- ExceptionUtil.cs
- WizardStepBase.cs
- TextBoxBase.cs
- CdpEqualityComparer.cs
- TextLine.cs
- WebSysDisplayNameAttribute.cs
- OpenTypeCommon.cs
- ShaderEffect.cs
- EntityConnectionStringBuilder.cs
- DataGridViewAdvancedBorderStyle.cs
- peersecurityelement.cs
- NumberSubstitution.cs
- DetailsViewModeEventArgs.cs
- Attributes.cs
- UnconditionalPolicy.cs
- WebHttpBinding.cs
- ItemCollectionEditor.cs
- Merger.cs
- SpotLight.cs
- ButtonChrome.cs
- WorkflowOwnershipException.cs
- DebugView.cs
- HitTestParameters3D.cs
- UnsafeNativeMethodsPenimc.cs
- CapabilitiesRule.cs
- TextTreeRootTextBlock.cs
- AndAlso.cs
- ActivityExecutor.cs
- MouseActionValueSerializer.cs
- StickyNoteHelper.cs
- PropertiesTab.cs
- IfJoinedCondition.cs
- DataGridViewCellMouseEventArgs.cs
- XmlReflectionMember.cs
- Calendar.cs