Re: Disposing DataContext

From: Joshua Pyle (joshua.t.pyl..mail.com)
Date: Sat Dec 17 2005 - 00:34:04 EST

  • Next message: Andrus Adamchik: "Re: Disposing DataContext"

    Actualy I create DataContexts as local variables in some utilities and then
    bind to the thread and when the method completes I bind null to the thread
    so it cleans up. The only reason I bind the DataContext to the thread is so
    the API I use in my utility method can get the context off of the thread :-D

    So in short creating a DataContext as a local variable is ok. I've done
    ALOT of profiling and everything gets cleaned up just fine.

    --
    Joshua T. Pyle
    Go has always existed.
    

    On 12/16/05, Howard Treisman <htreisma..voka.com> wrote: > > Hi > I'm writing some Cayenne code that exists in a library, and will be called > by an external program. > > 1. Is it okay to just instantiate a DataContext each time my method is > called? In particular, are there any performance implications of doing this? > I don't have control over thread or session creation, so it's difficult for > me to set up the DataContext on the thread, etc. > > 2. When my method completes, do I need to dispose or cleanup the > DataContext in any way? Can I just create it as a local variable, and let > garbage collection do its thing? Are there any memory or connection leakage > issues? > > As a side issue - I'm reasonably sure these questions have been answered > previously on the mailing list - is there any better way of searching the > archieves than simply clicking on each month in turn? > > Many thanks, > Howard > > ------------------------------ > > [image: Avoka Technologies] > > *Howard Treisman* > *Technical Director* > Tel:+61 2 9976 4500 > Fax: +61 2 9976 5055 > Mobile: 0413 007 206 > Web: www.avoka.com > Email: htreisma..voka.com > International: + 612 9976 4500 Current time > Instant Messaging: *MSN:*howardtreisma..otmail.com *Yahoo:* htreisman*AOL: > *howardtreisman > >


    avoka_logo_25pt_blue.gif



    This archive was generated by hypermail 2.0.0 : Sat Dec 17 2005 - 00:34:05 EST