... Home Contact

Krzysztof Koźmic's blog

Designed in Poland, assembled in Australia.


Show appreciation: My Amazon.com Wish List


Me@Twitter

    Currently reading

    Article Categories

    Archives

    Post Categories

    MyPersonal

    Syndication:

    Castle Windsor

    There are 5 entries for the tag Castle Windsor

    Castle Typed Factory Facility reborn

    Disclaimer: Notice that code shown here is quite new and is subject to change. If you’re reading this and it’s 2010 it’s likely that the code now is slightly different. I may come back and revisit the post if there are any changes, but don’t hold my word on it. Pulling from the container General rule of thumb when using IoC containers is – when you’re referencing your container in your components (anywhere outside of your bootstrapping code) you’re doing it wrong. As with all rules there are exceptions, but they...

    Castle Windsor new feature – dynamic parameters from registration site

    UPDATE: I renamed the method from WithParameters to DynamicParameters to avoid confusion and be consistent with Parameters method which is used for static parameters. I just committed small new feature to Castle Windsor, that I think can nicely clean up your code. It remedies the following problem: Problem What if you have a component that relies on a dynamically provided primitive value? Things like current request’s Uri, or DateTime.Now? public class UsesCurrentTime ...

    Overriding generic component’s resolution in Castle Windsor

    Few months ago, a user asked the following question on the Castle users discussion group. A friend asked me about the same thing today, so I thought I’d blog this so that’s easier to find than the discussion group thread. Anyway, here’s the question: say I have the following types public interface ISometype<T> {} public class SomeTypeImpl<T>:ISometype<T> {} public class SomeSpecificTypeImpl<T>:ISometype<T> where T: ISomeSpecificSpecifier {} ...

    Castle Windsor lazy loading

    I just committed a very cool feature to Castle Windsor/MicroKernel that adds lazy registration capabilities. By lazy registration I mean – you get a chance to register a component right at the spot when it’s about to be resolved. This enables things like integration with external sources of components, like MEF, or WCF config files, lets you distribute your registration in time so that you don’t have to do all of it upfront and many more. Behind all of this, is this interface: /// <summary> ///...

    Castle Windsor forwarded types and proxies

    Castle Windsor allows you to use single component for multiple services, which is called Forwarded Types. Forwarded Types In other words, you can tell Windsor – when IFoo is requested use FooBar as implementation, and when Bar is requested also use FooBar (when using default lifestyle of singleton you’ll get the same instance). Here’s some code: var container = new WindsorContainer(); container.Register(Component.For<Bar>().Forward<IFoo>() .ImplementedBy<FooBar>()); var foo = container.Resolve<IFoo>(); ...