'Performance DI AddScope in web api layer of Mobile App
So i created a mobile app that mobile app hooks into this web api hosted on a server but I was just thinking how I did the startup class and in their I have a load of services I am calling in the web api.
Is Using Add Scope bad in this if multiple users will start hitting the system.
services.AddScoped<IteamInterface,TeamService>();
services.AddScoped<IPlayerInterface, PlayerService>();
services.AddScoped<IProfileInterface, ProfileService>();
services.AddScoped<IWorkoutsInterface, WorkoutsService>();
Typical service would be
public class WorkoutsService : IWorkoutsInterface
{
APPDBContext db;
public WorkoutsService(APPDBContext dBContext)
{
db = dBContext;
}
public void AddWorkOut(Workout workout)
{
db.WorkOuts.Add(workout);
db.SaveChanges();
}
... DO more db calls
}
It wont be heavy hit the application but could using add scope cause me an issue further down the road.
I have about 15 services in startup.cs being loaded this way and just concerend if about 4 coaches will be using this latter
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
