Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created May 24, 2018 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/5667ee42b8f0f02872c6413efe4f9b52 to your computer and use it in GitHub Desktop.
Save christiannagel/5667ee42b8f0f02872c6413efe4f9b52 to your computer and use it in GitHub Desktop.
Configuration of Services, storing users in the database - ASP.NET Core 2.1
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<IdentityUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment