public static StockDBContext GetStockDBContext() { if (instance == null) { lock (padlock) { if (instance == null) { instance = new StockDBContext(); } } } return(instance); }
private StockDBContext context; // do not allow caller to access the DBContext public DBRepository() { context = StockDBContext.GetStockDBContext(); }