如何确定更新 linq-to-sql 中的实体对象时更新了哪些属性,例如:
public class User
{
public int Id { get; set; }
public string Name {get; set; }
public string LastName { get; set; }
}
public void UpdateUser(User user)
{
using (var entity = new CoolEntity())
{
user.Name = user.Name + "%";
entity.SubmitChanges();
//Now here, I would love to know that "Id" and "LastName" is not changed
//but the "Name" property of the object is updated.
}
}
我知道这听起来有点难,也许我的方法是不可能的;但这是针对日志结构的;因为我需要记录更新对象属性的更新详细信息。
我很想知道是否有任何属性标志可以让我识别更改。