InstanceOwnerQueryResult.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 / InstanceOwnerQueryResult.cs / 1305376 / InstanceOwnerQueryResult.cs

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

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

    [Fx.Tag.XamlVisible(false)] 
    public sealed class InstanceOwnerQueryResult : InstanceStoreQueryResult
    {
        static readonly ReadOnlyDictionary> EmptyQueryResult = new ReadOnlyDictionary>(new Dictionary>(0), false);
        static readonly ReadOnlyDictionary EmptyMetadata = new ReadOnlyDictionary(new Dictionary(0), false); 

        // Zero 
        public InstanceOwnerQueryResult() 
        {
            InstanceOwners = EmptyQueryResult; 
        }

        // One
        public InstanceOwnerQueryResult(Guid instanceOwnerId, IDictionary metadata) 
        {
            Dictionary> owners = new Dictionary>(1); 
            owners.Add(instanceOwnerId, metadata == null ? EmptyMetadata : metadata.IsReadOnly ? metadata : new ReadOnlyDictionary(metadata)); 
            InstanceOwners = new ReadOnlyDictionary>(owners, false);
        } 

        // N
        public InstanceOwnerQueryResult(IDictionary> instanceOwners)
        { 
            Dictionary> owners = new Dictionary>(instanceOwners.Count);
            foreach (KeyValuePair> metadata in instanceOwners) 
            { 
                owners.Add(metadata.Key, metadata.Value == null ? EmptyMetadata : metadata.Value.IsReadOnly ? metadata.Value : new ReadOnlyDictionary(metadata.Value));
            } 
            InstanceOwners = new ReadOnlyDictionary>(owners, false);
        }

        public IDictionary> InstanceOwners { get; private set; } 
    }
} 

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

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

    [Fx.Tag.XamlVisible(false)] 
    public sealed class InstanceOwnerQueryResult : InstanceStoreQueryResult
    {
        static readonly ReadOnlyDictionary> EmptyQueryResult = new ReadOnlyDictionary>(new Dictionary>(0), false);
        static readonly ReadOnlyDictionary EmptyMetadata = new ReadOnlyDictionary(new Dictionary(0), false); 

        // Zero 
        public InstanceOwnerQueryResult() 
        {
            InstanceOwners = EmptyQueryResult; 
        }

        // One
        public InstanceOwnerQueryResult(Guid instanceOwnerId, IDictionary metadata) 
        {
            Dictionary> owners = new Dictionary>(1); 
            owners.Add(instanceOwnerId, metadata == null ? EmptyMetadata : metadata.IsReadOnly ? metadata : new ReadOnlyDictionary(metadata)); 
            InstanceOwners = new ReadOnlyDictionary>(owners, false);
        } 

        // N
        public InstanceOwnerQueryResult(IDictionary> instanceOwners)
        { 
            Dictionary> owners = new Dictionary>(instanceOwners.Count);
            foreach (KeyValuePair> metadata in instanceOwners) 
            { 
                owners.Add(metadata.Key, metadata.Value == null ? EmptyMetadata : metadata.Value.IsReadOnly ? metadata.Value : new ReadOnlyDictionary(metadata.Value));
            } 
            InstanceOwners = new ReadOnlyDictionary>(owners, false);
        }

        public IDictionary> InstanceOwners { get; private set; } 
    }
} 

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