InstanceKeyView.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 / System.Runtime.DurableInstancing / System / Runtime / DurableInstancing / InstanceKeyView.cs / 1305376 / InstanceKeyView.cs

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

namespace System.Runtime.DurableInstancing 
{
    using System; 
    using System.Collections.Generic; 
    using System.Runtime;
    using System.Xml.Linq; 

    [Fx.Tag.XamlVisible(false)]
    public sealed class InstanceKeyView
    { 
        static readonly ReadOnlyDictionary emptyProperties = new ReadOnlyDictionary(new Dictionary(0), false);
 
        IDictionary metadata; 
        Dictionary accumulatedMetadataWrites;
 
        internal InstanceKeyView(Guid key)
        {
            InstanceKey = key;
            InstanceKeyMetadataConsistency = InstanceValueConsistency.InDoubt | InstanceValueConsistency.Partial; 
        }
 
        InstanceKeyView(InstanceKeyView source) 
        {
            InstanceKey = source.InstanceKey; 
            InstanceKeyState = source.InstanceKeyState;

            InstanceKeyMetadata = source.InstanceKeyMetadata;
            InstanceKeyMetadataConsistency = source.InstanceKeyMetadataConsistency; 
        }
 
        public Guid InstanceKey { get; private set; } 
        public InstanceKeyState InstanceKeyState { get; internal set; }
 
        public InstanceValueConsistency InstanceKeyMetadataConsistency { get; internal set; }
        public IDictionary InstanceKeyMetadata
        {
            get 
            {
                IDictionary pendingWrites = this.accumulatedMetadataWrites; 
                this.accumulatedMetadataWrites = null; 
                this.metadata = pendingWrites.ReadOnlyMergeInto(this.metadata ?? InstanceKeyView.emptyProperties, true);
                return this.metadata; 
            }
            internal set
            {
                this.accumulatedMetadataWrites = null; 
                this.metadata = value;
            } 
        } 
        internal Dictionary AccumulatedMetadataWrites
        { 
            get
            {
                if (this.accumulatedMetadataWrites == null)
                { 
                    this.accumulatedMetadataWrites = new Dictionary();
                } 
                return this.accumulatedMetadataWrites; 
            }
        } 

        internal InstanceKeyView Clone()
        {
            return new InstanceKeyView(this); 
        }
    } 
} 

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

namespace System.Runtime.DurableInstancing 
{
    using System; 
    using System.Collections.Generic; 
    using System.Runtime;
    using System.Xml.Linq; 

    [Fx.Tag.XamlVisible(false)]
    public sealed class InstanceKeyView
    { 
        static readonly ReadOnlyDictionary emptyProperties = new ReadOnlyDictionary(new Dictionary(0), false);
 
        IDictionary metadata; 
        Dictionary accumulatedMetadataWrites;
 
        internal InstanceKeyView(Guid key)
        {
            InstanceKey = key;
            InstanceKeyMetadataConsistency = InstanceValueConsistency.InDoubt | InstanceValueConsistency.Partial; 
        }
 
        InstanceKeyView(InstanceKeyView source) 
        {
            InstanceKey = source.InstanceKey; 
            InstanceKeyState = source.InstanceKeyState;

            InstanceKeyMetadata = source.InstanceKeyMetadata;
            InstanceKeyMetadataConsistency = source.InstanceKeyMetadataConsistency; 
        }
 
        public Guid InstanceKey { get; private set; } 
        public InstanceKeyState InstanceKeyState { get; internal set; }
 
        public InstanceValueConsistency InstanceKeyMetadataConsistency { get; internal set; }
        public IDictionary InstanceKeyMetadata
        {
            get 
            {
                IDictionary pendingWrites = this.accumulatedMetadataWrites; 
                this.accumulatedMetadataWrites = null; 
                this.metadata = pendingWrites.ReadOnlyMergeInto(this.metadata ?? InstanceKeyView.emptyProperties, true);
                return this.metadata; 
            }
            internal set
            {
                this.accumulatedMetadataWrites = null; 
                this.metadata = value;
            } 
        } 
        internal Dictionary AccumulatedMetadataWrites
        { 
            get
            {
                if (this.accumulatedMetadataWrites == null)
                { 
                    this.accumulatedMetadataWrites = new Dictionary();
                } 
                return this.accumulatedMetadataWrites; 
            }
        } 

        internal InstanceKeyView Clone()
        {
            return new InstanceKeyView(this); 
        }
    } 
} 

// 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