How can I figure StructureMap to use more than one concrete Class per Interface.
i.e. an IRepositoryCustomer is implemented by: RepositoryCustomerA and RepositoryCustomerB
How do I register and resolve this to/from the StructureMap IoC container?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You first need to answer the question, “when do I want RepositoryCustomerA instead of RepositoryCustomerB?”
If either of those classes could be instantiated in production based on some runtime state, then you probably want to look into conditional object construction.
If RepositoryCustomerA should be instantiated at development time (for unit testing, say) while RepositoryCustomerB is the production analog, then you need two distinct
Registrys: one that exists only in your test code, and one that is accessible in production. For more on this route, read about creating registries as a means of configuring StructureMap.