-
Notifications
You must be signed in to change notification settings - Fork 829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Di AddNpgsql<Context>not add NodaTime and NetTopologySuite extensions #5542
Comments
The above shows you switching from using NpgsqlDataSource (which is the better, newer way) to using a connection string directly, without a data source (which is now discouraged). Consider continuing using NpgsqlDataSourceBuilder and NpgsqlDataSource. In any case, note that your 7.0 configures NodaTime/NTS twice - once at the lower Npgsql level (on NpgsqlDataSourcebuilder), and once at the upper EF level (in EF's UseNpgsql). To do the same without a data source, you'll need to use the global type mapper (docs). I'll go ahead and close the issue as everything is behaving as expected and the question has been answered, but feel free to post further questions here if you need to. |
Thanks for answering.
Slightly confusing 2nd setup
and
|
@Millarex you probably want to take a look at npgsql/efcore.pg#2542, which explores an approach where configuration would only need to be specified once at the EF level, and EFCore.PG would automatically also configure the necessary things at the Npgsql level (that's a bit different from what you propose above, where the same EF method accepts to build lambdas, one for EF and one for Npgsql). I agree that the current situation isn't ideal, but for now you'll have to configure the two layers independently. |
Thank you very much for your answer. |
The issue
For Npgsql 7.0 I use DI init:
For Npgsql 8.0 I try use DI init:
But UseNodaTime and UseNetTopologySuite not work and i had NpgsqlDbType error.
Add services.AddEntityFrameworkNpgsqlNodaTime() and services.AddEntityFrameworkNpgsqlNetTopologySuite() not resolve problem.
What I do wrong and how fix this problem?
The initialization from Npgsql 7.0 continues to work correctly but I would like to understand.
Further technical details:
Npgsql version: 8.0
EfCore version: 8.0
Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite version: 8.0
Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime version: 8.0
EfCore version: 8.0
PostgreSQL version: 14
Operating system: linux\Windows
AspNet Core Web Api
Dot net 8.0
The text was updated successfully, but these errors were encountered: