Replace obsolete AllTypes class in Castle Windsor

I have this code from an 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:

.MicroKernel.Registration.AllTypes' lock is deprecated

And this error is for o.LifeStyle.PerWebRequest :

As an operator

only assignment, call, increment, decrement, wait, and new object expressions can be used.

how can i fix this?

+5
source share
2 answers

Like @charleh, it AllTypeswas replaced by Classes, so fixing this problem is a simple find and replacement.

Actually, if you look at the compiler warning, it should say:

"AllTypes" . "" ( ) "" ( ). .

, AllTypes - ( ) , Classes - , , .

, :

Container.Register(
    Classes.FromAssemblyNamed(a)
        .Pick().WithServiceFirstInterface()
        .Configure( o => o.LifestylePerWebRequest()));

, Configure:

Container.Register(
    Classes.FromAssemblyNamed(a)
        .Pick().WithServiceFirstInterface()
        .LifestylePerWebRequest());

, Windsor BreakingChanges.txt, .

+8

, AllTypes Classes ( !)

,

IoC.Container.Register(AllTypes.etc)

IoC.Container.Register(Classes.etc)

, , , , , 3.2,

:

Ah: , dll Castle.Windsor - .NET, -

PerWebRequest Castle Windsor 3.2

+1

All Articles