Comments (2)
Yes, that is unfortunately the expected behavior; if you use a simple connection string to configure EF, then at the lower Npgsql level the same connection pool is used, and the first time it's initialized (e.g. without NodaTime) is what takes effect for all subsequent use.
The right way forward here is to create two NpgsqlDataSource instances (see the docs) - one with NodaTime, and one without. Then, pass the correct NpgsqlDataSource to EF's UseNpgsql() instead of the connection string. This creates a simple, clear separation between usage/non-usage of NodaTime all the way down the stack.
Another workaround is to simply always turn on NodaTime. Even if you don't use it, it shouldn't interfere with regular DateTime usage.
Finally, you can use different connection strings to have separate connection pools at the lower Npgsql level (as you see to be doing in your demo project). That ensures having different pools, similar to what NpgsqlDataSource achieves, but in a hackier worse way.
I'll go ahead and close this issue as the behavior is by-design, but don't hesitate to post back with more questions etc. I can reopen as necessary.
from efcore.pg.
Thanks,
I tried this on one of my projects and it seems to work.
Added a data source in the services collection and reused it on health checks and DbContext.
from efcore.pg.
Related Issues (20)
- LTree column type doens worked with migration
- Errors on mapping enum types to SQL and storing into database
- Is there way to translate EF Core query to WITH Queries (Common Table Expressions) ? HOT 3
- Select or filter Length of string contained in JsonB column
- Value Conversion Not Applied when using DbFunction in EF Core HOT 1
- ExecuteDelete cloud not betranslated but querying can HOT 3
- Warning: Found conflicts between different versions of "Microsoft.EntityFrameworkCore.Relational" that could not be resolved on Microsoft.EntityFrameworkCore.Relational 8.0.4 and 8.0.7 HOT 4
- Received backend message ParseComplete while expecting BindCompleteMessage using pgcat pooler
- Guidance for NodaTime postgres data types HOT 3
- v8.0.4 - First async query to run fails HOT 1
- SRID is ignored when writing NetTopologySuite Geometry properties inside objects mapped with ToJson()
- Is Npgsql.EntityFrameworkCore.PostgreSQL stop updating? HOT 2
- Null value in column of relation table violates not-null constraint HOT 11
- Issue Configuring `EnableDynamicJson()` on Data Source with a Multi-Tenant API Leveraging Postgres Row-Level Security
- EF not persisting updating value converted collections to JSON HOT 6
- How to handle Enum in .net core with entity framework USING PostgreSQL HOT 2
- GetDatabaseLock is not implemented in NpgSqlHistoryRepository HOT 1
- Migration does not specify a default value for non-nullable List<> properties HOT 2
- Extension missing for method ST_SetsRID
- Issues with configuring tsvector columns for migrations HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efcore.pg.