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

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

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

Comments

4 participants
@Tratcher
Member

Tratcher commented Aug 1, 2017

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

Signoff issue: aspnet/Release#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

This comment has been minimized.

alexandr-osprey commented Apr 22, 2018

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