var container = new WindsorContainer(); container.Register(Component.For().ImplementedBy ()); container.Register(Component.For ().ImplementedBy ());
var service = container.Resolve();
public class MyController { private readonly IService _service; public MyController(IService service) { _service = service; } // ...other methods } container.Register(Component.ForIn this example, we define a controller class which has a dependency on the IService interface. The dependency is injected via the constructor. We register the MyController class with the container so that when we resolve it, the container will automatically inject the required dependencies. WindsorContainer is available as a NuGet package and can be installed using NuGet package manager in Visual Studio. The package name is Castle.Windsor.());