BoDi
BoDi copied to clipboard
Support disposal of objects returned by RegisterFactoryAs
@gasparnagy
BoDi does not currently provide any way to track and automatically dispose of objects returned from factory delegates. The following code changes enable this functionality while preserving the existing behavior.
The purpose of this PR is to make the changes necessary so that AutoFac lifetime scopes can be properly disposed between scenarios. See open SpecFlow issue Lifetime is Incorrect #12.
Usage:
void RegisterFactoryAs<TInterface>(Func<IObjectContainer, TInterface> factoryDelegate, string name = null, bool dispose = false)
@jonathansapp Thx! Could you please also add a line about this change to the bodi.cs header (change history)?