Пример #1
0
        /// <summary>
        /// 判断本实例更变的值与被比实体对应值是否相等
        /// </summary>
        /// <param name="objEntity">被比较实体</param>
        /// <returns>是否相等</returns>
        public bool EqualsModify(EntityObjectBase objEntity)
        {
            if (objEntity.GetType() != this.GetType())
            {
                return(false);
            }

            TableAttributes taEntity = objEntity.GetEntityColumns();
            TableAttributes taThis   = this.GetEntityColumns();

            bool bEquals = true;

            for (int i = 0; i < taEntity.Columns.Count; i++)
            {
                ColumnAttributes caEntity = taEntity.Columns[i] as ColumnAttributes;
                ColumnAttributes caThis   = taThis.Columns[i] as ColumnAttributes;
                if (caThis.IsModify && (caEntity.Value.ToString() != caThis.Value.ToString()))
                {
                    bEquals = false;
                    break;
                }
            }

            return(bEquals);
        }
Пример #2
0
        /// <summary>
        /// 将指定实体修改过的值同步到本实例
        /// </summary>
        /// <param name="objEntity">同步实体</param>
        public void SynchronizeModifyValue(EntityObjectBase objEntity)
        {
            TableAttributes taEntity = objEntity.GetEntityColumns();

            foreach (ColumnAttributes caCurrent in taEntity.Columns)
            {
                if (true == caCurrent.IsModify)
                {
                    SetMappingValue(this, caCurrent.ColumnName, caCurrent.Value);
                }
            }
        }