get different objects in controller and service?
venyowong opened this issue · comments
I have a class:
public class RequestContext
{
public CallContext CallingContext{get;set;}
public string ActionName{get;set;}
}
And I configured it in Startup.ConfigureServices:
services.AddScoped<HttpSession>();
Then I injected it into controller and service:
public HomeController(RequestContext requestContext, IService service)
public Service(RequestContext requestContext)
And I invoked these code in controller:
requestContext.ActionName = string.Format("{0}.{1}", this.RouteData.Values["controller"].ToString().ToLower(), this.RouteData.Values["action"].ToString().ToLower());
But I found requestContext.ActionName is null in service.
Oh no, I found my service is a singleton...