container.Register(Component.For().ImplementedBy ().LifestyleSingleton());
container.Register(Component.For().ImplementedBy ().LifestyleTransient());
container.Register(Component.ForThis code registers a factory method that returns an instance of a class that implements the IMyService interface. These examples use Castle.Windsor NuGet package library for .NET framework.().UsingFactoryMethod(() => CreateMyService()));