public virtual void SingleUpdate(SqlCeTransaction tran, Expression <Func <TDb, object> > primaryKeyProperty, TDb value) { try { string tableName = Database.GetTableName(value); var primaryKey = primaryKeyProperty.GetNameProperty(); SqlCeConnection conn = Database.GetConnection(); conn.Update(tran, tableName, primaryKey, value); } catch (Exception e) { Database.ExceptionHandler(e); if (Database.m_throwExceptions) { throw; } } }
/// <summary> /// Updates the supplied object. Infers table name from type name. /// Uses CommitMode.Immediate to ensure data is written to disk immediately. /// </summary> public override void Update(string primaryKey, object obj) { try { string tableName = GetTableName(obj); SqlCeConnection conn = GetConnection(); using (SqlCeTransaction tran = conn.BeginTransaction()) { conn.Update(tran, tableName, primaryKey, obj); tran.Commit(CommitMode.Immediate); } } catch (Exception e) { ExceptionHandler(e); if (m_throwExceptions) { throw; } } }