当前位置: 首页>>代码示例>>C#>>正文


C# DatabaseProviderFactory.CreateDatabase方法代码示例

本文整理汇总了C#中DatabaseProviderFactory.CreateDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseProviderFactory.CreateDatabase方法的具体用法?C# DatabaseProviderFactory.CreateDatabase怎么用?C# DatabaseProviderFactory.CreateDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DatabaseProviderFactory的用法示例。


在下文中一共展示了DatabaseProviderFactory.CreateDatabase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CallingTwiceReturnsDifferenceDatabaseInstances

        public void CallingTwiceReturnsDifferenceDatabaseInstances()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
            Database firstDb = factory.CreateDatabase("NewDatabase");
            Database secondDb = factory.CreateDatabase("NewDatabase");

            Assert.IsFalse(firstDb == secondDb);
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:8,代码来源:DatabaseFactoryFixture.cs

示例2: SetUp

 public void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
     this.db = factory.CreateDatabase("DB2Test");
     this.dataSet = new DataSet();
     this.command = this.db.GetSqlStringCommandWrapper(this.sqlQuery);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:7,代码来源:DB2DataAccessTestsFixture.cs

示例3: SetUp

 public void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     this.db = factory.CreateDatabase("OracleTest");
     this.sqlCommand = "Select count(*) from region";
     this.command = this.db.GetSqlStringCommandWrapper(this.sqlCommand);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:7,代码来源:OracleExecuteScalarFixture.cs

示例4: SetUp

 public void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
     this.db = factory.CreateDatabase("DB2Test");
     this.queryString = "Select * from Region";
     this.insertString = "Insert into Region values (99, 'Midwest')";
     this.insertCommand = this.db.GetSqlStringCommandWrapper(this.insertString);
     this.queryCommand = this.db.GetSqlStringCommandWrapper(this.queryString);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:9,代码来源:DB2ExecuteReaderFixture.cs

示例5: SetUp

        public void SetUp()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
            this.db = factory.CreateDatabase("DB2Test");
            this.insertString = "insert into Region values (77, 'Elbonia')";
            this.insertionCommand = this.db.GetSqlStringCommandWrapper(this.insertString);

            this.countQuery = "select count(*) from Region";
            this.countCommand = this.db.GetSqlStringCommandWrapper(this.countQuery);
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:10,代码来源:DB2ExecuteNonQueryFixture.cs

示例6: SetUp

 public void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     this.db = factory.CreateDatabase("OracleTest");
     storedProcedure = db.GetStoredProcCommandWrapper("CustOrdersOrders", "ALFKI", null);
     connection = db.GetConnection();
     connection.Open();
     storedProcedure.Command.Connection = connection;
     cache = new ParameterCache();
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:10,代码来源:OracleParameterDiscoveryFixture.cs

示例7: Initialize

 public void Initialize()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
     this.db = factory.CreateDatabase("DB2Test");
     try
     {
         DeleteStoredProcedures();
     }
     catch
     {
     }
     CreateStoredProcedures();
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:13,代码来源:DB2UpdateDataSetBehaviorsFixture.cs

示例8: Initialize

 public void Initialize()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     this.db = factory.CreateDatabase("OracleTest");
     // ensure that stored procedures are dropped before trying to create them
     try
     {
         DeleteStoredProcedures();
     }
     catch
     {
     }
     CreateStoredProcedures();
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:14,代码来源:OracleUpdateDataSetBehaviorsFixture.cs

示例9: CanInsertNullStringParameter

        public void CanInsertNullStringParameter()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
            Database db = factory.CreateDatabase("DB2Test");
            using (IDbConnection connection = db.GetConnection())
            {
                connection.Open();
                using (IDbTransaction transaction = connection.BeginTransaction())
                {
                    string sqlString = "insert into Orders (OrderID, ShipName) Values (?, ?)";
                    DBCommandWrapper insert = db.GetSqlStringCommandWrapper(sqlString);
                    insert.AddInParameter("@Param1", DbType.Int32, 1);
                    insert.AddInParameter("@Param2", DbType.String, null);

                    db.ExecuteNonQuery(insert, transaction);
                    transaction.Rollback();
                }
            }
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:19,代码来源:DB2ParameterFixture.cs

示例10: CanInsertNullStringParameter

        public void CanInsertNullStringParameter()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
            Database db = factory.CreateDatabase("OracleTest");
            using (IDbConnection connection = db.GetConnection())
            {
                connection.Open();
                using (IDbTransaction transaction = connection.BeginTransaction())
                {
                    string sqlString = "insert into Customers (CustomerID, CompanyName, ContactName) Values (:id, :name, :contact)";
                    DBCommandWrapper insert = db.GetSqlStringCommandWrapper(sqlString);
                    insert.AddInParameter(":id", DbType.Int32, 1);
                    insert.AddInParameter(":name", DbType.String, "fee");
                    insert.AddInParameter(":contact", DbType.String, null);

                    db.ExecuteNonQuery(insert, transaction);
                    transaction.Rollback();
                }
            }
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:20,代码来源:OracleParameterFixture.cs

示例11: ExceptionThrownWhenAskingForDatabaseWithUnknownName

 public void ExceptionThrownWhenAskingForDatabaseWithUnknownName()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     Database db = factory.CreateDatabase("ThisIsAnUnknownKey");
     Assert.IsNotNull(db);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:6,代码来源:DatabaseFactoryFixture.cs

示例12: CanGetDatabaseByName

 public void CanGetDatabaseByName()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     Database db = factory.CreateDatabase("NewDatabase");
     Assert.IsNotNull(db);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:6,代码来源:DatabaseFactoryFixture.cs

示例13: SetUp

 public void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     this.db = factory.CreateDatabase("OracleTest");
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:5,代码来源:OracleParameterizedSqlStringFixture.cs

示例14: UseParameterCachingWithPersistSecurityInfoFalse

        public void UseParameterCachingWithPersistSecurityInfoFalse()
        {
            try
            {
                DeleteUser();
                CreateUser();

                DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
                Database dbsec = factory.CreateDatabase("NorthwindPersistFalse");
                connection = dbsec.GetConnection();
                connection.Open();

                DBCommandWrapper storedProc1 = dbsec.GetStoredProcCommandWrapper("CustOrdersOrders", "ALFKI");
                storedProc1.Command.Connection = connection;
                TestCache testCache = new TestCache();
                testCache.FillParameters(storedProc1, '@');

                DBCommandWrapper storedProc2 = dbsec.GetStoredProcCommandWrapper("CustOrdersOrders", "ALFKI");
                storedProc2.Command.Connection = connection;
                testCache.FillParameters(storedProc2, '@');

                Assert.IsTrue(testCache.CacheUsed);
            }
            finally
            {
                DeleteUser();
            }
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:28,代码来源:SqlParameterDiscoveryFixture.cs

示例15: SetUp

 public override void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
     this.db = factory.CreateDatabase("DB2Test");
     base.SetUp();
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:6,代码来源:DB2StoredProcedureCreatingFixture.cs


注:本文中的DatabaseProviderFactory.CreateDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。