Update Npgsql dependency to 9.0#6946
Conversation
0eaa10e to
8358fb2
Compare
|
I needed to update the Npgsql EF library so it continued using Npgsql 8 when using EF 8. See npgsql/npgsql#5987 |
Npgsql supports net8.0 and net9.0, which means we can just update to the latest version and don't need to multi-target or split dependencies. Fix microsoft#6720
…versions To use EF 8, need to use Npgsql 8. See npgsql/npgsql#5987
…previous code was creating them in the static initializer.
…is requires updating the app to target net9.0.
8358fb2 to
b0b18b9
Compare
| public static BuildEnvironment ForDefaultFramework { get; } = DefaultTargetFramework switch | ||
| { | ||
| TestTargetFramework.Previous => ForPreviousSdkOnly, | ||
| public static BuildEnvironment ForDefaultFramework => |
There was a problem hiding this comment.
FYI - @radical.
The current code evaluates these Lazy properties in the static initializer. I refactored this so it is only touched when this property is touched.
| Since this project uses both Npgsql and Npgsql.EntityFrameworkCore, we need to ensure they are both the same major version. | ||
| Aspire.Npgsql uses Npgsql v9, so we need to use Npgsql.EntityFrameworkCore v9 (and target net9.0 as well) to match. |
There was a problem hiding this comment.
This situation is getting a little messy. The major versions of Npgsql and Npgsql.EntityFrameworkCore need to match, or else you run into breaking changes like: #6852 (comment).
With this change, we only target Npgsql v9, no matter the TFM you target. So this needs to use EF Core 9, which is only supported with aspire if you target net9.0. So that's what I made this test do.
There was a problem hiding this comment.
Yeah, makes sense - as I wrote in npgsql/npgsql#5987 (comment), EFCore.PG 9.0 requires Npgsql 9.0 because of some changes in how enums are managed; but in general, the EF provider and Npgsql sometimes need to interoperate tightly, resulting in major version dependencies. So this is expected - I hope this is OK on your side.
There was a problem hiding this comment.
I think it is OK. We just need to ensure we match the major versions (and so will any customers).
There was a problem hiding this comment.
FWIW EFCore.PG does specify upper nuget versions for EF itself, since they're also tightly coupled; with Npgsql/EFCore.PG I haven't done that so far... Will consider it for the next release if we have known major breaks.
| <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" VersionOverride="9.0.0" /> | ||
| <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" VersionOverride="9.0.0" /> | ||
| <PackageReference Include="Microsoft.Extensions.Configuration.Binder" VersionOverride="9.0.0" /> | ||
| <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" VersionOverride="9.0.0" /> | ||
| <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="9.0.0" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="9.0.0" /> | ||
| <PackageReference Include="Microsoft.Extensions.Options" VersionOverride="9.0.0" /> | ||
| <PackageReference Include="Microsoft.Extensions.Primitives" VersionOverride="9.0.0" /> |
There was a problem hiding this comment.
I'm going to send out a separate PR which refactors our Directory.Packages.props so this is no longer necessary.
Npgsql supports net8.0 and net9.0, which means we can just update to the latest version and don't need to multi-target or split dependencies.
Fix #6720
Fix #6852
Microsoft Reviewers: Open in CodeFlow