extending Practices Unity

Mar 3, 2011 at 12:10 PM

i need to extend my current configuration so that if i try to resolve some interface that has no mapping to sumthing it would automaticly make a new instance of the class with the same name without an "I" at the start... for example: if i try and resole IFOO and the configuration doesnt mention it, it would make a new instance (or get the instance in case it is singleton) of FOO (which i assume has the same namespace) the solution should include parameterized constructors..

thanks to anyone who could help a bit!

Mar 4, 2011 at 7:15 AM

You can create a custom Unity extension with a custom BuilderStrategy which you will need to add to the TypeMapping stage (UnityBuildStage.TypeMapping).  You will then override the PreBuildUp method of your custom BuilderStrategy class and put in the logic you want to implement when resolving.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.