public void Update(long jobId, InstantTrigger trigger) { using (var connection = this.connectionFactory.Open()) { var entity = trigger.ToEntity(); connection.Update(entity); } }
private void InsertTrigger(InstantTrigger trigger) { var entity = trigger.ToEntity(); if (entity.CreatedDateTimeUtc == default(DateTime)) { entity.CreatedDateTimeUtc = DateTime.UtcNow; } using (var connection = this.connectionFactory.OpenDbConnection()) { trigger.Id = connection.Insert(entity, true); } }
public void Update(long jobId, InstantTrigger trigger) { using (var session = this._documentStore.OpenSession()) { var job = session.Load <Model.Job>(jobId); var triggerFromDb = job.InstantTriggers.First(p => p.Id == trigger.Id); job.InstantTriggers.Remove(triggerFromDb); var entity = trigger.ToEntity(); job.InstantTriggers.Add(entity); session.Store(job); session.SaveChanges(); } }
public void AddTrigger(long jobId, InstantTrigger trigger) { using (var session = this._documentStore.OpenSession()) { var job = session.Load <Model.Job>(jobId); var entity = trigger.ToEntity(); entity.Id = ++job.LastTriggerId; entity.CreatedDateTimeUtc = DateTime.UtcNow; job.InstantTriggers.Add(entity); session.Store(job); session.SaveChanges(); trigger.Id = entity.Id; trigger.CreatedDateTimeUtc = entity.CreatedDateTimeUtc; } }