This project has moved. For the latest updates, please go here.
1
Vote

Singleton objects have their properties re-injected every time you call Resolve()

description

If you register a singleton via:

T instanceObject = new T();
fFastInjector.SetResolver<T>(() => instanceObject);
  • As a result, although this is effectively a singleton, if you use property injection...
fFastInjector.SetResolver<T>(() => instanceObject).AddPropertyInjector(..)

The property injector will be re-called every time you call:

fFastInjector.Resolve<T>();

This may lead to incorrect behavior.

comments