Tuesday, February 5, 2019

Singleton Design Pattern

Singleton Design Pattern
1.  Class in sealed (sealed will prevent the class inheritances(even if child child is nested class))
2. Constructor is private (helps in preventing any external instantiations of objects)
3. Double check - inner check so as to create instance. Outer check so as to not check if object is created again and again.
4. Lock so as disallow parallel invoke




Thread Safe version

No comments:

Post a Comment

Asp.net Core Continued

65 66 67 68 69 70 71 65 ASP.NET Core Identity It is a membership system Step 1 : Inherit from IdentityDbContext class instead of ...