mirror of
https://github.com/nsnail/FreeSql.git
synced 2026-03-18 00:31:35 +08:00
- 修复 DbContext/Repository Update 不更新 DbUpdateValue 的问题;#219
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Extensions\FreeSql.Extensions.LazyLoading\FreeSql.Extensions.LazyLoading.csproj" />
|
||||
<ProjectReference Include="..\..\FreeSql.DbContext\FreeSql.DbContext.csproj" />
|
||||
<ProjectReference Include="..\..\FreeSql\FreeSql.csproj" />
|
||||
<ProjectReference Include="..\..\Providers\FreeSql.Provider.MySqlConnector\FreeSql.Provider.MySqlConnector.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -57,6 +57,30 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
Assert.Equal(item.标题, item2.标题);
|
||||
|
||||
g.mysql.Update<测试中文表2>().SetSource(item2).ExecuteAffrows();
|
||||
|
||||
|
||||
|
||||
item.标题 = "测试标题更新";
|
||||
Assert.Equal(1, g.mysql.Update<测试中文表2>().SetSource(item).ExecuteAffrows());
|
||||
item2 = g.mysql.Select<测试中文表2>().Where(a => a.编号 == item.编号).First();
|
||||
Assert.NotNull(item2);
|
||||
Assert.Equal(item.编号, item2.编号);
|
||||
Assert.Equal(item.标题, item2.标题);
|
||||
|
||||
item.标题 = "测试标题更新_repo";
|
||||
var repo = g.mysql.GetRepository<测试中文表2>();
|
||||
Assert.Equal(1, repo.Update(item));
|
||||
item2 = g.mysql.Select<测试中文表2>().Where(a => a.编号 == item.编号).First();
|
||||
Assert.NotNull(item2);
|
||||
Assert.Equal(item.编号, item2.编号);
|
||||
Assert.Equal(item.标题, item2.标题);
|
||||
|
||||
item.标题 = "测试标题更新_repo22";
|
||||
Assert.Equal(1, repo.Update(item));
|
||||
item2 = g.mysql.Select<测试中文表2>().Where(a => a.编号 == item.编号).First();
|
||||
Assert.NotNull(item2);
|
||||
Assert.Equal(item.编号, item2.编号);
|
||||
Assert.Equal(item.标题, item2.标题);
|
||||
}
|
||||
class 测试中文表2
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user