Reputation: 981
I am creating an application with ASP.NET 5 MVC 6.
In my base-viewmodel, I have to access the application- and the session-cache.
Of course I could pass the cache-objects from my controller to the viewmodel to the base-viewmodel, but this seems a bit complicated.
Whats the way of doing this?
Upvotes: 0
Views: 810
Reputation: 5366
From your description I gather you would want to request an instance of IMemoryCache via Dependency Injection. You can read how to do this here: https://docs.asp.net/en/latest/performance/caching/memory.html
Upvotes: 2