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