Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / RunTime / VolatileResourceManager.cs / 1305376 / VolatileResourceManager.cs
#pragma warning disable 1634, 1691
using System;
using System.Diagnostics;
using System.Transactions;
using System.Collections;
using System.Collections.Generic;
using System.Workflow.Runtime.Hosting;
namespace System.Workflow.Runtime
{
///
/// Volatile Resource Manager
///
internal sealed class VolatileResourceManager
{
// members
private WorkBatchCollection _workCollection = new WorkBatchCollection();
private WorkBatch _mergedBatch = null;
// constructor
internal VolatileResourceManager()
{
}
// properties
internal WorkBatchCollection BatchCollection
{
get
{
return _workCollection;
}
}
internal bool IsBatchDirty
{
get
{
IDictionaryEnumerator de = _workCollection.GetEnumerator();
while (de.MoveNext())
{
WorkBatch batch = (WorkBatch)de.Value;
if (batch.IsDirty)
return true;
}
return false;
}
}
WorkBatch GetMergedBatch()
{
return this._workCollection.GetMergedBatch();
}
internal void Commit()
{
_mergedBatch = GetMergedBatch();
Transaction transaction = Transaction.Current;
if (null == transaction)
throw new InvalidOperationException(ExecutionStringManager.NullAmbientTransaction);
// Do Commit Sequence iteration over work collection
_mergedBatch.Commit(transaction);
}
internal void Complete()
{
try
{
_mergedBatch.Complete(true);
}
finally
{
if (_mergedBatch != null)
{
_mergedBatch.Dispose();
_mergedBatch = null;
}
if (_workCollection != null)
{
_workCollection.ClearSubBatches();
}
}
}
internal void HandleFault()
{
//
// We've failed, clear the merged batch
if (_mergedBatch != null)
{
_mergedBatch.Dispose();
_mergedBatch = null;
}
// clear transient batch which holds instance state primarily
if (_workCollection != null)
{
_workCollection.ClearTransientBatch();
}
}
internal void ClearAllBatchedWork()
{
if (_workCollection != null)
_workCollection.RollbackAllBatchedWork();
}
}
}
// 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
- DiagnosticsConfiguration.cs
- TrackBarRenderer.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- SecurityAccessDeniedException.cs
- FrameworkElement.cs
- ScrollEvent.cs
- SafeLibraryHandle.cs
- Cursor.cs
- WebPartCollection.cs
- StateDesigner.cs
- VectorValueSerializer.cs
- _AutoWebProxyScriptEngine.cs
- dbdatarecord.cs
- TextDocumentView.cs
- ComponentRenameEvent.cs
- EnterpriseServicesHelper.cs
- HierarchicalDataBoundControlAdapter.cs
- TypeHelper.cs
- SQlBooleanStorage.cs
- UnSafeCharBuffer.cs
- HostedTcpTransportManager.cs
- SingleAnimationUsingKeyFrames.cs
- GeometryGroup.cs
- ExpandedProjectionNode.cs
- ObjRef.cs
- XPathNode.cs
- Figure.cs
- ExtentCqlBlock.cs
- DecimalConverter.cs
- InputLanguageCollection.cs
- ConnectionPointCookie.cs
- XmlMapping.cs
- UInt16Converter.cs
- CompoundFileStreamReference.cs
- AppDomain.cs
- HttpListenerPrefixCollection.cs
- DataMisalignedException.cs
- LogPolicy.cs
- SoapTypeAttribute.cs
- CrossSiteScriptingValidation.cs
- SecurityElement.cs
- HuffmanTree.cs
- FileStream.cs
- BigInt.cs
- ScrollChrome.cs
- ipaddressinformationcollection.cs
- MessageQueueAccessControlEntry.cs
- DecoderNLS.cs
- XhtmlBasicLiteralTextAdapter.cs
- JsonDeserializer.cs
- HtmlTableCell.cs
- BaseTemplateParser.cs
- UmAlQuraCalendar.cs
- SqlResolver.cs
- ADRole.cs
- VirtualizingStackPanel.cs
- LambdaCompiler.cs
- odbcmetadatacollectionnames.cs
- DataSetMappper.cs
- SettingsProviderCollection.cs
- DataServiceKeyAttribute.cs
- WebPartCatalogAddVerb.cs
- CompositeFontFamily.cs
- WasAdminWrapper.cs
- Condition.cs
- HttpHandlerAction.cs
- UnsafeNativeMethods.cs
- ToggleButtonAutomationPeer.cs
- XmlAtomicValue.cs
- IConvertible.cs
- FixedSOMFixedBlock.cs
- RelatedView.cs
- DataRowChangeEvent.cs
- XamlHostingSectionGroup.cs
- Section.cs
- HttpApplicationStateBase.cs
- ErrorWrapper.cs
- TextPatternIdentifiers.cs
- DbProviderFactoriesConfigurationHandler.cs
- Pair.cs
- ParameterBuilder.cs
- AtomicFile.cs
- COAUTHIDENTITY.cs
- DataServiceRequest.cs
- XmlReader.cs
- Int64KeyFrameCollection.cs
- ToolStripItemClickedEventArgs.cs
- ExpanderAutomationPeer.cs
- UriSection.cs
- NativeBuffer.cs
- ColumnMapProcessor.cs
- BinaryReader.cs
- SafeBitVector32.cs
- ClientBuildManagerCallback.cs
- StateDesigner.TransitionInfo.cs
- BufferedStream.cs
- TextServicesProperty.cs
- PageParser.cs
- CssClassPropertyAttribute.cs
- TracedNativeMethods.cs