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


C# DBConnection.ExecuteWithConnectionOpen方法代码示例

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


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

示例1: setupNewDatabase

        /*
        private void setupNewDatabase() {
            var script = @"
        CREATE TABLE global_ints(
        ParameterName VARCHAR( 50 )
        PRIMARY KEY,
        ParameterValue INT
        NOT NULL
        );

        INSERT INTO global_ints VALUES( 'LineMarker', 0 );

        CREATE TABLE main_sequence(
        MainSequenceId INT
        AUTO_INCREMENT
        PRIMARY KEY
        );
        ";
        }
        */
        public void ExecuteDbMethod( Action<DBConnection> method )
        {
            executeMethodWithDbExceptionHandling(
                () => {
                    var connection = new DBConnection( new MySqlInfo( ( info as DatabaseInfo ).SecondaryDatabaseName, info.Database, false ) );
                    connection.ExecuteWithConnectionOpen( () => method( connection ) );
                } );
        }
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:28,代码来源:MySql.cs

示例2: executeDbMethodWithSpecifiedDatabaseInfo

        private void executeDbMethodWithSpecifiedDatabaseInfo( OracleInfo info, Action<DBConnection> method )
        {
            executeMethodWithDbExceptionHandling(
                delegate {
                    // Before we disabled pooling, we couldn't repeatedly perform Update Data operations since users with open connections can't be dropped.
                    var connection =
                        new DBConnection(
                            new OracleInfo(
                                ( info as DatabaseInfo ).SecondaryDatabaseName,
                                info.DataSource,
                                info.UserAndSchema,
                                info.Password,
                                false,
                                info.SupportsLinguisticIndexes ) );

                    connection.ExecuteWithConnectionOpen( () => method( connection ) );
                } );
        }
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:18,代码来源:Oracle.cs

示例3: executeDbMethodWithSpecifiedDatabaseInfo

 private void executeDbMethodWithSpecifiedDatabaseInfo( SqlServerInfo info, Action<DBConnection> method )
 {
     executeMethodWithDbExceptionHandling(
         () => {
             var connection =
                 new DBConnection(
                     new SqlServerInfo(
                         ( info as DatabaseInfo ).SecondaryDatabaseName,
                         info.Server,
                         info.LoginName,
                         info.Password,
                         info.Database,
                         false,
                         info.FullTextCatalog ) );
             connection.ExecuteWithConnectionOpen( () => method( connection ) );
         } );
 }
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:17,代码来源:SqlServer.cs


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