Hi there,
i'm trying to make my exceptionhandling dependend on the context. I have a factory class constructing exceptionhandlers. the handler should be constructed by the last thrown exception type. configuring structuremap the classic way, it works out fine. trying to use conditional constructing, my code fails and i can't see why?! What am i missing? Where is my major mistake?
regards, -jan
Working code:
ObjectFactory.Initialize(x =>
x.ForRequestedType<IExceptionHandler>()
.TheDefault.Is.OfConcreteType<MyExceptionHandler>());
Non-working code
ObjectFactory.Initialize(x =>
x.ForRequestedType<IExceptionHandler>().TheDefault.Is.Conditional(o =>
o.TheDefault.Is.OfConcreteType(MyExceptionHandler)));
Getting an instance:
IExceptionHandler handler = ObjectFactory.With("exception").EqualTo(exception).GetInstance<IExceptionHandler>();