Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

The GAC and static stuff

Back to Forum: Tech Off
  • User profile image
    Troj

    Hi Folks

    My Boss has just heard about the GAC and is interested in looking at refactoring our software with MVP in mind, with the aim of putting the final Assembly inthe GAC so all of our websites use one Library.

    In theory it sounds like quite good fun, if nothing else doing the MVP work is something I've been pushing for, for an age now - but my question is about statics in the library, will they be shared across every website using that DLL or will each website have it's own, as it uses it ?

    If you get what I mean ? Big Smile

  • User profile image
    cokert

    one way to test would be create a class with a static member variable and increment it from two different apps.

    if it turns out that the two apps both modify the variable at the same time, i would imagine you may have to worry about thread-safety depending on what youre static classes actually do.

  • User profile image
    Sven Groot

    Static variables have so-called "application lifetime". They get created when the application starts and destroyed when it shuts down (slight oversimplification, as .Net actually creates static members when the type that contains them is first accessed, and their lifetime is actually governed by the AppDomain).

    So if two web sites in IIS do not use the same application (which they shouldn't, normally), they won't use the same instance of static variables.

  • User profile image
    Troj

    thanks Sven, I suspected that'd be the case.

    Just to clarify, are you talking about the Application Pool ?

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.