SqlClientFactory.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Data / System / Data / SqlClient / SqlClientFactory.cs / 1 / SqlClientFactory.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
// [....]
//----------------------------------------------------------------------------- 
 
using System;
using System.Data; 
using System.Data.Common;
using System.Data.Sql;
using System.Security;
using System.Security.Permissions; 

namespace System.Data.SqlClient { 
 
#if WINFSInternalOnly
    internal 
#else
    public
#endif
    sealed class SqlClientFactory : DbProviderFactory, IServiceProvider { 

        public static readonly SqlClientFactory Instance = new SqlClientFactory(); 
 
        private SqlClientFactory() {
        } 

        public override bool CanCreateDataSourceEnumerator {
            get {
                return true; 
            }
        } 
 
        public override DbCommand CreateCommand() {
            return new SqlCommand(); 
        }

        public override DbCommandBuilder CreateCommandBuilder() {
            return new SqlCommandBuilder(); 
        }
 
        public override DbConnection CreateConnection() { 
            return new SqlConnection();
        } 

        public override DbConnectionStringBuilder CreateConnectionStringBuilder() {
            return new SqlConnectionStringBuilder();
        } 

        public override DbDataAdapter CreateDataAdapter() { 
            return new SqlDataAdapter(); 
        }
 
        public override DbParameter CreateParameter() {
            return new SqlParameter();
        }
 
        public override CodeAccessPermission CreatePermission(PermissionState state) {
            return new SqlClientPermission(state); 
        } 

        public override DbDataSourceEnumerator CreateDataSourceEnumerator() { 
            return SqlDataSourceEnumerator.Instance;
        }

        ///  
        /// Extension mechanism for additional services; currently the only service
        /// supported is the DbProviderServices 
        ///  
        /// requested service provider or null.
        object IServiceProvider.GetService(Type serviceType) { 
            object result = null;
            if (serviceType == GreenMethods.SystemDataCommonDbProviderServices_Type) {
                result = GreenMethods.SystemDataSqlClientSqlProviderServices_Instance();
            } 
            return result;
        } 
    } 
}
 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
// [....]
//----------------------------------------------------------------------------- 
 
using System;
using System.Data; 
using System.Data.Common;
using System.Data.Sql;
using System.Security;
using System.Security.Permissions; 

namespace System.Data.SqlClient { 
 
#if WINFSInternalOnly
    internal 
#else
    public
#endif
    sealed class SqlClientFactory : DbProviderFactory, IServiceProvider { 

        public static readonly SqlClientFactory Instance = new SqlClientFactory(); 
 
        private SqlClientFactory() {
        } 

        public override bool CanCreateDataSourceEnumerator {
            get {
                return true; 
            }
        } 
 
        public override DbCommand CreateCommand() {
            return new SqlCommand(); 
        }

        public override DbCommandBuilder CreateCommandBuilder() {
            return new SqlCommandBuilder(); 
        }
 
        public override DbConnection CreateConnection() { 
            return new SqlConnection();
        } 

        public override DbConnectionStringBuilder CreateConnectionStringBuilder() {
            return new SqlConnectionStringBuilder();
        } 

        public override DbDataAdapter CreateDataAdapter() { 
            return new SqlDataAdapter(); 
        }
 
        public override DbParameter CreateParameter() {
            return new SqlParameter();
        }
 
        public override CodeAccessPermission CreatePermission(PermissionState state) {
            return new SqlClientPermission(state); 
        } 

        public override DbDataSourceEnumerator CreateDataSourceEnumerator() { 
            return SqlDataSourceEnumerator.Instance;
        }

        ///  
        /// Extension mechanism for additional services; currently the only service
        /// supported is the DbProviderServices 
        ///  
        /// requested service provider or null.
        object IServiceProvider.GetService(Type serviceType) { 
            object result = null;
            if (serviceType == GreenMethods.SystemDataCommonDbProviderServices_Type) {
                result = GreenMethods.SystemDataSqlClientSqlProviderServices_Instance();
            } 
            return result;
        } 
    } 
}
 

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