Access custom objects from codebehind

  • Thread starter Thread starter MAG
  • Start date Start date
M

MAG

Hi,

After using an assembly compiled into a DLL and added to the assembly
cache for several months, we decided that it was too much trouble to
maintain because of all the steps involved with every minor change
(e.g. making the change, compiling, uploading the dll to the
production server, opening vnc and running gacutil, etc...). I have 2
questions associated with the problem, and depending on the answers,
we'll decide what's best:

1- Is there a way to unload the assembly from memory without
restarting the server? From our experience, the only way we found for
updating an assembly in the assembly cache is to restart the machine,
otherwise, the assembly seems to stay in memory and the new dll file
with the modifications is not taken into account.

2- If we move all the dll source code into a single .vb file, is there
a way to access the classes from codebehind? <% Assembly src... %>
does not seem to work for that, the classes being accessible only in
the aspx page and not in the aspx.vb code... With the dll in the
assembly cache, we only had to use Import statement. How do you do
"Import" classes from a .vb file?

Thanx for any useful infos!

MAG
 
depends on the OS of the server.
With 2003 you can flush the app pool or restart the SITE as well.
 
Some thoughts:

You can unload an AppDomain, but you cannot unload an Assembly within an AppDomain. This means that
all of the objects you get out of your Assembly will need to be Serializable since they cross domain
boundaries.

Here's an idea I had a while back, but haven't had the chance to think about further: You could put
that .dll in some folder on the server. Then you could have a Windows Service app that monitors the
file for changes; when there's a change, have it load the file into the GAC for you.

Windows Explorer supports "drag-n-drop" install into the GAC; go do c:\<windows dir>\Assembly\ and
drop the file in. This *does* work over NetBios too, so you can install on a remote box if you don't
mind using that.

I'm unsure about what you mean in #2. You have to add that dll to the "References" section of your
project anyhow or it won't compile. If you just move all the code to the same project, you're done.
If you're going to do that, why not just remove the thing from the GAC entirely and just drop it in
the same directory as the app? (Less things to change/break)

Granger
 
Back
Top