You made the following registration:
_container.AddRegistration(
serviceType: typeof(ICacheManager<SettingsData>),
registration: registration);
And you're doing the following resolve:
_container.GetInstance<SettingsCache>();
You haven't registered SettingsCache
explicitly, but only ICacheManager<SettingsData>
. Since SettingsCache
is a concrete class, Simple Injector will resolve it as transient instance for you.
The solution is to either register SettingsCache
explicitly or resolve ICacheManager<SettingsData>
instead. You can make a second registration with using the same Registration
instance. For instance:
_container.AddRegistration(
serviceType: typeof(SettingsCache),
registration: registration);
The Diagnostic Services will warn you about this this type of misconfiguration.