This is my NPGSQL connection string
{
"ConnectionStrings": {
"DataAccessPostgreSqlProvider": "User ID=damienbod;Password=1234;Host=localhost;Port=5432;Database=damienbod;Pooling=true;"
}
}
}
taken from here: https://damienbod.com/2016/01/11/asp-net-5-with-postgresql-and-entity-framework-7/
But I am using schemas under my Postgres database. How to connect to idsrv4 schema?
Connections can be instantiated directly, and must then be opened before they can be used: var connectionString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase"; await using var conn = new NpgsqlConnection(connectionString); await conn. OpenAsync();
there is added support for specifying the current schema using URL. With @ClassRule, we create an instance of PostgreSQL database container. Next, in the setup method, create a connection to that database and create the required objects. To change the default schema, we need to specify the currentSchema parameter.
You can also specify the search path in the connection string:
{
"ConnectionStrings": {
"DataAccessPostgreSqlProvider": "User ID=damienbod;Password=1234;Host=localhost;Port=5432;Database=damienbod;Pooling=true;SearchPath=your_search_path;"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With