-
Notifications
You must be signed in to change notification settings - Fork 686
Update Npgsql dependency to 9.0 #6946
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
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 dotnet#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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