本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例7: Initialize
public void Initialize()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
this.db = factory.CreateDatabase("DB2Test");
try
{
DeleteStoredProcedures();
}
catch
{
}
CreateStoredProcedures();
}
示例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();
}
示例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();
}
}
}
示例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();
}
}
}
示例11: ExceptionThrownWhenAskingForDatabaseWithUnknownName
public void ExceptionThrownWhenAskingForDatabaseWithUnknownName()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
Database db = factory.CreateDatabase("ThisIsAnUnknownKey");
Assert.IsNotNull(db);
}
示例12: CanGetDatabaseByName
public void CanGetDatabaseByName()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
Database db = factory.CreateDatabase("NewDatabase");
Assert.IsNotNull(db);
}
示例13: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
this.db = factory.CreateDatabase("OracleTest");
}
示例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();
}
}
示例15: SetUp
public override void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new Db2TestConfigurationContext());
this.db = factory.CreateDatabase("DB2Test");
base.SetUp();
}