Closed alexmackey closed 5 years ago
@alexmackey The setup of ApplicationDbContext
doesn't have anything directly to do with this tutorial. That should all be done in the previous tutorial, which is a prerequisite.
this snippet should be placed after the call to AddDbContext to avoid a confusing dependency resolution error.
It does show that.
services.AddDefaultIdentity<IdentityUser>()
.AddDefaultUI(UIFramework.Bootstrap4)
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddAuthentication().AddFacebook(facebookOptions =>
{
facebookOptions.AppId = Configuration["Authentication:Facebook:AppId"];
facebookOptions.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
});
Hey Rick I understand and maybe its just me but when I followed tutorial through I interpreted this as this code snippet replaced the existing code in configure services method which then led to the dependency resolution error (and 20 mins whilst I worked out what caused it).
E.g. if this read "Add the Facebook service in the ConfigureServices method in the Startup.cs file below the existing call to AddDbContext" this would be clearer?
In the next sweep I'll add the entire ConfigureServices
and highlight the code to add.
awesome! 👍
The code snippet in Configure Facebook Authentication Code, ConfigureServices could be made clearer by either including the setup of dbcontext (e.g. below) or mention this snippet should be placed after the call to AddDbContext to avoid a confusing dependency resolution error.
services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection")));
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.