Replace Obsolete AllTypes class in Castle Windsor
castle-windsor
Solution
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.
Problem
I have this code from old castle: ``` IoC.Container.Register( AllTypes .FromAssemblyNamed(a) .Pick().WithService.FirstInterface() .Configure(o => o.LifeStyle.PerWebRequest)); ``` When I upgrade to castle 3.2 I get this error: Castle.MicroKernel.Registration.AllTypes' is obsolete And this error for o.LifeStyle.PerWebRequest : Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement How can I fix this?