public UseData() { Context = new WMAERPEntities(); if (Context.Database.Connection.State != ConnectionState.Open) { Context.Database.Connection.Open(); } Db = Context; LastKeysErrorMsg = new ResourceKeys(); }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { Context?.Dispose(); Context = null; // called via myClass.Dispose(). // OK to use any private object references } _disposed = true; } }