ASP.NET-Core-MVC-Example icon indicating copy to clipboard operation
ASP.NET-Core-MVC-Example copied to clipboard

Why don't use the injected IConfiguration in DesignTimeDbContextFactory?

Open sadqiang opened this issue 8 years ago • 1 comments

Rather than recreating

 IConfigurationRoot configuration = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                .AddJsonFile("appsettings.json")
                .Build();

again in DesignTimeDbContextFactory.cs, can we leverage the DI just by adding a constructor and a readonly field of type IConfiguration in DesignTimeDbContextFactory?

sadqiang avatar Feb 03 '18 06:02 sadqiang

This opened issue long time ago created. I think that not important because official documentation use the same.

asadullazadeh avatar Apr 24 '19 11:04 asadullazadeh