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
- DataGridViewCellMouseEventArgs.cs
- CompilationUnit.cs
- NominalTypeEliminator.cs
- DrawListViewItemEventArgs.cs
- AncestorChangedEventArgs.cs
- InputLanguageManager.cs
- BitmapImage.cs
- AccessText.cs
- FaultContext.cs
- CombinedGeometry.cs
- Double.cs
- SmiEventStream.cs
- NamespaceDecl.cs
- SweepDirectionValidation.cs
- StringFormat.cs
- ServiceReference.cs
- JoinGraph.cs
- ObjectDisposedException.cs
- TextBoxDesigner.cs
- Nodes.cs
- AppDomainManager.cs
- Emitter.cs
- RoleManagerModule.cs
- Matrix.cs
- DecoderNLS.cs
- TargetException.cs
- SmtpMail.cs
- OLEDB_Enum.cs
- XmlILStorageConverter.cs
- OdbcConnectionFactory.cs
- MethodMessage.cs
- PrintDialog.cs
- DebugView.cs
- ToolStripItemClickedEventArgs.cs
- StateBag.cs
- ProviderSettingsCollection.cs
- SessionStateUtil.cs
- SamlAttribute.cs
- ListControl.cs
- Rect.cs
- EnumerableWrapperWeakToStrong.cs
- DynamicPhysicalDiscoSearcher.cs
- SqlDataAdapter.cs
- ExpressionConverter.cs
- XpsSerializationManagerAsync.cs
- GridView.cs
- ViewCellRelation.cs
- CompiledQueryCacheEntry.cs
- DataGridViewAutoSizeModeEventArgs.cs
- _AutoWebProxyScriptWrapper.cs
- HttpHandlerActionCollection.cs
- WebPartVerb.cs
- BuiltInExpr.cs
- WebBrowserDesigner.cs
- WorkflowControlEndpoint.cs
- XPathArrayIterator.cs
- SqlDataSourceCustomCommandEditor.cs
- ConditionalAttribute.cs
- TextParagraphCache.cs
- EntryWrittenEventArgs.cs
- storagemappingitemcollection.viewdictionary.cs
- MemoryPressure.cs
- MouseGestureValueSerializer.cs
- WebPartTransformerAttribute.cs
- TextEditorCharacters.cs
- XmlSchemaDocumentation.cs
- EdmError.cs
- DropShadowBitmapEffect.cs
- ObjectPropertyMapping.cs
- SqlCacheDependency.cs
- HtmlInputButton.cs
- EventToken.cs
- ReadOnlyHierarchicalDataSource.cs
- ArglessEventHandlerProxy.cs
- PageSetupDialog.cs
- SymmetricAlgorithm.cs
- BinaryMessageEncoder.cs
- SafeUserTokenHandle.cs
- ErrorWrapper.cs
- OutKeywords.cs
- XmlNodeComparer.cs
- ReadOnlyDataSource.cs
- RegexCapture.cs
- ToolStripOverflow.cs
- DataGridViewTopLeftHeaderCell.cs
- InstanceCreationEditor.cs
- XsdBuilder.cs
- TemplateBuilder.cs
- TailPinnedEventArgs.cs
- EnterpriseServicesHelper.cs
- TimeEnumHelper.cs
- IsolatedStorageException.cs
- SystemResourceKey.cs
- MemberPathMap.cs
- PeerEndPoint.cs
- TagMapInfo.cs
- DescriptionAttribute.cs
- PostBackTrigger.cs
- FormatControl.cs
- TypeForwardedToAttribute.cs