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
- SignerInfo.cs
- SkinBuilder.cs
- InputReport.cs
- WindowsAltTab.cs
- TextFindEngine.cs
- FormsAuthenticationUserCollection.cs
- ActivationServices.cs
- ControlIdConverter.cs
- GridViewAutoFormat.cs
- SamlConditions.cs
- FormClosingEvent.cs
- HtmlHistory.cs
- BuildManagerHost.cs
- GregorianCalendar.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- XmlSchemaComplexContentExtension.cs
- PaginationProgressEventArgs.cs
- ContractMethodParameterInfo.cs
- Line.cs
- EditingContext.cs
- Win32.cs
- DbConnectionClosed.cs
- KeyEvent.cs
- SAPIEngineTypes.cs
- InvokeHandlers.cs
- MemberRestriction.cs
- InfoCardUIAgent.cs
- SoapFault.cs
- InstancePersistenceException.cs
- DrawToolTipEventArgs.cs
- CoreSwitches.cs
- CachedCompositeFamily.cs
- PopOutPanel.cs
- HotSpot.cs
- Substitution.cs
- TextAnchor.cs
- FileSystemEnumerable.cs
- PathSegmentCollection.cs
- ModelItemCollection.cs
- DataServiceResponse.cs
- ProtocolsInstallComponent.cs
- SslStream.cs
- SHA512Managed.cs
- BitmapMetadata.cs
- ToolStripDropDownButton.cs
- OwnerDrawPropertyBag.cs
- CookieHandler.cs
- HttpPostedFileWrapper.cs
- XmlHierarchicalDataSourceView.cs
- SiblingIterators.cs
- Context.cs
- ToolboxDataAttribute.cs
- FloatUtil.cs
- SchemaCollectionCompiler.cs
- MsmqIntegrationBindingElement.cs
- ObjectListItemCollection.cs
- X509PeerCertificateAuthenticationElement.cs
- DataGridViewCellStyleConverter.cs
- AddInProcess.cs
- EntityPropertyMappingAttribute.cs
- RouteParametersHelper.cs
- ManualResetEventSlim.cs
- StringBuilder.cs
- ThumbAutomationPeer.cs
- HyperLinkColumn.cs
- ComponentCollection.cs
- InteropEnvironment.cs
- ProfileManager.cs
- ProcessHostFactoryHelper.cs
- MDIControlStrip.cs
- ChangeBlockUndoRecord.cs
- Graph.cs
- WebPartsPersonalization.cs
- LongValidatorAttribute.cs
- ElementsClipboardData.cs
- ManagementBaseObject.cs
- DesignerValidatorAdapter.cs
- ButtonPopupAdapter.cs
- NaturalLanguageHyphenator.cs
- Perspective.cs
- DbFunctionCommandTree.cs
- ApplicationHost.cs
- SafeSecurityHandles.cs
- TextSpanModifier.cs
- CodeParameterDeclarationExpression.cs
- Control.cs
- BrowserCapabilitiesFactory.cs
- SiteMapNode.cs
- XmlReader.cs
- SessionStateUtil.cs
- CompressEmulationStream.cs
- SupportsEventValidationAttribute.cs
- WmlPhoneCallAdapter.cs
- GregorianCalendarHelper.cs
- DeviceContext2.cs
- WebPartManagerDesigner.cs
- NetworkCredential.cs
- TextCollapsingProperties.cs
- MessageFilterException.cs
- AppModelKnownContentFactory.cs