... Home Contact

Krzysztof Koźmic's blog

You're doing it wrong.


Show appreciation: My Amazon.com Wish List

Me@Twitter

    Currently reading

    Article Categories

    Archives

    Post Categories

    MyPersonal

    Syndication:

    December 2009 Entries

    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,...

    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 Dynamic Proxy 2.2 beta in the wild!

    Jono just pushed the first beta version of the Castle Dynamic Proxy 2.2 to the SourceForge. Don’t let the minor version number mislead you – this is a substantial improvement over the version 2.1. The changelog contains over 40 positions. I’m going to go over the most important ones here. Official support for Silverlight 2 or newer. Last version to support .NET 2.0. Substantial performance improvements (which includes more aggressive caching). Just see this: If you’re interested the...

    Castle Dynamic Proxy FAQ: why there’s no “class proxy with target”

    One of the commonly asked questions about Castle Dynamic Proxy: How do I use CreateClassProxy to wrap an existing object to intercept calls to its virtual members? Short answer is – you can’t. And if you think about it, there’s a very good reason for that. Since classes are stateful, and there's no requirement that all their members are virtual, you could end up with inconsistent state, where part of the state comes from proxy object, part comes from the target object. This would lead to bizarre behavior and bugs, that would be...