Exemple #1
0
        public override object this[KSchemaField field]
        {
            get
            {
                var updated = updatedValues[field.Index];
                return(updated.IsUpdated ? updated.UpdatedValue : values[field.Index]);
            }
            set
            {
                if (IsDeleted)
                {
                    throw new InvalidOperationException("Object deleted");
                }
                if (value == this[field])
                {
                    return;
                }
                if (value == null && !field.IsNullable)
                {
                    throw new ArgumentNullException(field.Name, "Field is not nullable");
                }
                if (field.IsReadonly && !MarkedForInsert)
                {
                    throw new ArgumentException(field.Name, "Field is readonly");
                }

                if (updatedValues[field.Index].IsUpdated)
                {
                    if (values[field.Index] == value)
                    {
                        updatedCount--;
                        updatedValues[field.Index].IsUpdated    = false;
                        updatedValues[field.Index].UpdatedValue = null;
                        return;
                    }
                }
                else
                {
                    updatedCount++;
                    updatedValues[field.Index].IsUpdated = true;
                }

                updatedValues[field.Index].UpdatedValue = value;
                MarkedForDelete = false;
            }
        }
Exemple #2
0
 public bool HasChanged(KSchemaField field)
 {
     return(updatedValues[field.Index].IsUpdated);
 }
Exemple #3
0
 public virtual object this[KSchemaField field]
 {
     get => values[field.Index];