Exemplo n.º 1
0
        /// <summary>
        ///     添加变更
        /// </summary>
        /// <param name="expression">属性表达式,范例:t => t.Name</param>
        /// <param name="newValue">新值,范例:newEntity.Name</param>
        protected void AddChange <TProperty, TValue>(Expression <Func <T, TProperty> > expression, TValue newValue)
        {
            var member      = Lambda.GetMemberExpression(expression);
            var name        = Lambda.GetMemberName(member);
            var description = Reflection.GetDisplayNameOrDescription(member.Member);
            var value       = member.Member.GetPropertyValue(this);

            AddChange(name, description, Convert.To <TValue>(value), newValue);
        }
Exemplo n.º 2
0
 /// <summary>
 ///     克隆副本
 /// </summary>
 public virtual TValueObject Clone()
 {
     return(Convert.To <TValueObject>(MemberwiseClone()));
 }