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

We could use EnsureCreatedAsync using async Main #17749

Closed
weitzhandler opened this issue Apr 12, 2020 — with docs.microsoft.com · 5 comments
Closed

We could use EnsureCreatedAsync using async Main #17749

weitzhandler opened this issue Apr 12, 2020 — with docs.microsoft.com · 5 comments
Labels
Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

Copy link
Contributor

weitzhandler commented Apr 12, 2020

In .NET Core > 2.1, async Task Main can be used instead, then EnsureCreatedAsync 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.

@dotnet-bot dotnet-bot added ⌚ Not Triaged Source - Docs.ms Docs Customer feedback via GitHub Issue labels Apr 12, 2020
@Rick-Anderson
Copy link
Contributor

EnsureCreatedAsync is not suitable for production apps.

@weitzhandler
Copy link
Contributor Author

weitzhandler commented Apr 12, 2020

Can you please explain why?

@Rick-Anderson
Copy link
Contributor

@ajcvickers please review. We should probably update the doc's with best practice.

@ajcvickers
Copy link
Member

@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.

/cc @JeremyLikness @bricelam

@bricelam
Copy link
Contributor

bricelam commented Apr 13, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants