So... in my .Net Core 2 Startup file I am adding my repositories to the scope in the ConfigureServices method like so...
public void ConfigureServices(IServiceCollection services)
{
var config = LoadConfiguration();
services.AddDbContext<DatabaseContext>(options => options.UseSqlServer(config.Connection, x => x.MigrationsAssembly("XXX")));
// Repositories
services.AddScoped<IUserRepository, UserRepository>();
services.AddScoped<ISecurityFunctionRepository, SecurityFunctionRepository>();
services.AddScoped<IUserSecurityFunctionRepository, UserSecurityFunctionRepository>();
services.AddScoped<ICustomerRepository, CustomerRepository>();
// ... lots more...
// other goodies
}
I know there are a million ways to setup a .Net Core 2 API, but my specific question is whether or not having 30+ repositories added to scope will cause any issues with the server or memory, OR if there is a better way to scope a ton of repositories.
In other projects I have created several APIs with their own repositories. That technically avoids this issue, but it is a hassle I would like to avoid.