c# - Prevent namespaces of top Config from getting wiped out when loading and configuring other .config in Unity -


this specific , difficult situation explain, bear me.

i have created unitycontainerextension responsible loading , configuring other .config files.

for example, app.config file looks this:

  <configuration>      <configsections>         <section name="unity" type="microsoft.practices.unity.configuration.unityconfigurationsection, microsoft.practices.unity.configuration, version=2.0.414.0, culture=neutral, publickeytoken=31bf3856ad364e35" />     </configsections>      <unity xmlns="http://schemas.microsoft.com/practices/2010/unity">          <assembly name="someassembly" />         <namespace name="someassembly.somenamespace" />          <container>              <extension type="configsectionextension" />             <extension type="testextension" />          </container>      </unity>    </configuration> 

my first extension configsectionextension runs code (following) loads in , configures container .config file. ex.

    var filemap = new execonfigurationfilemap { execonfigfilename = "logging.config"};     configuration configuration = configurationmanager.openmappedexeconfiguration( filemap, configurationuserlevel.none );     ((unityconfigurationsection)configuration.getsection( "unity" )).configure( container );   

this code runs fine, testextension extension in config cannot resolved after container has been configured logging.config file.

the specific response

    "the type name or alias testextension not resolved." 

if remove code loads , configures logging.config file container, both extensions found. there way make work?

this approach problem of not being able link multiple .config files. if knows better way link .config files unity, of course open solution well.

ok, think have ok solution. extension can qualify type , work. ie.

    <extension type="mediainjectorui.containerextensions.configsectionextension, mediainjectorui" />     <extension type="mediainjectorui.containerextensions.testextension, mediainjectorui" />  

maybe not prettiest thing in world, itdoes job.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -