mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 IUpdate.WhereCaseSource 方法,实现批量修改时的条件判断;
- 增加 FreeSql.DbContext 行级锁;
This commit is contained in:
@ -50,7 +50,7 @@ namespace dbcontext_01.Controllers
|
||||
ctx.Songs.AddRange(adds);
|
||||
//立即执行,将自增值赋给 adds 所有元素,因为有自增类型,如果其他类型,指定传入主键值,不会立即执行
|
||||
|
||||
for (var a = 0; a < adds.Count; a++)
|
||||
for (var a = 0; a < 10; a++)
|
||||
adds[a].Title = "dkdkdkdk" + a;
|
||||
|
||||
ctx.Songs.UpdateRange(adds);
|
||||
@ -63,6 +63,7 @@ namespace dbcontext_01.Controllers
|
||||
|
||||
adds.Last().Url = "skldfjlksdjglkjjcccc";
|
||||
ctx.Songs.Update(adds.Last());
|
||||
|
||||
//单条修改 urls 的值,进入队列
|
||||
|
||||
//throw new Exception("回滚");
|
||||
|
@ -25,6 +25,9 @@ namespace dbcontext_01 {
|
||||
public string Url { get; set; }
|
||||
|
||||
public virtual ICollection<Tag> Tags { get; set; }
|
||||
|
||||
[Version]
|
||||
public long versionRow { get; set; }
|
||||
}
|
||||
public class Song_tag {
|
||||
public int Song_id { get; set; }
|
||||
|
@ -25,6 +25,7 @@ namespace dbcontext_01
|
||||
.UseLogger(loggerFactory.CreateLogger<IFreeSql>())
|
||||
.UseAutoSyncStructure(true)
|
||||
.UseLazyLoading(true)
|
||||
.UseNoneCommandParameter(true)
|
||||
|
||||
.UseMonitorCommand(cmd => Trace.WriteLine(cmd.CommandText),
|
||||
(cmd, log) => Trace.WriteLine(log)
|
||||
|
Reference in New Issue
Block a user