Ejemplo n.º 1
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual void SetOriginalValue([NotNull] IPropertyBase propertyBase, [CanBeNull] object value, int index = -1)
        {
            EnsureOriginalValues();

            var property = (IProperty)propertyBase;

            _originalValues.SetValue(property, value, index);

            // If setting the original value results in the current value being different from the
            // original value, then mark the property as modified.
            if (!IsModified(property))
            {
                var currentValue  = this[propertyBase];
                var propertyIndex = property.GetIndex();
                if (!Equals(currentValue, value) &&
                    !_stateData.IsPropertyFlagged(propertyIndex, PropertyFlag.Unknown))
                {
                    SetPropertyModified(property);
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void SetOriginalValue([NotNull] IPropertyBase propertyBase, [CanBeNull] object value)
 {
     EnsureOriginalValues();
     _originalValues.SetValue((IProperty)propertyBase, value);
 }