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


C# DatabaseProviderFactory.CreateDefaultDatabase方法代码示例

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


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

示例1: SetUp

        public void SetUp()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
            this.db = factory.CreateDefaultDatabase();

            this.sqlCommand = "Select count(*) from region";
            this.command = this.db.GetSqlStringCommandWrapper(this.sqlCommand);
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:8,代码来源:SqlExecuteScalarFixture.cs

示例2: SetUp

 public void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     this.db = factory.CreateDefaultDatabase();
     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,代码来源:SqlExecuteReaderFixture.cs

示例3: SetUp

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

示例4: SetUp

        public void SetUp()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
            this.db = factory.CreateDefaultDatabase();
            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,代码来源:SqlExecuteNonQueryFixture.cs

示例5: OneTimeSetUp

 public void OneTimeSetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     db = factory.CreateDefaultDatabase();
     try
     {
         DeleteStoredProcedures();
     }
     catch
     {
     }
     CreateStoredProcedures();
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:13,代码来源:SqlUpdateDataSetFixture.cs

示例6: CanInsertNullStringParameter

        public void CanInsertNullStringParameter()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
            Database db = factory.CreateDefaultDatabase();
            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,代码来源:SqlParameterFixture.cs

示例7: CanCreateDefaultDatabase

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

示例8: SetUp

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

示例9: DeleteUser

 private void DeleteUser()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     Database adminDb = factory.CreateDefaultDatabase();
     connection = adminDb.GetConnection();
     connection.Open();
     string query;
     DBCommandWrapper dropUser;
     try
     {
         query = "exec sp_revokedbaccess 'entlib'";
         dropUser = adminDb.GetSqlStringCommandWrapper(query);
         adminDb.ExecuteNonQuery(dropUser);
     }
     catch
     {
     }
     try
     {
         query = "exec sp_droplogin 'entlib'";
         dropUser = adminDb.GetSqlStringCommandWrapper(query);
         adminDb.ExecuteNonQuery(dropUser);
     }
     catch
     {
     }
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:27,代码来源:SqlParameterDiscoveryFixture.cs

示例10: CreateUser

 private void CreateUser()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     Database adminDb = factory.CreateDefaultDatabase();
     connection = adminDb.GetConnection();
     connection.Open();
     string query;
     DBCommandWrapper addUser;
     try
     {
         query = "exec sp_addlogin 'entlib', 'sunrain', 'Northwind'";
         addUser = adminDb.GetSqlStringCommandWrapper(query);
         adminDb.ExecuteNonQuery(addUser);
     }
     catch
     {
     }
     try
     {
         query = "exec sp_grantdbaccess 'entlib', 'entlib'";
         addUser = adminDb.GetSqlStringCommandWrapper(query);
         adminDb.ExecuteNonQuery(addUser);
     }
     catch
     {
     }
     try
     {
         query = "exec sp_addrolemember N'db_owner', N'entlib'";
         addUser = adminDb.GetSqlStringCommandWrapper(query);
         adminDb.ExecuteNonQuery(addUser);
     }
     catch
     {
     }
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:36,代码来源:SqlParameterDiscoveryFixture.cs

示例11: SetUp

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

示例12: SetUp

 public void SetUp()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
     sqlDatabase = (SqlDatabase)factory.CreateDefaultDatabase();
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:5,代码来源:ExecuteXmlReaderFixture.cs


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