Beispiel #1
0
 public static SingletonProductCategory SetInstance()
 {
     // Uses lazy initialization.
     // Note: this is not thread safe.
     _instance = null;
     return(_instance);
 }
Beispiel #2
0
 public static SingletonProductCategory Instance()
 {
     // Uses lazy initialization.
     // Note: this is not thread safe.
     //if (_instance == null)
     //{
     using (SSLsEntities db = new SSLsEntities())
     {
         _instance = new SingletonProductCategory();
         //var data = db.ProductCategory.OrderBy(w => w.Id).ToList();
         var data = db.ProductCategory.Where(w => w.Enable == true).OrderBy(w => w.Id).ToList();
         _instance.ProductCategories = data;
     }
     //}
     return(_instance);
 }