Extending UnityConfigurationSection

Jan 5, 2012 at 12:25 AM

Hi,

 

I have done a brief search of the topic under discussions, and havent found a relevant one.

It would be great to have configuration properties to be marked virtual. For example, instead of me writing an additional config section to add a certain attribute for each type mapping, I could simply inherit from 3 classes, override 2 properties, and add 1 property repressing the attribute to the Type mapping config class.

This may not be a very popular use case, but wouldn't be very hard to do. Ofcourse, I may be missing the way it could be done without that, so if you point me in the right direction, it will be most appreciated!

 

Thanks,

Andrei

Jan 5, 2012 at 12:27 AM

Oh, just to mention it.

Currently, I will just download the source, make the modification I need and use the modified library. This ain't a big problem for me...

Jan 5, 2012 at 3:29 AM

Your approach is not currently supported by Unity; I agree modifying the source will be your best bet.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com 

Jan 5, 2012 at 3:37 AM

Hi Randy,

Thanks for the prompt reply! I will do it that way then :)

Jan 5, 2012 at 4:44 AM
Edited Jan 5, 2012 at 5:57 AM

Actually, first you should look at using Unity Container Extensions to do what you want: http://msdn.microsoft.com/en-us/library/ff660880(v=pandp.20).aspx.  Here's a sample Extension: http://www.beefycode.com/post/Decorator-Unity-Container-Extension.aspx

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com 

Jan 5, 2012 at 4:55 AM

Hi Randy,

Thanks for the link, will check it out.