Loading dinamically assemblies from COM+ .NET components
-
Hi all, Does anybody know if there are problems loading and assembly using the static 'Assembly.Load' or similar from a .NET COM+ component? I have found that doing it my component wait as if it was in an infinite loop. I read only a line in the help about using the dinamic 'AppDomain.Load' inside these components. I did it and it works fine. A second question would be now if it is possible load from the GAC using AppDomain.Load, providing an assembly partial name. TIA Fennnan
-
Hi all, Does anybody know if there are problems loading and assembly using the static 'Assembly.Load' or similar from a .NET COM+ component? I have found that doing it my component wait as if it was in an infinite loop. I read only a line in the help about using the dinamic 'AppDomain.Load' inside these components. I did it and it works fine. A second question would be now if it is possible load from the GAC using AppDomain.Load, providing an assembly partial name. TIA Fennnan
Here's waht I use - it also late binds to a Enterpise Serviced component in COM+ - and calls the VersionProperty on the class represented by the Prog ID... // Create a Crypto Manager - Create the Type locally Type tEngine = Type.GetTypeFromProgID("Collaborator50.EQOSCollaborator", vstrAppServer, true); // Create an Instance of Type objEngine = Activator.CreateInstance(tEngine); // Make the call object objVersion = tEngine.InvokeMember( "Version", BindingFlags.Public | BindingFlags.GetProperty, null, objEngine, null);
-
Here's waht I use - it also late binds to a Enterpise Serviced component in COM+ - and calls the VersionProperty on the class represented by the Prog ID... // Create a Crypto Manager - Create the Type locally Type tEngine = Type.GetTypeFromProgID("Collaborator50.EQOSCollaborator", vstrAppServer, true); // Create an Instance of Type objEngine = Activator.CreateInstance(tEngine); // Make the call object objVersion = tEngine.InvokeMember( "Version", BindingFlags.Public | BindingFlags.GetProperty, null, objEngine, null);
It's possible I didn't explain myself well: Inside an Enterprise Services component I need to invoke, using reflection, a .NET class. The class I'm instanciating has not a COM Wrapper so has not a ProgId, so I can't load it using GetTypeFromProgID. Using the static method Assembly.LoadWithPartialName, I don't need to care about version, culture, etc. The problem is it stops my COM+ component (an Enterprise Service class), as if it was in an infinite loop. Then I found AppDomain.Load. This method is not static, so I use AppDomain.CurrentDomain in order to call the method. And it works!:omg:. From Microsoft documentation about this method it says: "This method is defined for interoperability callers who cannot call the static Load method." However, is the only reference I've found all around about this topic. If it works, why am I asking for? :confused: Cause I can't load assemblies with partial name using this method :(( I hope you're not being bored with my explanation! :cool: Cheers
-
It's possible I didn't explain myself well: Inside an Enterprise Services component I need to invoke, using reflection, a .NET class. The class I'm instanciating has not a COM Wrapper so has not a ProgId, so I can't load it using GetTypeFromProgID. Using the static method Assembly.LoadWithPartialName, I don't need to care about version, culture, etc. The problem is it stops my COM+ component (an Enterprise Service class), as if it was in an infinite loop. Then I found AppDomain.Load. This method is not static, so I use AppDomain.CurrentDomain in order to call the method. And it works!:omg:. From Microsoft documentation about this method it says: "This method is defined for interoperability callers who cannot call the static Load method." However, is the only reference I've found all around about this topic. If it works, why am I asking for? :confused: Cause I can't load assemblies with partial name using this method :(( I hope you're not being bored with my explanation! :cool: Cheers
Not bored - just nonplussed. We do this the 1st way you talekd about a lot from Serviced components and it works fine.