I know that the accepted practice is to use DataContext in the Unit of Work pattern but I came across this statement from MSDN:
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
As I read it, if a DataContext is declared as static it is thread safe.
http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.aspx
No, that is not correct.
What that is saying is that static members of
DataContextitself are thread safe – not static instances of it.Note that this is pretty much the standard for most classes in .NET. (with allowance for disagreement on what ‘most’ means). I am not immediately aware of any static members of
DataContext.