-
Notifications
You must be signed in to change notification settings - Fork 25.2k
We could use EnsureCreatedAsync using async Main #17749
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
|
Can you please explain why? |
@ajcvickers please review. We should probably update the doc's with best practice. |
@Rick-Anderson @weitzhandler As part of the plan for EF Core 5, we are investigating better experiences for migrating the database that don't involve running migrations from code--see dotnet/efcore#19587. This will likely result in something like "migration bundles" that can easily be deployed at the same time as the database. We also have dotnet/efcore#20402 which is about integrating this into something like the ASP.NET Core error page middleware. With regard to the associated PR, the async change is probably marginally better than what we have now, but we need to revisit this after we have got further along the bundles path. |
Async doesn't really help in this situation. The application isn't accepting requests at this point. There is effectively only one thread running and yielding it will probably only make it take longer to start up and begin accepting requests. |
In .NET Core > 2.1,
async Task Main
can be used instead, thenEnsureCreatedAsync
could be used.I find it really important to point that out in the docs, because many people are looking for ways to initialize post-build app stuff, that are many times asynchronous.
Here's an example question in SO.
Created PR #17750.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: