TransactionScope.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Behaviors / TransactionScope.cs / 1305376 / TransactionScope.cs

                            namespace System.Workflow.ComponentModel 
{
    #region Imports

    using System; 
    using System.ComponentModel;
    using System.Drawing; 
    using System.Workflow.ComponentModel; 
    using System.Workflow.ComponentModel.Design;
    using System.Workflow.ComponentModel.Compiler; 
    using System.ComponentModel.Design;

    #endregion
 
    [SRDescription(SR.TransactionalContextActivityDescription)]
    [ToolboxItem(typeof(ActivityToolboxItem))] 
    [ToolboxBitmap(typeof(TransactionScopeActivity), "Resources.Sequence.png")] 
    [Designer(typeof(TransactionScopeActivityDesigner), typeof(IDesigner))]
    [PersistOnClose] 
    [SupportsTransaction]
    public sealed class TransactionScopeActivity : CompositeActivity, IActivityEventListener
    {
        internal static readonly DependencyProperty TransactionOptionsProperty = DependencyProperty.Register("TransactionOptions", typeof(WorkflowTransactionOptions), typeof(TransactionScopeActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata, new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content) })); 
        internal static readonly string TransactionScopeActivityIsolationHandle = "A1DAF1E7-E9E7-4df2-B88F-3A92E1D744F2";
 
        public TransactionScopeActivity() 
        {
            this.SetValueBase(TransactionOptionsProperty, new WorkflowTransactionOptions()); 
        }

        public TransactionScopeActivity(string name)
            : base(name) 
        {
            this.SetValueBase(TransactionOptionsProperty, new WorkflowTransactionOptions()); 
        } 

        //[SRDisplayName(SR.Transaction)] 
        [SRDescription(SR.TransactionDesc)]
        [MergableProperty(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [ReadOnly(true)] 
        public WorkflowTransactionOptions TransactionOptions
        { 
            get 
            {
                return (WorkflowTransactionOptions)this.GetValue(TransactionOptionsProperty); 
            }

            set
            { 
                SetValue(TransactionOptionsProperty, value);
            } 
        } 

        protected internal override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) 
        {
            return SequenceHelper.Execute(this, executionContext);
        }
 
        protected internal override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext)
        { 
            return SequenceHelper.Cancel(this, executionContext); 
        }
 
        void IActivityEventListener.OnEvent(Object sender, ActivityExecutionStatusChangedEventArgs e)
        {
            SequenceHelper.OnEvent(this, sender, e);
        } 

        protected internal override void OnActivityChangeRemove(ActivityExecutionContext executionContext, Activity removedActivity) 
        { 
            SequenceHelper.OnActivityChangeRemove(this, executionContext, removedActivity);
        } 

        protected internal override void OnWorkflowChangesCompleted(ActivityExecutionContext executionContext)
        {
            SequenceHelper.OnWorkflowChangesCompleted(this, executionContext); 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace System.Workflow.ComponentModel 
{
    #region Imports

    using System; 
    using System.ComponentModel;
    using System.Drawing; 
    using System.Workflow.ComponentModel; 
    using System.Workflow.ComponentModel.Design;
    using System.Workflow.ComponentModel.Compiler; 
    using System.ComponentModel.Design;

    #endregion
 
    [SRDescription(SR.TransactionalContextActivityDescription)]
    [ToolboxItem(typeof(ActivityToolboxItem))] 
    [ToolboxBitmap(typeof(TransactionScopeActivity), "Resources.Sequence.png")] 
    [Designer(typeof(TransactionScopeActivityDesigner), typeof(IDesigner))]
    [PersistOnClose] 
    [SupportsTransaction]
    public sealed class TransactionScopeActivity : CompositeActivity, IActivityEventListener
    {
        internal static readonly DependencyProperty TransactionOptionsProperty = DependencyProperty.Register("TransactionOptions", typeof(WorkflowTransactionOptions), typeof(TransactionScopeActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata, new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content) })); 
        internal static readonly string TransactionScopeActivityIsolationHandle = "A1DAF1E7-E9E7-4df2-B88F-3A92E1D744F2";
 
        public TransactionScopeActivity() 
        {
            this.SetValueBase(TransactionOptionsProperty, new WorkflowTransactionOptions()); 
        }

        public TransactionScopeActivity(string name)
            : base(name) 
        {
            this.SetValueBase(TransactionOptionsProperty, new WorkflowTransactionOptions()); 
        } 

        //[SRDisplayName(SR.Transaction)] 
        [SRDescription(SR.TransactionDesc)]
        [MergableProperty(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [ReadOnly(true)] 
        public WorkflowTransactionOptions TransactionOptions
        { 
            get 
            {
                return (WorkflowTransactionOptions)this.GetValue(TransactionOptionsProperty); 
            }

            set
            { 
                SetValue(TransactionOptionsProperty, value);
            } 
        } 

        protected internal override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) 
        {
            return SequenceHelper.Execute(this, executionContext);
        }
 
        protected internal override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext)
        { 
            return SequenceHelper.Cancel(this, executionContext); 
        }
 
        void IActivityEventListener.OnEvent(Object sender, ActivityExecutionStatusChangedEventArgs e)
        {
            SequenceHelper.OnEvent(this, sender, e);
        } 

        protected internal override void OnActivityChangeRemove(ActivityExecutionContext executionContext, Activity removedActivity) 
        { 
            SequenceHelper.OnActivityChangeRemove(this, executionContext, removedActivity);
        } 

        protected internal override void OnWorkflowChangesCompleted(ActivityExecutionContext executionContext)
        {
            SequenceHelper.OnWorkflowChangesCompleted(this, executionContext); 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK