Click here to Skip to main content
15,996,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a singleton design pattern in my asp.net application. I have a static ContentStoreCore object.If concurrent users are using the same instance of the class ,Will data mix up occurs?

C#
public static class FactoryClass
{
    private static ContentStoreCore obj = null;
    private static readonly object padLock = new object();

    public static ContentStoreCore GetInstance()
    {
        lock (padLock)
        {
          if (obj == null)
          {
                obj = new ContentStoreCore();
          }
        }
        return obj;
      }
}
Posted
Comments
JoCodes 27-Nov-13 6:18am    
There should not be any datamix up since you are already ensuring thread safety by applying a lock

1 solution

Hi

Please refer the following msdn article .

http://msdn.microsoft.com/en-us/library/ff650316.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900