none
Dynamicly load assambley when need/if need RRS feed

  • Question

  •  

    Hello

     

    Depending on config I need to load depending assambley or not load it at all.

    Example

     

    If Variable Groceries is set to milk, I would load milk assambely, if it's set to bread load bread.dll,

    if not configured  I would not need to load this assambley and also no need to ship it to client in installation as well.

     

    I have done search in net only reference I can find is this

    http://www.codeproject.com/KB/cs/Assemblies___Appdomains.aspx

    As it says it's a limitation of .NET that loading assambley in runtime is very very bad idea.

     

    Hope I explained enough

     

    Thank you

     

    Thursday, May 1, 2008 2:01 AM

Answers

  • The question is whether you need to unload the assembly after having loaded it.  If you only need to load the assembly, then it's fairly easy and there's no headache involved.  You'll have to have some kind of mediation interface between the host and the plugin assembly.

    If you need to load the assembly and subsequently unload it, then you will need a separate AppDomain to accomplish this, because it's impossible to unload an individual assembly - only an entire AppDomain.  This is slighty harder, but still doable.

    What's certain is that loading an assembly at runtime is not a bad idea.  There are many frameworks based on loading assemblies dynamically.
    Thursday, May 1, 2008 8:44 AM

All replies

  • The question is whether you need to unload the assembly after having loaded it.  If you only need to load the assembly, then it's fairly easy and there's no headache involved.  You'll have to have some kind of mediation interface between the host and the plugin assembly.

    If you need to load the assembly and subsequently unload it, then you will need a separate AppDomain to accomplish this, because it's impossible to unload an individual assembly - only an entire AppDomain.  This is slighty harder, but still doable.

    What's certain is that loading an assembly at runtime is not a bad idea.  There are many frameworks based on loading assemblies dynamically.
    Thursday, May 1, 2008 8:44 AM
  •  

    Thxn mate, you helped I just did a search on assambley load and pure magic - all explained.

     

    And no I do not need to unload it, just load a proper one, then access it thru interface.

     

     

    Thank you

    Friday, May 2, 2008 12:30 AM