Skip to content

aspnet/core/data/ef-mvc/ updates for 2.0 #3864

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

Closed
Tratcher opened this issue Aug 1, 2017 · 1 comment
Closed

aspnet/core/data/ef-mvc/ updates for 2.0 #3864

Tratcher opened this issue Aug 1, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@Tratcher
Copy link
Member

Tratcher commented Aug 1, 2017

https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/

Signoff issue: https://github.com/aspnet/Release/issues/176

Major item:
All the code around DbInitializer needs to be moved from Startup to Main. The old pattern is now causing problems with migrations.

        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);
            
            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var context = services.GetRequiredService<SchoolContext>();
                    DbInitializer.Initialize(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService<ILogger<Program>>();
                    logger.LogError(ex, "An error occurred while migrating the database.");
                }
            }
            
            host.Run();
        }

Standard cleanup:
Redo screenshots, update versions, redo command line sample output.

Minor items:

  • Microsoft.EntityFrameworkCore.SqlServer no longer needs to be added, it's part of the metapackage.
  • Create, Read, Update, and Delete operations: Edge won't let you enter invalid dates in a datetime-local field. You always get a date picker. Use a different validation example?
  • Sorting, filtering, paging, and grouping: Why doesn't PaginatedList.cs have a namespace?

@bricelam
@Rick-Anderson adds - go thru entire series

@alexandr-osprey
Copy link

I've been struggling with error "LocalDb connection : Login failed" during migrations or any tries to connect to localdb. This really helped me. Such a treasonous problem.

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

No branches or pull requests

4 participants