本文整理汇总了C#中DatabaseProviderFactory.CreateDefault方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseProviderFactory.CreateDefault方法的具体用法?C# DatabaseProviderFactory.CreateDefault怎么用?C# DatabaseProviderFactory.CreateDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseProviderFactory
的用法示例。
在下文中一共展示了DatabaseProviderFactory.CreateDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
CompleteSetup(db);
}
示例2: Setup
public void Setup()
{
var factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
var db = factory.CreateDefault();
connection = db.CreateConnection();
connection.Open();
}
示例3: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
DbCommand command = db.GetSqlStringCommand("Select count(*) from region");
baseFixture = new ExecuteScalarFixture(db, command);
}
示例4: TestInitialize
public void TestInitialize()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
DbCommand insertCommand = db.GetSqlStringCommand(insertString);
DbCommand queryCommand = db.GetSqlStringCommand(queryString);
baseFixture = new ExecuteReaderFixture(db, insertString, insertCommand, queryString, queryCommand);
}
示例5: CanCreateDefaultDatabaseFromFactory
public void CanCreateDefaultDatabaseFromFactory()
{
var factory = new DatabaseProviderFactory(new SystemConfigurationSource(false).GetSection);
Database createdObject = factory.CreateDefault();
Assert.IsNotNull(createdObject);
Assert.IsInstanceOfType(createdObject, typeof(SqlDatabase));
Assert.AreEqual(@"server=(localdb)\v11.0;database=northwind;integrated security=true;",
createdObject.ConnectionStringWithoutCredentials);
}
示例6: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
DbCommand countCommand = db.GetSqlStringCommand(countQuery);
baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
}
示例7: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
storedProcedure = db.GetStoredProcCommand("CustOrdersOrders");
connection = db.CreateConnection();
connection.Open();
storedProcedure.Connection = connection;
cache = new ParameterCache();
baseFixture = new ParameterDiscoveryFixture(storedProcedure);
}
示例8: TestInitialize
public void TestInitialize()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
try
{
DeleteStoredProcedures();
}
catch { }
CreateStoredProcedures();
base.SetUp();
}
示例9: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
try
{
DeleteStoredProcedures();
}
catch { }
CreateStoredProcedures();
baseFixture = new TransactionScopeFixture(db);
baseFixture.Cleanup();
}
示例10: CanInsertNullStringParameter
public void CanInsertNullStringParameter()
{
Database db = null;
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
using (DbConnection connection = db.CreateConnection())
{
connection.Open();
using (DbTransaction transaction = connection.BeginTransaction())
{
string sqlString = "insert into Customers (CustomerID, CompanyName, ContactName) Values (@id, @name, @contact)";
DbCommand insert = db.GetSqlStringCommand(sqlString);
db.AddInParameter(insert, "@id", DbType.Int32, 1);
db.AddInParameter(insert, "@name", DbType.String, "fee");
db.AddInParameter(insert, "@contact", DbType.String, null);
db.ExecuteNonQuery(insert, transaction);
transaction.Rollback();
}
}
}
示例11: CanExecuteProcedureWithUnicaodeParametersInSql
public void CanExecuteProcedureWithUnicaodeParametersInSql()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
SqlDatabase db = factory.CreateDefault() as SqlDatabase;
object procedureOutput = null;
using (DbConnection connection = db.CreateConnection())
{
connection.Open();
using (DbTransaction transaction = connection.BeginTransaction())
{
db.ExecuteNonQuery(transaction, CommandType.Text, @"CREATE PROCEDURE CanAddSqlTypeParameters @UnicodeParam nvarchar(50) AS SELECT @UnicodeParam");
DbCommand commandToCustOrderHist = db.GetStoredProcCommand("CanAddSqlTypeParameters");
db.AddInParameter(commandToCustOrderHist, "UnicodeParam", SqlDbType.NVarChar, "PROCEDURE INPUT \u0414");
procedureOutput = db.ExecuteScalar(commandToCustOrderHist, transaction);
transaction.Rollback();
}
}
Assert.AreEqual("PROCEDURE INPUT \u0414", procedureOutput);
}
示例12: TestInitialize
public void TestInitialize()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
}
示例13: ThreadTests
public ThreadTests()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
}
示例14: CanCreateDefaultDatabase
public void CanCreateDefaultDatabase()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
Database db = factory.CreateDefault();
Assert.IsNotNull(db);
}
示例15: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
sqlDatabase = (SqlDatabase)factory.CreateDefault();
}