Hi, I tried to access the services in the home controller but somehow it's not working
Startup.cs
- public void ConfigureServices(IServiceCollection services){
- /*boilerplate's default bindings*/
- services.AddTransient
(p => new Dummy() - {
- name = "from injection"
- });
- }
HomeController.cs
- public IActionResult Index(IDummy dummy){
- var test = dummy.name;
- return this.View(HomeControllerAction.Index);
- }
Jay Krishna ReddyPosted Mar 8, 2021, 8:15 AM