Esempio n. 1
0
 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();
         }
     }
 }
Esempio n. 2
0
 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));
            }
        }
Esempio n. 4
0
 protected override void OpenSession()
 {
     context = new PerformanceTestEntities();
     context.Database.Connection.Open();
 }
Esempio n. 5
0
 protected override void OpenSession()
 {
     context = new PerformanceTestEntities();
     context.Database.Connection.Open();
 }