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
- BaseDataBoundControl.cs
- HttpCapabilitiesSectionHandler.cs
- WebPartMenu.cs
- StreamSecurityUpgradeAcceptor.cs
- InternalConfigRoot.cs
- DynamicEntity.cs
- FreezableOperations.cs
- Currency.cs
- SiteMapDataSourceDesigner.cs
- IdentifierService.cs
- XmlSerializationWriter.cs
- PageThemeParser.cs
- OracleParameterBinding.cs
- AtomMaterializerLog.cs
- ObjectListComponentEditor.cs
- SyncOperationState.cs
- Message.cs
- MenuBase.cs
- PageEventArgs.cs
- DocumentPageTextView.cs
- _BufferOffsetSize.cs
- RoleManagerModule.cs
- LinearGradientBrush.cs
- ExpressionNode.cs
- NetworkInterface.cs
- ErrorReporting.cs
- SecurityManager.cs
- CommonObjectSecurity.cs
- ActiveXHost.cs
- WebEvents.cs
- DbProviderFactoriesConfigurationHandler.cs
- Attributes.cs
- DefaultTextStore.cs
- DbDataSourceEnumerator.cs
- EntityContainer.cs
- OleDbFactory.cs
- CompilerGeneratedAttribute.cs
- ProcessInputEventArgs.cs
- ImpersonateTokenRef.cs
- ListViewTableRow.cs
- DataColumn.cs
- JpegBitmapDecoder.cs
- MetafileHeaderWmf.cs
- UserControlBuildProvider.cs
- Interlocked.cs
- SecurityException.cs
- ControlBuilderAttribute.cs
- LinearGradientBrush.cs
- DBPropSet.cs
- DetailsViewPageEventArgs.cs
- FlatButtonAppearance.cs
- OleDbStruct.cs
- EntityDataSourceViewSchema.cs
- VisualCollection.cs
- SingleAnimationBase.cs
- SspiHelper.cs
- SetMemberBinder.cs
- ContractCodeDomInfo.cs
- _NestedSingleAsyncResult.cs
- InfoCardProofToken.cs
- MessageBox.cs
- ApplicationManager.cs
- SafeArchiveContext.cs
- OleDbParameterCollection.cs
- FixedPageStructure.cs
- StringReader.cs
- BamlTreeUpdater.cs
- OutOfProcStateClientManager.cs
- ProxyWebPartManager.cs
- GenericEnumConverter.cs
- ScrollProperties.cs
- OdbcReferenceCollection.cs
- KeyFrames.cs
- PostBackOptions.cs
- ToolStripDropDownClosingEventArgs.cs
- ReceiveActivityValidator.cs
- MatchAttribute.cs
- TakeOrSkipWhileQueryOperator.cs
- DesignerForm.cs
- hebrewshape.cs
- WebHttpEndpoint.cs
- PointCollection.cs
- _ListenerAsyncResult.cs
- UInt32.cs
- DataMisalignedException.cs
- ConnectionsZone.cs
- BasePropertyDescriptor.cs
- ControlCollection.cs
- Quaternion.cs
- FunctionCommandText.cs
- ConstantSlot.cs
- Setter.cs
- IDReferencePropertyAttribute.cs
- LicenseProviderAttribute.cs
- AsyncPostBackErrorEventArgs.cs
- SettingsBase.cs
- FontStretchConverter.cs
- DataGridViewCellStyleChangedEventArgs.cs
- CombinedGeometry.cs
- HttpCacheVary.cs