// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { InMemoryDatabase memoryDb = new InMemoryDatabase(InMemoryDatabase.CreateSeedData()); services.Configure <ContactListApiOptions>(Configuration.GetSection("ContactListApi")); services.Configure <CompanySettings>(Configuration.GetSection("DevelopmentCompany")); services.AddSingleton(memoryDb); services.AddSingleton( serviceProvider => serviceProvider.GetService <IOptions <ContactListApiOptions> >().Value); services.AddControllersWithViews(); services.AddDbContext <DatabaseContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DatabaseContext"))); services.AddTransient <IContactListEntryService, ContactListEntryService>(); //services.AddTransient<IContactListEntryRepository, ContactListEntryDbRepository>(); // services.AddTransient<IContactListEntryRepository, ContactListEntryApiRepository>(); services.AddTransient <IContactListEntryRepository, ContactListEntryInMemoryRepository>(); }