check bugs

This commit is contained in:
yubaolee@163.com
2018-05-07 14:47:16 +08:00
parent 37a371a138
commit ebf037f518
5 changed files with 170 additions and 154 deletions

View File

@@ -30,7 +30,7 @@ namespace OpenAuth.Repository
}
/// <summary>
/// 查找单个
/// 查找单个,且不被上下文所跟踪
/// </summary>
public T FindSingle(Expression<Func<T, bool>> exp)
{
@@ -87,9 +87,14 @@ namespace OpenAuth.Repository
public void Update(T entity)
{
var entry = this.Context.Entry(entity);
//todo:如果状态没有任何更改,会报错
entry.State = EntityState.Modified;
//如果数据没有发生变化
if (!this.Context.ChangeTracker.HasChanges())
{
return;
}
Save();
}