Skip to content

Commit

Permalink
v3.2.701-preview20230823
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Aug 22, 2023
1 parent 6a79b63 commit 84dd1b9
Show file tree
Hide file tree
Showing 32 changed files with 84 additions and 118 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!--
经常出于版本交叉问题,暂时关闭,在每个项目上设置版本号
<PropertyGroup>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>
-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<LangVersion>latest</LangVersion>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Title>$(AssemblyName)</Title>
<IsPackable>true</IsPackable>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Extensions/FreeSql.Generator/FreeSql.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/2881099/FreeSql</PackageProjectUrl>
<RepositoryUrl>https://github.com/2881099/FreeSql</RepositoryUrl>
<PackageTags>FreeSql DbFirst 实体生成器</PackageTags>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion FreeSql.All/FreeSql.All.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion FreeSql.DbContext/FreeSql.DbContext.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion FreeSql.Repository/FreeSql.Repository.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion FreeSql/FreeSql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
140 changes: 53 additions & 87 deletions FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,20 +360,14 @@ public int ExecuteAffrows()
if (_sourceSql != null) return this.RawExecuteAffrows();
var affrows = 0;
var ss = SplitSourceByIdentityValueIsNull(_source);
try
{
if (_transaction == null)
{
var threadTransaction = _orm.Ado.TransactionCurrentThread;
if (threadTransaction != null) this.WithTransaction(threadTransaction);
}

if (_transaction != null || _orm.Ado.MasterPool == null || _batchAutoTransaction == false)
void ExecuteBatchOptions(List<T1>[] splitedSource)
{
foreach (var tmpsource in splitedSource)
{
_SplitSourceByIdentityValueIsNullFlag = 1;
foreach (var tmpsource in ss.Item1)
if (_batchValuesLimit > 0)
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
var pageTotal = (int)Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
Expand All @@ -382,19 +376,28 @@ public int ExecuteAffrows()
affrows += this.RawExecuteAffrows();
}
}
_SplitSourceByIdentityValueIsNullFlag = 2;
foreach (var tmpsource in ss.Item2)
else
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
tmpsource.Skip((pageNumber - 1) * _batchValuesLimit).Take(_batchValuesLimit).ToList() :
tmpsource.Take(_batchValuesLimit).ToList();
affrows += this.RawExecuteAffrows();
}
_source = tmpsource;
affrows += this.RawExecuteAffrows();
}
}
}
try
{
if (_transaction == null)
{
var threadTransaction = _orm.Ado.TransactionCurrentThread;
if (threadTransaction != null) this.WithTransaction(threadTransaction);
}

if (_transaction != null || _orm.Ado.MasterPool == null || _batchAutoTransaction == false)
{
_SplitSourceByIdentityValueIsNullFlag = 1;
ExecuteBatchOptions(ss.Item1);
_SplitSourceByIdentityValueIsNullFlag = 2;
ExecuteBatchOptions(ss.Item2);
}
else
{
using (var conn = _orm.Ado.MasterPool.Get())
Expand All @@ -405,29 +408,9 @@ public int ExecuteAffrows()
try
{
_SplitSourceByIdentityValueIsNullFlag = 1;
foreach (var tmpsource in ss.Item1)
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
tmpsource.Skip((pageNumber - 1) * _batchValuesLimit).Take(_batchValuesLimit).ToList() :
tmpsource.Take(_batchValuesLimit).ToList();
affrows += this.RawExecuteAffrows();
}
}
ExecuteBatchOptions(ss.Item1);
_SplitSourceByIdentityValueIsNullFlag = 2;
foreach (var tmpsource in ss.Item2)
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
tmpsource.Skip((pageNumber - 1) * _batchValuesLimit).Take(_batchValuesLimit).ToList() :
tmpsource.Take(_batchValuesLimit).ToList();
affrows += this.RawExecuteAffrows();
}
}
ExecuteBatchOptions(ss.Item2);
_transaction.Commit();
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null));
}
Expand Down Expand Up @@ -503,41 +486,44 @@ async public Task<int> ExecuteAffrowsAsync(CancellationToken cancellationToken =
if (_sourceSql != null) return await this.RawExecuteAffrowsAsync(cancellationToken);
var affrows = 0;
var ss = SplitSourceByIdentityValueIsNull(_source);
try
{
if (_transaction == null)
{
var threadTransaction = _orm.Ado.TransactionCurrentThread;
if (threadTransaction != null) this.WithTransaction(threadTransaction);
}

if (_transaction != null || _orm.Ado.MasterPool == null || _batchAutoTransaction == false)
async Task ExecuteBatchOptions(List<T1>[] splitedSource)
{
foreach (var tmpsource in splitedSource)
{
_SplitSourceByIdentityValueIsNullFlag = 1;
foreach (var tmpsource in ss.Item1)
if (_batchValuesLimit > 0)
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
var pageTotal = (int)Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
_source = pageNumber > 1 ?
tmpsource.Skip((pageNumber - 1) * _batchValuesLimit).Take(_batchValuesLimit).ToList() :
tmpsource.Take(_batchValuesLimit).ToList();
affrows += await this.RawExecuteAffrowsAsync(cancellationToken);
}
}
_SplitSourceByIdentityValueIsNullFlag = 2;
foreach (var tmpsource in ss.Item2)
else
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
tmpsource.Skip((pageNumber - 1) * _batchValuesLimit).Take(_batchValuesLimit).ToList() :
tmpsource.Take(_batchValuesLimit).ToList();
affrows += await this.RawExecuteAffrowsAsync(cancellationToken);
}
_source = tmpsource;
affrows += await this.RawExecuteAffrowsAsync(cancellationToken);
}
}
}
try
{
if (_transaction == null)
{
var threadTransaction = _orm.Ado.TransactionCurrentThread;
if (threadTransaction != null) this.WithTransaction(threadTransaction);
}

if (_transaction != null || _orm.Ado.MasterPool == null || _batchAutoTransaction == false)
{
_SplitSourceByIdentityValueIsNullFlag = 1;
await ExecuteBatchOptions(ss.Item1);
_SplitSourceByIdentityValueIsNullFlag = 2;
await ExecuteBatchOptions(ss.Item2);
}
else
{
using (var conn = await _orm.Ado.MasterPool.GetAsync())
Expand All @@ -548,29 +534,9 @@ async public Task<int> ExecuteAffrowsAsync(CancellationToken cancellationToken =
try
{
_SplitSourceByIdentityValueIsNullFlag = 1;
foreach (var tmpsource in ss.Item1)
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
tmpsource.Skip((pageNumber - 1) * _batchValuesLimit).Take(_batchValuesLimit).ToList() :
tmpsource.Take(_batchValuesLimit).ToList();
affrows += await this.RawExecuteAffrowsAsync(cancellationToken);
}
}
await ExecuteBatchOptions(ss.Item1);
_SplitSourceByIdentityValueIsNullFlag = 2;
foreach (var tmpsource in ss.Item2)
{
var pageTotal = Math.Ceiling(tmpsource.Count * 1.0 / _batchValuesLimit);
for (var pageNumber = 1; pageNumber <= pageTotal; pageNumber++)
{
_source = pageNumber > 1 ?
tmpsource.Skip((pageNumber - 1) * _batchValuesLimit).Take(_batchValuesLimit).ToList() :
tmpsource.Take(_batchValuesLimit).ToList();
affrows += await this.RawExecuteAffrowsAsync(cancellationToken);
}
}
await ExecuteBatchOptions(ss.Item2);
_transaction.Commit();
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<SignAssembly>False</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Title>$(AssemblyName)</Title>
<IsPackable>true</IsPackable>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Title>$(AssemblyName)</Title>
<IsPackable>true</IsPackable>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.2.701-preview20230822</Version>
<Version>3.2.701-preview20230823</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 84dd1b9

Please sign in to comment.