Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / January 2006

Tip: Looking for answers? Try searching our database.

Intercept CLR Calls in an application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Valenti - 05 Jan 2006 19:02 GMT
Is there any way to write a class that wraps around the CLR?  Basically we
have an ASP.NET application that has had some core DLL's renamed (the product
has been renamed) and we're wanting to still preserve compatibility with
customer developed plugins.

For example, previously, we had a DLL named "BusinessManager.Data.dll", what
we're wanting to do is basically intercept the call to load that DLL and
instead redirect it to "Portfolio.Data.dll" (all we're doing is replacing
BusinessManager with Portfolio).  Does the .NET framework support this?  Is
there any way we could accomplish that by throwing an entry into the
web.config file?

Thanks a ton,
Tony Valenti
David Browne - 06 Jan 2006 00:12 GMT
> Is there any way to write a class that wraps around the CLR?  Basically we
> have an ASP.NET application that has had some core DLL's renamed (the
[quoted text clipped - 10 lines]
> there any way we could accomplish that by throwing an entry into the
> web.config file?

Why don't you just provide a new implementation of
"BusinessManager.Data.dll" which is a facade for "Portfolio.Data.dll"?

David
Tony Valenti - 06 Jan 2006 01:39 GMT
We're wanting to have as little impact on the existing infrastructure.
john conwell - 06 Jan 2006 19:23 GMT
Well, sort of.  you cant do it (i think) in .Net with C# or VB.Net.  You
could do it with C++ by writing your own CLR host exe.  The book 'Customizing
the Microsoft® .NET Framework Common Language Runtime ' tells you how to do
this.

Actually, after looking in MSDN, the AppDomain's AssemblyResolve Event looks
like it might work for you.  AssemblyResolve event gets called when the CLR
tries to load an assembly, but it cant find it.  the event's return type is
an assembly.  So if your dll isnt there, you can basically manually load
whatever assembly you wanted and return it.  maybe

> Is there any way to write a class that wraps around the CLR?  Basically we
> have an ASP.NET application that has had some core DLL's renamed (the product
[quoted text clipped - 10 lines]
> Thanks a ton,
> Tony Valenti
Tony Valenti - 08 Jan 2006 09:16 GMT
Very Nice!  That is exactly what I was looking for.  Do you know if there is
something similar to that involving classes?
Tony Valenti - 08 Jan 2006 09:21 GMT
It looks like I can do it through

System.Reflection.Assembly.GetExecutingAssembly().ModuleResolve += new
System.Reflection.ModuleResolveEventHandler(Program_ModuleResolve);

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.