Reputation: 5634
I am using Akavache and would like to register the constant BlobCache.LocalMachine such that when I inject IBlobCache in the constructor of my viewmodels it just picks it up.
I believe the Ninject equivalent is:
Bind<Akavache.IBlobCache>().ToConstant(Akavache.BlobCache.LocalMachine);
What I want to do:
readonly IBlobCache _cache;
// ...
public MainViewModel(INavService navService, IBlobCache cache)
: base (navService)
{
_cache = cache;
}
Finally, I am seeing conflicting information on what to do when I 'logout' of my app. Is the correct sequence:
_cache.Shutdown()
or
_cache.InvalidateAll()
Upvotes: 0
Views: 180
Reputation: 10883
You might be looking for RegisterInstance
:
containerRegistry.RegisterInstance<Akavache.IBlobCache>( Akavache.BlobCache.LocalMachine );
This will make the container inject LocalMachine
(at the time of registration) whenever IBlobCache
is needed.
Upvotes: 0