October 2009 Entries
We’ve covered almost all of Dynamic Proxy. If you followed along through this series, you now know 95% of Dynamic Proxy 2.1 features that get used 99,9% of the time. Now is the time to wrap up, and with that we’ll review some of the most common pitfalls that you may encounter when developing code on top of Dynamic Proxy. Leaking this Consider this simple interface/class pair public interface IFoo
{
IFoo Bar();
}
public class Foo : IFoo
{
...
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>();
...
Recently I had a problem with the application I’ve been working on. One of entity types in my domain had a property of type uint. Not a big deal, until you want to store it in Microsoft SQL Server database which does not support unsigned types. I’ve been scratching my head for a moment and then I found a solution – let’s map it as long in our database. Since long can represent any legal value of uint, we should be all good, right? So let’s do it. ...
As of now Dynamic Proxy is passing all the tests under Silverlight. There’s still some work to do, but it is pretty stable the way it is, and it’s been used by Silverlight versions of Rhino Mocks, Moq and probably some others as well for some time. Technorati Tags: Castle,Silverlight,Dynamic Proxy
The Seed of Hope (Talent Tree) I used to be a big fan of fantasy and science fiction books back in a day. I read a ton of books by David Eddings, Mercedes Lackey, R. A. Salvatore, Janusz A. Zajdel and countless other authors. I’m still completing my collection of Discworld books, and trying to find some time to read the monstrous (1000+ pages) Lód by Jacek Dukaj. When Pragmatic Bookshelf released their first non-technical book, “The Seed of Hope”, I thought it might be an interesting...