Determine implementation at run-time

Mar 13, 2009 at 2:51 PM

I'm sure this has been covered, but my searches aren't turning up with anything I can use.

Based on the culture code at run-time I am looking for a way to inject different implementations an abstract class.  So if the user is canadian, a CanadianSearchDao : ISearchDao will be injected but if the user is from the US, USSearchDao : ISearchDao will be injected.

Any information on this would be greatly appreciated, and I'm tackling the problem in the wrong way, I'd appreciate hearing that too.

Mar 16, 2009 at 10:08 PM
The easiest way to do this would be to use the StaticFactory extension, and do your extra logic there.

The cleanest way would be to have a custom build key mapping policy that did the check. You'd need to do some lower-level objectbuilder work to get that to happen, plus some configuration support (which I'm not sure we support doing right now... thanks, I'll have to make sure it's on the backlog for Unity 2.0).