This project is read-only.

override default implementation

Jul 25, 2014 at 3:21 PM
What is the best way of overriding the default implementation of some interface.
By using (customer specific) plugins we want to override the default behavior of default implementations.

Jul 25, 2014 at 3:34 PM
Can you be a bit more specific about what you're trying to achieve? Can you post any code snippets to support your question?
Jul 25, 2014 at 4:43 PM
IOrderForm has a default implementation OrderForm

For a specific customer we want to override the form to show additional fields. We create another IOrderForm implementation. This custom implementation should be used when the IOrderForm is resolved.

(Using structuremap you can register multiple implementation and last one is the default)
Jul 25, 2014 at 6:46 PM
Edited Jul 25, 2014 at 6:46 PM
You can switch on the option to override registrations
var container = new Container();

container.Register<IOrderForm, OrderForm>();

container.Options.AllowOverridingRegistrations = true;

container.Register<IOrderForm, SpecialOrderForm>();
Marked as answer by dot_NET_Junkie on 8/11/2014 at 12:35 PM