GlobalContext Problem...

GlobalContext Problem...

Old forum URL: forums.lhotka.net/forums/t/2596.aspx


kbcb posted on Tuesday, March 27, 2007

Hey... Was wondering if anyone could tell me why this doesn't work?:

Csla.ApplicationContext.GlobalContext["ClientId"] = Client.GenerateNewId( );

If I break after the above line of code, ApplicationContext.GlobalContext["ClientId"] is null. However, if I do the following, it works fine:

Guid clientId = Client.GenerateNewId( );
Csla.ApplicationContext.GlobalContext["ClientId"] = clientId;

Don't understand what's going on here... My collegue and I figured that the compiler was holding the original reference of GlobalContext (before the GlobalContext was overwritten with the new one from the data portal) to set the data after the portal call is made.

Could use some clarification on this. Thanks!

Copyright (c) Marimer LLC