Donate

Castle.MicroKernel.Registration.AllTypes' is obsolete in ASP.NET MVC 5

In the event that you'll be referencing Castle Windsor 3.3.0 and incorporate the IOC container in your project, you will encounter the error stated by the title of this post. This happens when you use register the controllers to the IOC container using AllTypes class.

1
2
3
4
container.Register(AllTypes.FromThisAssembly()
      .Pick().If(t => t.Name.EndsWith("Controller"))
      .Configure(configurer => configurer.Named(configurer.Implementation.Name))
      .LifestylePerWebRequest());

This class has been deprecated in the recent versions of Castle Windsor. The solution is to update the Register method and replace AllTypes with Castle.MicroKernel.Registration.Classes.

1
2
3
4
container.Register(Classes.FromThisAssembly()
     .Pick().If(t=> t.Name.EndsWith("Controller"))
     .Configure(configurer => configurer.Named(configurer.Implementation.Name))
     .LifestylePerWebRequest());

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Pass GUID As Parameter To Action Using ASP.NET MVC ContribGrid