Fix build break: Add `ObjectPoolProvider` to DI in integration tests

This commit is contained in:
Doug Bunting 2016-03-27 13:04:17 -07:00
parent 00f660b50d
commit b83e142bfe
1 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
using MusicStore.Models; using MusicStore.Models;
using MusicStore.ViewModels; using MusicStore.ViewModels;
@ -27,8 +28,9 @@ namespace MusicStore.Controllers
var efServiceProvider = new ServiceCollection().AddEntityFrameworkInMemoryDatabase().BuildServiceProvider(); var efServiceProvider = new ServiceCollection().AddEntityFrameworkInMemoryDatabase().BuildServiceProvider();
var services = new ServiceCollection(); var services = new ServiceCollection();
services
services.AddDbContext<MusicStoreContext>(b => b.UseInMemoryDatabase().UseInternalServiceProvider(efServiceProvider)); .AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
.AddDbContext<MusicStoreContext>(b => b.UseInMemoryDatabase().UseInternalServiceProvider(efServiceProvider));
services.AddMvc(); services.AddMvc();