Castle Windsor Documentation
November 27, 2019 ยท View on GitHub
Castle Windsor is best of breed, mature Inversion of Control container available for .NET.
- See the release notes
- Download it
- Get official and pre-release builds from NuGet:
PM> Install-Package Castle.Windsor
Show me the code already
Windsor is very simple to use. Code below is not just hello world - that's how many big real life applications use Windsor. See the full documentation for more details on the API, features, patterns, and practices.
// application starts...
var container = new WindsorContainer();
// adds and configures all components using WindsorInstallers from executing assembly
container.Install(FromAssembly.This());
// instantiate and configure root component and all its dependencies and their dependencies and...
var king = container.Resolve<IKing>();
king.RuleTheCastle();
// clean up, application exits
container.Dispose();
So what about those installers? Here's one.
public class RepositoriesInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Classes.FromThisAssembly()
.Where(Component.IsInSameNamespaceAs<King>())
.WithService.DefaultInterfaces()
.LifestyleTransient());
}
}
For more in-depth sample try the section below, or dive right into API documentation on the right.
Samples and tutorials
Learn Windsor by example by completing step-by-step tutorials. See Windsor in action by exploring sample applications showcasing its capabilities:
- Basic tutorial
- Simple ASP.NET MVC 3 application (To be Seen) - built step by step from the ground up. This tutorial will help you get up to speed with Windsor quickly while keeping an eye on both the usage of the container API as well as patterns that will help you get the most out of using the container.
Documentation
Concepts
- Inversion of Control and Inversion of Control Container
- Services, Components and Dependencies
- How components are created
- How dependencies are resolved
Using the Container
- Using the container - how and where to call it
- Windsor installers - this is how you tell Windsor about your components
- Registration API reference
- Using XML configuration
- Passing arguments to the container
- AOP, Proxies, and Interceptors
- Child Containers
- Windsor's support for debugger views and diagnostics
- Windsor's support for performance counters
Customizing the container
- Extension Points Overview
- Lifestyles
- Lifecycle
- Release Policy
- ComponentModel construction contributors
Extending the container
Know another container
Resources
- External Resources - screencasts, podcasts, etc
- FAQ
- Roadmap