예제 #1
0
파일: Dao.cs 프로젝트: ThreeHeadz/Bam.Net
 public void WriteUpdate(SqlStringBuilder sqlStringBuilder)
 {
     AssignValue[] valueAssignments = GetNewAssignValues();
     sqlStringBuilder
     .Update(this.TableName(), valueAssignments)
     .Where(this.GetUniqueFilter())
     .Go();
 }
예제 #2
0
파일: Dao.cs 프로젝트: ThreeHeadz/Bam.Net
        /// <summary>
        /// Undo any changes that have been made to the current instance
        /// since it was loaded.
        /// </summary>
        /// <param name="db"></param>
        public virtual void Undo(Database db = null)
        {
            Type thisType = this.GetType();

            if (db == null)
            {
                db = Database;
            }

            SqlStringBuilder sql = GetSqlStringBuilder(db);

            ColumnAttribute[] columns = Db.GetColumns(thisType);
            foreach (ColumnAttribute col in columns)
            {
                this.SetValue(col.Name, this.GetOriginalValue(col.Name));
            }
            AssignValue[] values = GetNewAssignValues();
            sql.Update(this.TableName(), values)
            .Where(this.GetUniqueFilter())
            .Go();

            sql.Execute(db);
        }