コード例 #1
0
 public ReversiblePropertyEdit(ReversiblePropertySetter <TOwner, TProperty> setter, TOwner instance,
                               TProperty oldValue, TProperty newValue)
 {
     this.setter   = setter;
     this.instance = instance;
     this.oldValue = oldValue;
     this.newValue = newValue;
 }
コード例 #2
0
        /// <summary>
        ///   Adds a reversible property change to the current transaction (if any).
        /// </summary>
        /// <typeparam name = "TOwner">Type that owns the property</typeparam>
        /// <typeparam name = "TProperty">Type of property</typeparam>
        /// <param name = "setter">A method that sets the property</param>
        /// <param name = "instance">The instance whose property is changed</param>
        /// <param name = "oldValue">The present value of the property</param>
        /// <param name = "newValue">The new value to be assigned to the property</param>
        public static void AddPropertyChange <TOwner, TProperty>(ReversiblePropertySetter <TOwner, TProperty> setter,
                                                                 TOwner instance, TProperty oldValue, TProperty newValue)
            where TOwner : class
        {
            Transaction txn = _current;

            if (txn != null)
            {
                txn.AddEdit(new ReversiblePropertyEdit <TOwner, TProperty>(setter, instance, oldValue, newValue));
            }
        }