using System.ComponentModel;
using System.Reflection;
namespace Masuit.Tools.Core;
///
/// 变更字段信息
///
public class ChangePropertyInfo
{
///
/// 属性
///
public PropertyInfo PropertyInfo { get; set; }
///
/// 原始值
///
public object OriginalValue { get; set; }
///
/// 新值
///
public object CurrentValue { get; set; }
///
/// 是否是主键
///
public bool IsPrimaryKey { get; set; }
///
/// 是否是外键
///
public bool IsForeignKey { get; set; }
///
/// 变更描述格式化字符串
///
public string ChangeDescription => $"{PropertyInfo.GetCustomAttribute()?.Description ?? PropertyInfo.Name}:{OriginalValue} => {CurrentValue}";
/// Returns a string that represents the current object.
/// A string that represents the current object.
public override string ToString()
{
return $"{ChangeDescription},字段:{PropertyInfo.Name},主键:{IsPrimaryKey},外键:{IsForeignKey}";
}
}