Replace Obsolete AllTypes class in Castle Windsor
Like @charleh said, AllTypes
was replaced with Classes
so fixing this problem is a simple find and replace.
Actually if you look at the compiler warning it should say:
'AllTypes' has been deprecated and will be removed in future releases. Use 'Classes' static class (if you want to just register concrete classes) or 'Types' static class (if you want to register interfaces or abstract classes too) instead. It exposes exactly the same methods.
The reason for this change was that AllTypes
was a lie - it was only matching concrete (non-abstract) classes, so Classes
is a much better name that better tells you what it really does.
As for the other problem, changing the property call to a method call will fix it:
Container.Register(
Classes.FromAssemblyNamed(a)
.Pick().WithServiceFirstInterface()
.Configure( o => o.LifestylePerWebRequest()));
Or simpler yet, skipping the Configure
:
Container.Register(
Classes.FromAssemblyNamed(a)
.Pick().WithServiceFirstInterface()
.LifestylePerWebRequest());
Windsor ships with BreakingChanges.txt
file which describes breaking changes and how to upgrade.