protected override void TearDown() { using (var dataContext = new PerformanceTestEntities()) { using (var transaction = dataContext.Database.BeginTransaction()) { foreach (var s in dataContext.Simplests) dataContext.Simplests.Remove(s); dataContext.SaveChanges(); transaction.Commit(); } } }
protected override void TearDown() { using (var dataContext = new PerformanceTestEntities()) { using (var transaction = dataContext.Database.BeginTransaction()) { foreach (var s in dataContext.Simplests) { dataContext.Simplests.Remove(s); } dataContext.SaveChanges(); transaction.Commit(); } } }
public HttpResponseMessage findStudent() { try { using (PerformanceTestEntities mde = new PerformanceTestEntities()) { mde.Configuration.ProxyCreationEnabled = false; var response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(mde.Students.Where(x => x.ClassId == 1).ToList())); response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(response); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.BadGateway)); } }
protected override void OpenSession() { context = new PerformanceTestEntities(); context.Database.Connection.Open(); }