本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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);
}
示例5: OneTimeSetUp
public void OneTimeSetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
db = factory.CreateDefaultDatabase();
try
{
DeleteStoredProcedures();
}
catch
{
}
CreateStoredProcedures();
}
示例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();
}
}
}
示例7: CanCreateDefaultDatabase
public void CanCreateDefaultDatabase()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
Database db = factory.CreateDefaultDatabase();
Assert.IsNotNull(db);
}
示例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);
}
示例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
{
}
}
示例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
{
}
}
示例11: SetUp
public override void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
db = factory.CreateDefaultDatabase();
base.SetUp();
}
示例12: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(new TestConfigurationContext());
sqlDatabase = (SqlDatabase)factory.CreateDefaultDatabase();
}