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