I have a fairly straight-forward scenario that I am trying to solve but I'm hitting a few brick walls with Windsor - perhaps I'm trying to solve the problem in wrong way?
I have a type called Foo as follows:
public class Foo
{
[NonSerialized]
private IBar bar;
public IBar Bar
{
get { return this.bar; }
set { this.bar = value; }
}
public Foo(IBar bar)
{
}
}
I instantiate via the container in the normal way:
var myFoo = container.Resolve<Foo>();
The dependency IBar is registered with the container and gets resolved when the object is created. Now that the type has been created, I need to serialize it and I don't want to serialize IBar so it's marked with a NonSerialized attribute.
I then need to deserialize the object and return it to it's former state. How do I achieve this with Castle Windsor? I already have an instance, it is just missing it's dependencies.
If I was using Unity, I would use BuildUp() to solve the problem, but I want to use Castle Windsor in this case.