From cf25bdf2104513aa8091c4fd2b987a21d1bfde4e Mon Sep 17 00:00:00 2001 From: user135711 <31940582+user135711@users.noreply.github.com> Date: Tue, 8 May 2018 05:12:42 -0700 Subject: [PATCH] missing db vscode api (#6266) --- .../tutorials/first-web-api/samples/2.1/TodoApi/Startup.cs | 4 ++++ .../tutorials/first-web-api/samples/2.1/TodoApi/Startup2.cs | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup.cs b/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup.cs index bd7fa95e16..d342dc93c7 100644 --- a/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup.cs +++ b/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup.cs @@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using TodoApi.Models; +using Microsoft.EntityFrameworkCore; namespace TodoApi { @@ -18,6 +20,8 @@ namespace TodoApi // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + services.AddDbContext(opt => + opt.UseInMemoryDatabase("TodoList")); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } diff --git a/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup2.cs b/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup2.cs index 4dfefa1059..b898fc8050 100644 --- a/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup2.cs +++ b/aspnetcore/tutorials/first-web-api/samples/2.1/TodoApi/Startup2.cs @@ -4,6 +4,9 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using TodoApi.Models; +using Microsoft.EntityFrameworkCore; + namespace TodoApi { @@ -18,6 +21,8 @@ namespace TodoApi public void ConfigureServices(IServiceCollection services) { + services.AddDbContext(opt => + opt.UseInMemoryDatabase("TodoList")); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }