I dont like how this Hanselmann states his personal opinion as fact without really explaining the backgrounds. He absolutely lost my respect when simply calling ThreadStatic evil, but stating Thread.AllocateNamedDataSlot as good solution, while this is eventually the same thing. Its even written in the Documentation to use ThreadStatic instead of Thread.AllocateNamedDataSlot for better performance.
The link Robert Rudduck posted earlier handled this issue much more scientific and actually tells you exactly where the problems lie. You will implicitly learn how to avoid those problems. Its a fact that I have to store the data in the context of a Thread, because of reasons I mentioned earlier. But still, if anyone can think of a better solution I will be gladly analysing it. For now im still stuck with ThreadStatic and writing a documentation that explains how to use it in ASP.Net. Greetings! Zorgoban On 2 Mrz., 18:41, Socratees Samipillai <[email protected]> wrote: > More relevant links. > > http://www.hanselman.com/blog/StoringThingsOnThreads.aspxhttp://www.hanselman.com/blog/ATaleOfTwoTechniquesTheThreadStaticAttr...http://integralpath.blogs.com/thinkingoutloud/2005/03/threadstatic_fu... > > Socratees. > > On Tue, Mar 2, 2010 at 11:11 AM, Socratees Samipillai <[email protected]>wrote: > > > @Zorgoban, > > > I found this thread on Microsoft.Public.Dotnet.Framework.ASP.net rather > > enlightening. > > >http://groups.google.com/group/microsoft.public.dotnet.framework.aspn... > > > Not sure if its of help to you though. > > > Socratees. > > > On Tue, Mar 2, 2010 at 9:47 AM, Zorgoban <[email protected]> wrote: > > >> @Robert Rudduck: What a great article! This discourages the use of the > >> Session as a member variable and trusting to be clean inside one > >> request. But if you allways use the session inside a using() > >> statement, you should be save. There might even be the possibility > >> with the member variable if you initialize it in OnLoad and dispose of > >> it in OnPreRender, but thats a different story and doesnt change the > >> unit of work concept. Im still reading the article, so there might be > >> some new insight later on. For now, thanks! > > >> Greetings! > >> Zorgoban > > >> On 2 Mrz., 16:18, Robert Rudduck <[email protected]> wrote: > >> > This link has a good explanation as well as experimental evidence: > > >> >http://piers7.blogspot.com/2005/11/threadstatic-callcontext-and_02.html > > >> > On Tue, Mar 2, 2010 at 8:28 AM, Angel Java Lopez <[email protected] > >> >wrote: > > >> > > Source link? > > >> > > On Tue, Mar 2, 2010 at 11:10 AM, Fabio Maulo <[email protected]> > >> wrote: > > >> > >> because MS said that you may have more than one thread in a request. > > >> > >> -- > >> > > You received this message because you are subscribed to the Google > >> Groups > >> > > "nhusers" group. > >> > > To post to this group, send email to [email protected]. > >> > > To unsubscribe from this group, send email to > >> > > [email protected]<nhusers%[email protected]> > >> <nhusers%[email protected]<nhusers%[email protected]> > > >> > > . > >> > > For more options, visit this group at > >> > >http://groups.google.com/group/nhusers?hl=en. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "nhusers" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<nhusers%[email protected]> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
