开发者

How to configure StructureMap for different Import Types

I have currently 2 file types I can import. I have an interface of type IImportFileAction. Then I have 2 classes that inherit this interface named ImportGPX and ImportTCX. Import GPX imports a .gpx file a开发者_开发知识库nd ImportTCX imports a .tcx file. I pass the filename in the constructor of these two classes. How would I initialize StructureMap so that if the files extention is gpx the GetInstance will return the ImportGPX and vice versa for TCX?


Take a look at Jeremy's post on conditional object construction. Afterwards you may find this SO question useful as an example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜