public void Can_specify_connection_in_OnConfiguring_with_default_service_provider()
    {
        using var _       = NpgsqlTestStore.GetNorthwindStore();
        using var context = new ConnectionInOnConfiguringContext(new NpgsqlConnection(NpgsqlTestStore.NorthwindConnectionString));

        Assert.True(context.Customers.Any());
    }
 public void Can_specify_connection_in_OnConfiguring_with_default_service_provider()
 {
     using (SqlServerTestStore.GetNorthwindStore())
     {
         using var context = new ConnectionInOnConfiguringContext(
                   new SqlConnection(SqlServerNorthwindTestStoreFactory.NorthwindConnectionString));
         Assert.True(context.Customers.Any());
     }
 }
Ejemplo n.º 3
0
 public async void Can_specify_connection_in_OnConfiguring_with_default_service_provider()
 {
     using (await SqlServerNorthwindContext.GetSharedStoreAsync())
     {
         using (var context = new ConnectionInOnConfiguringContext(new SqlConnection(SqlServerNorthwindContext.ConnectionString)))
         {
             Assert.True(context.Customers.Any());
         }
     }
 }
 public void Can_specify_connection_in_OnConfiguring_with_default_service_provider()
 {
     using (SqlServerNorthwindContext.GetSharedStore())
     {
         using (var context = new ConnectionInOnConfiguringContext(new SqlConnection(SqlServerNorthwindContext.ConnectionString)))
         {
             Assert.True(context.Customers.Any());
         }
     }
 }
Ejemplo n.º 5
0
        public void Can_specify_connection_in_OnConfiguring_and_create_master_connection()
        {
            using (var conn = new NpgsqlConnection(NpgsqlNorthwindContext.ConnectionString))
            {
                conn.Open();

                using (NpgsqlNorthwindContext.GetSharedStore())
                {
                    using (var context = new ConnectionInOnConfiguringContext(conn))
                    {
                        var relationalConn = context.GetService <NpgsqlRelationalConnection>();
                        using (var masterConn = relationalConn.CreateMasterConnection())
                        {
                            masterConn.Open();
                        }
                    }
                }
            }
        }