private void Build() { IfUnBuilt(this.Name, () => { var sql = CreateTable.Create(this).Build(null); SqlHelper.Execute(this.ConnectionName, sql); }); AddRuntimeIndex(this); }
/// <summary> /// 创建运行时记录的表信息 /// </summary> internal static void RuntimeBuild() { _built.Clear(); foreach (var index in _runtimeIndexs) { IfUnBuilt(index.Name, () => { var sql = CreateTable.Create(index).Build(null); SqlHelper.Execute(index.ConnectionName, sql); }); } }
private void Build() { IfUnBuilt(this.Name, () => { //开启独立事务,这样创建表的操作就和后续的增删改查没有冲突了,不会造成死锁 DataContext.UseTransactionScope(() => { var sql = CreateTable.Create(this).Build(null, this); SqlHelper.Execute(this.ConnectionName, sql); }); }); AddRuntimeIndex(this); }
/// <summary> /// 创建运行时记录的表信息 /// </summary> internal static void RuntimeBuild() { _built.Clear(); //开启独立事务,这样创建表的操作就和后续的增删改查没有冲突了,不会造成死锁 DataContext.UseTransactionScope(() => { foreach (var index in _runtimeIndexs) { IfUnBuilt(index.Name, () => { var sql = CreateTable.Create(index).Build(null, index); SqlHelper.Execute(index.ConnectionName, sql); }); } }); }