GreenMethods.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Data / System / Data / Common / GreenMethods.cs / 3 / GreenMethods.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
// [....]
//----------------------------------------------------------------------------- 
 
using System;
using System.Data.Common; 
using System.Diagnostics;
using System.Reflection;
using System.Security.Permissions;
 
namespace System.Data.Common {
    internal static class GreenMethods { 
 
        private const string ExtensionAssemblyRef = "System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=" + AssemblyRef.EcmaPublicKey;
 
        // For performance, we should convert these calls to using DynamicMethod with a Delegate, or
        // even better, friend assemblies if its possible; so far there's only one of these per
        // AppDomain, so we're OK.
 
        //-----------------------------------------------------------------------------
        // Access to the DbProviderServices type 
        private const string SystemDataCommonDbProviderServices_TypeName = "System.Data.Common.DbProviderServices, " + ExtensionAssemblyRef; 
        internal static Type SystemDataCommonDbProviderServices_Type = Type.GetType(SystemDataCommonDbProviderServices_TypeName, false);
 
        //-----------------------------------------------------------------------------
        // Access to the SqlProviderServices class singleton instance;
        private const string SystemDataSqlClientSqlProviderServices_TypeName = "System.Data.SqlClient.SqlProviderServices, " + ExtensionAssemblyRef;
        private static FieldInfo SystemDataSqlClientSqlProviderServices_Instance_FieldInfo; 

        internal static object SystemDataSqlClientSqlProviderServices_Instance() { 
            if (null == SystemDataSqlClientSqlProviderServices_Instance_FieldInfo) { 
                Type t = Type.GetType(SystemDataSqlClientSqlProviderServices_TypeName, false);
 
                if (null != t) {
                    SystemDataSqlClientSqlProviderServices_Instance_FieldInfo = t.GetField("Instance", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
                }
            } 
            object result = SystemDataSqlClientSqlProviderServices_Instance_GetValue();
            return result; 
        } 

        [System.Security.Permissions.ReflectionPermission(System.Security.Permissions.SecurityAction.Assert, MemberAccess=true)] 
        private static object SystemDataSqlClientSqlProviderServices_Instance_GetValue() {
            object result = null;
            if (null != SystemDataSqlClientSqlProviderServices_Instance_FieldInfo) {
                result = SystemDataSqlClientSqlProviderServices_Instance_FieldInfo.GetValue(null); 
            }
            return result; 
        } 

    } 
}

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