views:

165

answers:

1

Hi,

I have an interface IFileSystemStructureEvaluator with two concrete implementations: NtfsFileSystemStructureEvaluator and FtpFileSystemStructureEvaluator.

I want to be able to request the appropriate IFileSystemStructureEvaluator depending on whether the Uri that is passed to the constructor is a file uri of an FTP uri.

How can I achieve this in StructureMap?

Thanks

+3  A: 

You should check out the Conditional Object construction post by Jeremy Miller. It allows you to use some conditional checks in determining what you'll get as an instance. It sounds like a solution to your problem.

http://codebetter.com/blogs/jeremy.miller/archive/2009/01/18/conditional-object-construction-in-structuremap-i-e-fun-with-lambdas.aspx

Chris Missal
There doesn't seem to be a way to access constructor arguments. Oh, well.In any case - thanks for your input.
Arnold Zokas