This project is read-only.

Creating a factory to resolve instances by key results in multiple Torn Lifestyle Warnings

Jan 26, 2015 at 3:20 PM
I have followed the guidance in the Simple Injector documentation regarding resolving instances by key, using <lifestyle>.CreateRegistration to create multiple registrations for a given interface. When my application starts, I receive multiple Torn Lifestyle warnings containing the text:
The registration for ITransactionRegistrationService maps to the same implementation and lifestyle as the registration for ITransactionRegistrationService does
Is this expected? Can I safely ignore these warnings?
Jan 26, 2015 at 5:37 PM
Hi @pmarfleet, the torn lifestyle is a new feature - would you be able to provide some basic code to demonstrate this?
Jan 26, 2015 at 7:44 PM
Take a look at the Torn Lifestyle page in the documentation. It will hopefully make it more clear why the container is warning you.
Jan 26, 2015 at 10:38 PM
My application allows the user to configure, through the user interface, which payment provider they want to use to process credit card payments (SagePay, Barclaycard etc). There are therefore multiple implementations registered against the same interface (ITransactionRegistrationService). When a user chooses to process a CC payment, I need to resolve the implementation of ITransactionRegistrationService that is currently configured as the default provider for processing CC payments. My factory class for resolving implementations of ITransactionRegistrationService follows the final example given in the above article. Am I OK to ignore these warnings, or should I be looking to solve this problem in a different way?
Jan 26, 2015 at 10:46 PM
I'm not sure. Can you show the relevant portion of your configuration?