public void Dispose()
 {
     if (context != null)
     {
         context.Dispose();
         context = null;
     }
 }
 public void Dispose()
 {
     if (context != null)
     {
         context.Dispose();
         context = null;
     }
 }
Esempio n. 3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // Free managed resources
         if (db != null)
         {
             db.Dispose();
             db = null;
         }
     }
 }
     public FixItTaskRepository()
     {
        db = new MyFixItContext();
        log = null;
 }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // Free managed resources
         if (db != null)
         {
             db.Dispose();
             db = null;
         }
     }
 }
        public async Task CreateAsync(FixItTask taskToAdd)
        {
            Stopwatch timespan = Stopwatch.StartNew();
            db = new MyFixItContext();

            try {
                db.FixItTasks.Add(taskToAdd);
                await db.SaveChangesAsync();

                timespan.Stop();
                log.TraceApi("SQL Database", "FixItTaskRepository.CreateAsync", timespan.Elapsed, "taskToAdd={0}", taskToAdd);
            }
            catch (Exception e)
            {
                log.Error(e, "Error in FixItTaskRepository.CreateAsync(taskToAdd={0})", taskToAdd);
                throw;
            }
        }
 public FixItTaskRepository(MyFixItContext context)
 {
     this.context = context;
 }
 public FixItTaskRepository(MyFixItContext context)
 {
     this.context = context;
 }