Browse Source

Update README.md and the Mvc.Server sample to use the new Entity Framework context registration syntax

pull/152/head
Orlando Quero 10 years ago
committed by Kévin Chalet
parent
commit
5838c24a85
  1. 6
      README.md
  2. 7
      samples/Mvc.Server/Startup.cs

6
README.md

@ -64,10 +64,8 @@ To use OpenIddict, you need to:
public void ConfigureServices(IServiceCollection services) { public void ConfigureServices(IServiceCollection services) {
services.AddMvc(); services.AddMvc();
services.AddEntityFramework() services.AddDbContext<ApplicationDbContext>(options =>
.AddSqlServer() options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
// Register the Identity services. // Register the Identity services.
services.AddIdentity<ApplicationUser, IdentityRole>() services.AddIdentity<ApplicationUser, IdentityRole>()

7
samples/Mvc.Server/Startup.cs

@ -4,7 +4,6 @@ using CryptoHelper;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Mvc.Server.Models; using Mvc.Server.Models;
@ -24,10 +23,8 @@ namespace Mvc.Server {
services.AddSession(); services.AddSession();
services.AddEntityFramework() services.AddDbContext<ApplicationDbContext>(options =>
.AddEntityFrameworkSqlServer() options.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"]));
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"]));
// Register the Identity services. // Register the Identity services.
services.AddIdentity<ApplicationUser, IdentityRole<Guid>>() services.AddIdentity<ApplicationUser, IdentityRole<Guid>>()

Loading…
Cancel
Save