Пример #1
0
        internal static void Run()
        {
            SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

            DbProviderFactoriesCore.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);
            DbProviderFactoriesCore.RegisterFactory("System.Data.SqlServerCe.3.5", SqlCeProviderFactory.Instance);
            DbProviderFactoriesCore.RegisterFactory("System.Data.SqlServerCe.4.0", SqlCeProviderFactory.Instance);
        }
        public static void Initialize()
        {
            // TODO: ZZZ - Can we remove this?
#if NETSTANDARD
            DbProviderFactoriesCore.RegisterFactory("System.Data.FakeSqlClient", FakeSqlProviderFactory.Instance);
#endif
            // Does nothing but ensures that the singleton instance has been created.
        }
        private static void RegisterAdoNetProvider(Type providerFactoryType)
        {
            DbProviderFactoriesCore.RegisterFactory(SqlClientInvariantName, providerFactoryType);

            //var row = _providerTable.NewRow();
            //row["Name"] = "SqlClient Data Provider";
            //row["Description"] = ".Net Framework Data Provider for SqlServer";
            //row["InvariantName"] = SqlClientInvariantName;
            //row["AssemblyQualifiedName"] = providerFactoryType.AssemblyQualifiedName;

            //_providerTable.Rows.Remove(_providerTable.Rows.Find(SqlClientInvariantName));
            //_providerTable.Rows.Add(row);
        }
Пример #4
0
        private GenericProviderFactory()
        {
            DbProviderFactoriesCore.RegisterFactory("My.Generic.Provider.DbProviderFactory", this);

            //var providerTable =
            //    (DataTable)
            //    typeof(DbProviderFactories).GetOnlyDeclaredMethod("GetProviderTable").Invoke(null, null);

            //var row = providerTable.NewRow();
            //row["Name"] = "GenericProviderFactory";
            //row["InvariantName"] = InvariantProviderName;
            //row["Description"] = "Fake GenericProviderFactory";
            //row["AssemblyQualifiedName"] = GetType().AssemblyQualifiedName;
            //providerTable.Rows.Add(row);
        }
        private static void RegisterAdoNetProvider(Type providerFactoryType)
        {
#if NETSTANDARD
            // TODO: ZZZ - Restore old way to register?
            DbProviderFactoriesCore.RegisterFactory(SqlClientInvariantName, providerFactoryType);
#else
            var row = _providerTable.NewRow();
            row["Name"]                  = "SqlClient Data Provider";
            row["Description"]           = ".Net Framework Data Provider for SqlServer";
            row["InvariantName"]         = SqlClientInvariantName;
            row["AssemblyQualifiedName"] = providerFactoryType.AssemblyQualifiedName;

            _providerTable.Rows.Remove(_providerTable.Rows.Find(SqlClientInvariantName));
            _providerTable.Rows.Add(row);
#endif
        }
Пример #6
0
        private GenericProviderFactory()
        {
            // TODO: ZZZ - It's normal way or we should change it?
#if NETSTANDARD
            DbProviderFactoriesCore.RegisterFactory("My.Generic.Provider.DbProviderFactory", this);
#else
            var providerTable =
                (DataTable)
                typeof(DbProviderFactories).GetOnlyDeclaredMethod("GetProviderTable").Invoke(null, null);

            var row = providerTable.NewRow();
            row["Name"]                  = "GenericProviderFactory";
            row["InvariantName"]         = InvariantProviderName;
            row["Description"]           = "Fake GenericProviderFactory";
            row["AssemblyQualifiedName"] = GetType().AssemblyQualifiedName;
            providerTable.Rows.Add(row);
#endif
        }
        // TODO: ZZZ - Can we remove this?
#if NETSTANDARD
        static FakeSqlProviderServices()
        {
            DbProviderFactoriesCore.RegisterFactory("System.Data.FakeSqlClient", FakeSqlProviderFactory.Instance);
        }
 static FakeSqlConnection()
 {
     DbProviderFactoriesCore.RegisterFactory("System.Data.FakeSqlClient", FakeSqlProviderFactory.Instance);
 }
        public static void Initialize()
        {
            DbProviderFactoriesCore.RegisterFactory("System.Data.FakeSqlClient", FakeSqlProviderFactory.Instance);

            // Does nothing but ensures that the singleton instance has been created.
        }