Exemplo n.º 1
0
 public void TestDbContext()
 {
     using (var dbContext = new ClassTrackerDbContext())
     {
         var x = dbContext.Organizations.Create();
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public int Foo(int x, int y)
 {
     try
     {
         using (var dbContext = new ClassTrackerDbContext())
         {
             // interesting code - use your imagination
             return(dbContext.Courses.Count() + x + y);
         }
     }
     catch
     {
         return(-1); // Don't do this, it's a stupid sample
     }
 }