PersistenceParticipant.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / DurableInstancing / PersistenceParticipant.cs / 1305376 / PersistenceParticipant.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities.Persistence 
{
    using System; 
    using System.Collections.Generic; 
    using System.Diagnostics.CodeAnalysis;
    using System.Runtime; 
    using System.Xml.Linq;

    public abstract class PersistenceParticipant : IPersistencePipelineModule
    { 
        bool isSaveTransactionRequired;
        bool isLoadTransactionRequired; 
        bool isIOParticipant; 

        protected PersistenceParticipant() 
        {
        }

        internal PersistenceParticipant(bool isSaveTransactionRequired, bool isLoadTransactionRequired) 
        {
            this.isIOParticipant = true; 
            this.isSaveTransactionRequired = isSaveTransactionRequired; 
            this.isLoadTransactionRequired = isLoadTransactionRequired;
        } 

        [SuppressMessage(FxCop.Category.Design, FxCop.Rule.AvoidOutParameters,
            Justification = "arch approved design. requires the two out dictionaries to avoid complex structures")]
        protected virtual void CollectValues(out IDictionary readWriteValues, out IDictionary writeOnlyValues) 
        {
            readWriteValues = null; 
            writeOnlyValues = null; 
        }
 
        // Passed-in dictionaries are read-only.
        protected virtual IDictionary MapValues(IDictionary readWriteValues, IDictionary writeOnlyValues)
        {
            return null; 
        }
 
        // Passed-in dictionary is read-only. 
        protected virtual void PublishValues(IDictionary readWriteValues)
        { 
        }

        void IPersistencePipelineModule.CollectValues(out IDictionary readWriteValues, out IDictionary writeOnlyValues)
        { 
            CollectValues(out readWriteValues, out writeOnlyValues);
        } 
 
        IDictionary IPersistencePipelineModule.MapValues(IDictionary readWriteValues, IDictionary writeOnlyValues)
        { 
            return MapValues(readWriteValues, writeOnlyValues);
        }

        void IPersistencePipelineModule.PublishValues(IDictionary readWriteValues) 
        {
            PublishValues(readWriteValues); 
        } 

        bool IPersistencePipelineModule.IsIOParticipant 
        {
            get
            {
                return this.isIOParticipant; 
            }
        } 
 
        bool IPersistencePipelineModule.IsSaveTransactionRequired
        { 
            get
            {
                return this.isSaveTransactionRequired;
            } 
        }
 
        bool IPersistencePipelineModule.IsLoadTransactionRequired 
        {
            get 
            {
                return this.isLoadTransactionRequired;
            }
        } 

        IAsyncResult IPersistencePipelineModule.BeginOnSave(IDictionary readWriteValues, IDictionary writeOnlyValues, TimeSpan timeout, AsyncCallback callback, object state) 
        { 
            return InternalBeginOnSave(readWriteValues, writeOnlyValues, timeout, callback, state);
        } 

        void IPersistencePipelineModule.EndOnSave(IAsyncResult result)
        {
            InternalEndOnSave(result); 
        }
 
        IAsyncResult IPersistencePipelineModule.BeginOnLoad(IDictionary readWriteValues, TimeSpan timeout, AsyncCallback callback, object state) 
        {
            return InternalBeginOnLoad(readWriteValues, timeout, callback, state); 
        }

        void IPersistencePipelineModule.EndOnLoad(IAsyncResult result)
        { 
            InternalEndOnLoad(result);
        } 
 
        void IPersistencePipelineModule.Abort()
        { 
            InternalAbort();
        }

        internal virtual IAsyncResult InternalBeginOnSave(IDictionary readWriteValues, IDictionary writeOnlyValues, TimeSpan timeout, AsyncCallback callback, object state) 
        {
            throw Fx.AssertAndThrow("BeginOnSave should not be called on PersistenceParticipant."); 
        } 

        internal virtual void InternalEndOnSave(IAsyncResult result) 
        {
            Fx.Assert("EndOnSave should not be called on PersistenceParticipant.");
        }
 
        internal virtual IAsyncResult InternalBeginOnLoad(IDictionary readWriteValues, TimeSpan timeout, AsyncCallback callback, object state)
        { 
            throw Fx.AssertAndThrow("BeginOnLoad should not be called on PersistenceParticipant."); 
        }
 
        internal virtual void InternalEndOnLoad(IAsyncResult result)
        {
            Fx.Assert("EndOnLoad should not be called on PersistenceParticipant.");
        } 

        internal virtual void InternalAbort() 
        { 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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