I'm not really familiar that much about ASP.Net Core
. My issue is I have this controller like the following
[Route("api/[controller]")]
public class MyController : MyBaseService
{
private IWebHostEnvironment _env;
private IAuth _auth;
public MyController(IWebHostEnvironment env,
IAuth auth) : base(auth)
{
_hostingEnv = env;
_auth = auth;
}
IAuth
is registered as Scoped service in Startup.cs
like services.AddScoped<IAut, Auth>();
If I call the controller, the auth
doesn't have values. I believe this is because of the lifetime of the service, am I right? If that is so. I just want to populate it with values whenever the controller is being called. Is there such a way like getting the values from IAuth
then automatically insert it in the level of Startup.cs
something like this lambda function?
app.UseRequestLocalization(new RequestLocalizationOptions
{
SupportedCultures = "String value here.",
});
If my imagination is wrong just correct me as I said I'm not that familiar with ASP.Net Core.