Skip to content

Instantly share code, notes, and snippets.

@evgomes
Created February 4, 2019 23:00
Show Gist options
  • Save evgomes/f76d4bd23ebd239a4c938bd970b69932 to your computer and use it in GitHub Desktop.
Save evgomes/f76d4bd23ebd239a4c938bd970b69932 to your computer and use it in GitHub Desktop.
Last edit of ConfigureServices, from Supermarket API
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddDbContext<AppDbContext>(options =>
{
options.UseInMemoryDatabase("supermarket-api-in-memory");
});
services.AddScoped<ICategoryRepository, CategoryRepository>();
services.AddScoped<IProductRepository, ProductRepository>();
services.AddScoped<IUnitOfWork, UnitOfWork>();
services.AddScoped<ICategoryService, CategoryService>();
services.AddScoped<IProductService, ProductService>();
services.AddAutoMapper();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment