Inheritance: Microsoft.Practices.EnterpriseLibrary.Data.Database
        public void CreateConnectionTest() {

            var database = new NpgsqlDatabase(ConnectionString);
            database.Should().Not.Be.Null();

            using(var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();

                connection.State.Should().Be(ConnectionState.Open);
            }
        }
Exemple #2
0
        private static void HandleConnectionError(NpgsqlDatabase db, Exception ex, int? tryCount) {
            if(log.IsErrorEnabled) {
                log.Error("Database Connection 생성 및 Open 수행 시에 예외가 발생했습니다. ConnectionString=[{0}]", db.ConnectionString);
                log.Error(ex);
            }

            With.TryAction(() => NpgsqlConnection.ClearAllPools());

            var timeout = Math.Min(MaxTimeout, Math.Abs(tryCount.GetValueOrDefault(1)) * 50);
            Thread.Sleep(timeout);
        }
Exemple #3
0
        public void CreateConnectionTest()
        {
            var database = new NpgsqlDatabase(ConnectionString);

            database.Should().Not.Be.Null();

            using (var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();

                connection.State.Should().Be(ConnectionState.Open);
            }
        }
        public void ExecuteReaderTest() {

            var database = new NpgsqlDatabase(ConnectionString);
            database.Should().Not.Be.Null();

            using(var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();
                connection.State.Should().Be(ConnectionState.Open);

                using(var cmd = new NpgsqlCommand("SELECT * FROM Invoices", connection)) {
                    using(var reader = cmd.ExecuteReader()) {
                        Console.WriteLine(reader.ToString(true));
                    }
                }
            }
        }
Exemple #5
0
        public void ExecuteReaderTest()
        {
            var database = new NpgsqlDatabase(ConnectionString);

            database.Should().Not.Be.Null();

            using (var connection = (NpgsqlConnection)database.CreateConnection()) {
                connection.Open();
                connection.State.Should().Be(ConnectionState.Open);

                using (var cmd = new NpgsqlCommand("SELECT * FROM Invoices", connection)) {
                    using (var reader = cmd.ExecuteReader()) {
                        Console.WriteLine(reader.ToString(true));
                    }
                }
            }
        }
Exemple #6
0
        public void CreateDatabaseTest()
        {
            var database = new NpgsqlDatabase(ConnectionString);

            database.Should().Not.Be.Null();
        }
        public void CreateDatabaseTest() {

            var database = new NpgsqlDatabase(ConnectionString);
            database.Should().Not.Be.Null();
        }