Re: Dynamically loading an assembly

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi, Mark

You don't have to use reflection for every method call if the class
defined in B implements an interface that is accessible in A.

For example, you can define assembly C, which contains an interface
definition for a type in B. Reference C when you are building A. At runtime,
after creating an object that is defined in B using reflection, you can
immediately cast it to the interface defined in C and then you don't need to
use reflection in subsequent calls.

--
Ming Chen
http://engdump.blogspot.com/


<markoueis@xxxxxxxxxxx> wrote in message
news:1131995243.408910.324800@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Our .NET application, let's call it A, needs to load an assembly of
> another .NET application, let's call it B. Preferably I would like to
> early bind and early load the B assembly. However, in a deployment
> scenario, it is possible that B is not installed, in which case, the
> dependencies for its assembly won't be there. When I try to load that
> assembly (which is copied) regardless, my application crashes saying
> that its dependencies cannot be found.
>
> What's the best way to solve this problem? I could late bind the
> assembly, but then do I really have to use reflection for each and
> every method call I make against this assembly? If this is so, are
> there any OO design techniques out there I can use? Is there any way I
> can still compile against that assembly?
>
> Are there any good solid articles on this kind of development?
>
> Thanks
>
> Mark
>


.



Relevant Pages

  • Re: Circular references not possible?
    ... > I've reverted to using reflection but am not really happy about it. ... As I stated use the Separated Interface pattern! ... Activator.CreateInstance to dynamically load the concrete class that offers ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to hook up EventHandler or Delegate to UserControl thru Re
    ... I mention reflection because the interface is in a third party assemble that ... I don't have access to code so I needed to use reflection to get at the ... public delegate bool CustomSaveHandler; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: The Extreme Failure of Poor Concepts in Discussing Thin Layer R...
    ... >> It is quite evident that through the actions of the first interface, ... >> that there is less energy incident upon the second interface. ... My analysis allowed ALL of the energy in the reflection from the ...
    (rec.radio.amateur.antenna)
  • Re: Gettting dictionary count from an object
    ... reflection to access these members. ... able to call members on generic types which do not require type parameters, ... almost using an unqualified generic type as an interface. ... public class GenericDictionaryToNonGenericDictionaryWrapper<TKey, TValue>: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How is the best way to pass object, values or results between x-layer classes?
    ... | that expose an interface or a class) isn't practiseable ... ... | a book obeject via reflection. ... Why do you say that you can't create a DLL that exposes a class or interface ... private string author; ...
    (microsoft.public.dotnet.languages.csharp)