ProviderBase.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Administration / ProviderBase.cs / 1 / ProviderBase.cs

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

namespace System.ServiceModel.Administration 
{
    using System; 
    using System.Diagnostics; 
    using System.Collections;
    using System.Collections.Generic; 
    using System.Globalization;
    using System.Reflection;
    using System.ServiceModel.Channels;
 
    abstract class ProviderBase : IWmiProvider
    { 
        public static void FillCollectionInfo(ICollection info, IWmiInstance instance, string propertyName) 
        {
            DiagnosticUtility.DebugAssert(null != info, ""); 
            DiagnosticUtility.DebugAssert(null != instance, "");
//warning 56507 : Prefer 'string.IsNullOrEmpty(action)' over checks for null and/or emptiness.
#pragma warning suppress 56507 //[....]; Asserting non-null object for marshalling reasons.  Empty string may be valid input.
            DiagnosticUtility.DebugAssert(null != propertyName, ""); 

            string[] data = new string[info.Count]; 
            int i = 0; 
            foreach (object o in info)
            { 
                data[i++] = o.ToString();
            }
            instance.SetProperty(propertyName, data);
        } 

        public static void FillCollectionInfo(IEnumerable info, IWmiInstance instance, string propertyName) 
        { 
            DiagnosticUtility.DebugAssert(null != info, "");
            DiagnosticUtility.DebugAssert(null != instance, ""); 
//warning 56507 : Prefer 'string.IsNullOrEmpty(action)' over checks for null and/or emptiness.
#pragma warning suppress 56507 //[....]; Asserting non-null object for marshalling reasons.  Empty string may be valid input.
            DiagnosticUtility.DebugAssert(null != propertyName, "");
 
            int i = 0;
            foreach (object o in info) 
            { 
                i++;
            } 

            string[] data = new string[i];

            i = 0; 
            foreach (object o in info)
            { 
                data[i++] = o.ToString(); 
            }
            instance.SetProperty(propertyName, data); 
        }

        void IWmiProvider.EnumInstances(IWmiInstances instances)
        { 
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WbemNotSupportedException());
        } 
 
        bool IWmiProvider.GetInstance(IWmiInstance contract)
        { 
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WbemNotSupportedException());
        }

        bool IWmiProvider.PutInstance(IWmiInstance instance) 
        {
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WbemNotSupportedException()); 
        } 

        bool IWmiProvider.DeleteInstance(IWmiInstance instance) 
        {
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WbemNotSupportedException());
        }
 
        bool IWmiProvider.InvokeMethod(IWmiMethodContext method)
        { 
            method.ReturnParameter = 0; 
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WbemNotSupportedException());
        } 
    }
}

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