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


C# DatabaseProviderFactory.CreateDefault方法代码示例

本文整理汇总了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);
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:7,代码来源:SqlStoredProcedureCreatingFixture.cs

示例2: Setup

 public void Setup()
 {
     var factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
     var db = factory.CreateDefault();
     connection = db.CreateConnection();
     connection.Open();
 }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:7,代码来源:DatabaseConnectionWrapperFixture.cs

示例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);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:8,代码来源:SqlExecuteScalarFixture.cs

示例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);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:10,代码来源:SqlExecuteReaderFixture.cs

示例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);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:10,代码来源:DatabaseProviderFactoryFixture.cs

示例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);
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:10,代码来源:SqlExecuteNonQueryFixture.cs

示例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);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:12,代码来源:SqlParameterDiscoveryFixture.cs

示例8: TestInitialize

        public void TestInitialize()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
            db = factory.CreateDefault();

            try
            {
                DeleteStoredProcedures();
            }
            catch { }
            CreateStoredProcedures();
            base.SetUp();
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:13,代码来源:SqlUpdateDataSetFixture.cs

示例9: SetUp

        public void SetUp()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
            db = factory.CreateDefault();

            try
            {
                DeleteStoredProcedures();
            }
            catch { }
            CreateStoredProcedures();

            baseFixture = new TransactionScopeFixture(db);
            baseFixture.Cleanup();
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:15,代码来源:SqlTransactionScopeFixture.cs

示例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();
                }
            }
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:21,代码来源:SqlParameterFixture.cs

示例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);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:22,代码来源:SqlParameterFixture.cs

示例12: TestInitialize

 public void TestInitialize()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
     db = factory.CreateDefault();
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:5,代码来源:SqlExecuteDatasetFixture.cs

示例13: ThreadTests

 public ThreadTests()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
     db = factory.CreateDefault();
 }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:5,代码来源:TransactionConnectionsFixture.cs

示例14: CanCreateDefaultDatabase

 public void CanCreateDefaultDatabase()
 {
     DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
     Database db = factory.CreateDefault();
     Assert.IsNotNull(db);
 }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:6,代码来源:DatabaseFactoryOldFixture.cs

示例15: SetUp

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


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