mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-23 13:06:48 +08:00
check bugs
This commit is contained in:
parent
37a371a138
commit
ebf037f518
@ -436,7 +436,7 @@ namespace OpenAuth.App
|
||||
|
||||
public void Update(FlowInstance flowScheme)
|
||||
{
|
||||
Repository.Update(u => u.Id == flowScheme.Id, u => new FlowInstance());
|
||||
Repository.Update(flowScheme);
|
||||
}
|
||||
|
||||
public TableData Load(QueryFlowInstanceListReq request)
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,13 @@ namespace OpenAuth.Repository
|
||||
{
|
||||
Database.SetInitializer< OpenAuthDBContext>(null);
|
||||
}
|
||||
|
||||
public OpenAuthDBContext()
|
||||
: base("Name=OpenAuthDBContext")
|
||||
{ }
|
||||
{
|
||||
// 关闭语义可空判断
|
||||
Configuration.UseDatabaseNullSemantics = true;
|
||||
}
|
||||
|
||||
public OpenAuthDBContext(string nameOrConnectionString)
|
||||
: base(nameOrConnectionString)
|
||||
|
@ -49,5 +49,12 @@ namespace OpenAuth.UnitTest
|
||||
Console.WriteLine(JsonHelper.Instance.Serialize(result.Result.FrmPreviewHtml));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestUpdate()
|
||||
{ //测试数据没有任何修改时EF报错的问题
|
||||
var instance = _runApp.Get("d73e4412-9c49-4511-a30e-0d2f844afcee");
|
||||
_runApp.Update(instance);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user