public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } using (var context = CreateDbContext()) { var temp = new EmployeeClassification(); temp.EmployeeClassificationKey = updateMessage.EmployeeClassificationKey; temp.IsExempt = updateMessage.IsExempt; temp.IsEmployee = updateMessage.IsEmployee; context.Entry <EmployeeClassification>(temp).Property(x => x.IsExempt).IsModified = true; context.Entry <EmployeeClassification>(temp).Property(x => x.IsEmployee).IsModified = true; context.SaveChanges(); /* * //Get a fresh copy of the row from the database * var temp = context.EmployeeClassification.Find(updateMessage.EmployeeClassificationKey); * if (temp != null) * { * //Copy the changed fields * temp.IsExempt = updateMessage.IsExempt; * temp.IsEmployee = updateMessage.IsEmployee; * context.SaveChanges(); * } */ } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } m_DataSource.Update(TableName, updateMessage).Execute(); }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } using (var connection = CreateConnection(true)) { connection.Update(ClassMappedNameCache.Get <EmployeeClassification>(), updateMessage); } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } const string sql = @"UPDATE HR.EmployeeClassification SET IsExempt = @IsExempt, IsEmployee = @IsEmployee WHERE EmployeeClassificationKey = @EmployeeClassificationKey;"; DbConnector.NonQuery(sql, updateMessage).Execute(); }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } var sql = @"UPDATE HR.EmployeeClassification SET IsExempt = @IsExempt, IsEmployee = @IsEmployee WHERE EmployeeClassificationKey = @EmployeeClassificationKey;"; using (var con = OpenConnection()) con.Execute(sql, updateMessage); }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } using (var db = _dbConnectionFactory.OpenDbConnection()) { db.Update <EmployeeClassificationPartial>( new { updateMessage.IsEmployee, updateMessage.IsExempt }, r => r.Id == updateMessage.EmployeeClassificationKey); } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } using (var db = new OrmCookbook()) { db.EmployeeClassification .Where(ec => ec.EmployeeClassificationKey == updateMessage.EmployeeClassificationKey) .Set(ec => ec.IsExempt, updateMessage.IsExempt) .Set(ec => ec.IsEmployee, updateMessage.IsEmployee) .Update(); } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } using (var adapter = new DataAccessAdapter()) { // for kicks, update the entity directly in the DB, without fetching one first. var updater = new EmployeeClassificationEntity(); updater.IsEmployee = updateMessage.IsEmployee; updater.IsExempt = updateMessage.IsExempt; adapter.UpdateEntitiesDirectly(updater, new RelationPredicateBucket(EmployeeClassificationFields.EmployeeClassificationKey .Equal(updateMessage.EmployeeClassificationKey))); } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } //Get a fresh copy of the row from the database var temp = Session.DefaultSession.GetObjectByKey <EmployeeClassification>(updateMessage.EmployeeClassificationKey); if (temp != null) { //Copy the changed fields temp.IsExempt = updateMessage.IsExempt; temp.IsEmployee = updateMessage.IsEmployee; temp.Save(); } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } using (var session = m_SessionFactory.OpenSession()) { var temp = session.Get <EmployeeClassification>(updateMessage.EmployeeClassificationKey); if (temp != null) { temp.IsExempt = updateMessage.IsExempt; temp.IsEmployee = updateMessage.IsEmployee; session.Update(temp); session.Flush(); } } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } const string sql = @"UPDATE HR.EmployeeClassification SET IsExempt = @IsExempt, IsEmployee = @IsEmployee WHERE EmployeeClassificationKey = @EmployeeClassificationKey;"; using (var con = OpenConnection()) using (var cmd = new SqlCommand(sql, con)) { cmd.Parameters.AddWithValue("@EmployeeClassificationKey", updateMessage.EmployeeClassificationKey); cmd.Parameters.AddWithValue("@IsExempt", updateMessage.IsExempt); cmd.Parameters.AddWithValue("@IsEmployee", updateMessage.IsEmployee); cmd.ExecuteNonQuery(); } }
public void UpdateWithObject(EmployeeClassificationFlagsUpdater updateMessage) { if (updateMessage == null) { throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null."); } using (var context = CreateDbContext()) { //Get a fresh copy of the row from the database var temp = context.EmployeeClassification.Find(updateMessage.EmployeeClassificationKey); if (temp != null) { //Copy the changed fields temp.IsExempt = updateMessage.IsExempt; temp.IsEmployee = updateMessage.IsEmployee; context.SaveChanges(); } } }