Пример #1
0
 protected override void SetValue(string key, object value)
 {
     var item = Collection[key];
     if (item == null)
     {
         if (!IsNullValue(key, value))
         {
             Collection[key] = new EntityItem() { Key = key, Value = value };
         }
     }
     else
     {
         if (IsNullValue(key, value))
         {
             if (ID > 0)
             {
                 //清空数据库字段中的值
                 (item as EntityItem).Value = DBNull.Value;
             }
             else
             {
                 Collection.Remove(key);
             }
         }
         else
         {
             (item as EntityItem).Value = value;
         }
     }
 }
Пример #2
0
 internal virtual void SetDbValue(string key, object value)
 {
     if (value != DBNull.Value)
     {
         Collection[key] = new EntityItem() { Key = key, Value = value };
     }
 }