## v0.3.21

- 增加 IUpdate IgnoreColumns 重载方法,支持传入字符串数组忽略修改;
- 完善 FreeSql.DbContext,支持对象操作 + SaveChanges 最后保存操作;
This commit is contained in:
28810
2019-03-21 05:24:50 +08:00
parent d9de8e986b
commit c20a0bbd54
24 changed files with 815 additions and 48 deletions

View File

@ -41,6 +41,12 @@ namespace orm_vs
//optionsBuilder.UseMySql("Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;Min Pool Size=21;Max Pool Size=21");
}
}
class FreeSongContext: FreeSql.DbContext {
public FreeSql.DbSet<Song> Songs { get; set; }
protected override void OnConfiguring(FreeSql.DbContextOptionsBuilder builder) {
builder.UseFreeSql(fsql);
}
}
static void Main(string[] args) {
@ -143,8 +149,14 @@ namespace orm_vs
Stopwatch sw = new Stopwatch();
sw.Restart();
for (var a = 0; a < forTime; a++)
fsql.Insert(songs).ExecuteAffrows();
for (var a = 0; a < forTime; a++) {
//fsql.Insert(songs).ExecuteAffrows();
using (var db = new FreeSongContext()) {
//db.Configuration.AutoDetectChangesEnabled = false;
db.Songs.AddRange(songs.ToArray());
db.SaveChanges();
}
}
sw.Stop();
sb.AppendLine($"FreeSql Insert {size}条数据,循环{forTime}次,耗时{sw.ElapsedMilliseconds}ms");

View File

@ -12,6 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\FreeSql.DbContext\FreeSql.DbContext.csproj" />
<ProjectReference Include="..\..\FreeSql\FreeSql.csproj" />
</ItemGroup>