Re: Weird behavior (M5)

From: Kevin Menard (kmenar..ervprise.com)
Date: Tue Aug 23 2005 - 22:19:53 EDT

  • Next message: Andrus Adamchik: "Re: Object Graph question"

    Nick Stuart wrote:
    > I know for sure that they all share the same DataContext as this is
    > happening in a very small and simple unit test. The create method
    > calls are taking place one right after the other. And the ctx is
    > actually a static memeber that only gets initialized once for each
    > run.

    Just as a personal anecdote, I was certain I was using the same
    DataContext once, and it turned out I was not. What was happening was
    that some objects were being pulled out of the DB with a different DC
    and then added as part of a relationship to my objects of concern.
    Well, if the objects of concern had not been registered with a DC yet,
    they were auto-registered with the DC of the other objects added as part
    of the relationship. I would then go ahead and register with my other
    DC, which really wouldn't do anything since the objects were already
    registered with a different DC. It wasn't until I actually debugged the
    app that I realized what was going on.

    So, the moral of the story is that you can never be sure, even in the
    simplest of examples. Btw, I managed to mess all of this up in about 5
    lines of code.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Tue Aug 23 2005 - 22:16:34 EDT