Skip to content
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

Update DatabaseMigrations and AspireShop to EF 9 #401

Open
AndriySvyryd opened this issue Aug 7, 2024 · 5 comments
Open

Update DatabaseMigrations and AspireShop to EF 9 #401

AndriySvyryd opened this issue Aug 7, 2024 · 5 comments

Comments

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Aug 7, 2024

Related to dotnet/aspire#5207

  • EnsureDatabaseAsync should be removed as now this is handled well by MigrateAsync
  • MigrateAsync shouldn't be wrapped in a transaction and execution strategy. This is now done internally, and the explicit wrapping can be detrimental in some cases (for migration operations that can't be executed in a transaction).
  • Seeding should be done using the new UseAsyncSeeding method on DbContextOptionsBuilder. See Upgrade EF to 9.0 eShop#488 for additional suggestions.

Also, use WaitForResourceAsync(...) when available.

@DamianEdwards
Copy link
Member

We're not planning on updating the samples in this repo to .NET 9 but rather keeping them targeting .NET 8 but using Aspire 9, as .NET 8 is LTS. Using EF Core 9 lifts dependencies to .NET 9 versions thus pulling the project out of LTS so we'll keep them on EF Core 8 too. I'll leave this open though to track doing this work when we move the samples to .NET 10.

@DamianEdwards DamianEdwards removed this from the 9.0 milestone Nov 7, 2024
@herzkoenig
Copy link

It would be great if you could share the recommended final changes here in this issue if you’re not planning to update the samples.

@GeneralSan
Copy link

It would be great if you could share the recommended final changes here in this issue if you’re not planning to update the samples.

I think it would be great to have dotnet9/aspire9 samples in a separate folder, next to the dotnet 8 LTS ones. So we can work with the working clean code versions for dotnet 9.

@DamianEdwards
Copy link
Member

I think it would be great to have dotnet9/aspire9 samples in a separate folder, next to the dotnet 8 LTS ones. So we can work with the working clean code versions for dotnet 9.

We don't want to have to maintain multiple versions of every sample so we decided against this.

You can see the recommended final changes over in the https://github.com/DamianEdwards/AspireStarterDb however.

@GeneralSan
Copy link

Thanks for your answer. I understand there is a github repository indicating final changes for aspire v9, dotnet 9, for db development.

But isn't this exactly why this repository serves a golden purpose ? It's a go-to for people who want to get a hold of how they can do things, open up a repository, run it and see that it works - out of the box - which is gold, as it's a thousand times better than a description of how things should be done or documentation, as it runs and proves the point of how things should be done.
Then people can see or investigate why their own solution would not work and steer clear of their bugs or way of working that doesn't work.

Not having this for another version (v9, v10, ...) is missing out on this exact purpose, in my opinion.
This way, people have to search the internet again for something that would work (we are very lucky you indicate an exact link for this particular case - and thx for that !).
Searching the internet gives them lots of hits however, many of which are not what they are looking for. This repo is golden in that way, except for the missing versions - it does not provide that golden state for the current version though, which is a pity. (I would use a stronger word, but I want to stay friendly :))

Again, your repo is golden. But, given your answer, not for the "current" developers. And I miss that.
However, I understand fully - "maintaining multiple versions" takes time, and most people don't have lots of that. I just wanted to chime in my thoughts - and I respectfully accept your answer on the matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants