Skip to content

Commit

Permalink
v3.2.806-preview20231214
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Dec 12, 2023
1 parent 1a0507d commit 09c8725
Show file tree
Hide file tree
Showing 35 changed files with 180 additions and 50 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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
</PropertyGroup>
-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,23 @@ public DbContextOptions DbContextOptions
}
}
public void AsType(Type entityType) => _repository.AsType(entityType);
Func<string, string> _asTableRule;
Func<Type, string, string> _asTableRule;
public void AsTable(Func<string, string> rule)
{
_repository.AsTable(rule);
_asTableRule = rule;
if (rule == null)
{
_asTableRule = null;
return;
}
_asTableRule = (t, old) => t == EntityType ? rule(old) : null;
}
public Type EntityType => _repository.EntityType;
public void AsTable(Func<Type, string, string> rule)
{
_repository.AsTable(rule);
_asTableRule = rule;
}
public Type EntityType => _repository.EntityType;
public IDataFilter<TEntity> DataFilter => _repository.DataFilter;

public void Attach(TEntity entity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,10 @@ async Task<int> DeleteWithinBoundaryAsync(IEnumerable<TEntity> entitys, List<obj
}
var affrows = 0;
for (var a = tracking.DeleteLog.Count - 1; a >= 0; a--)
{
affrows += await Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1).AsTable(_asTableRule)
.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrowsAsync(cancellationToken);
{
var delete = Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1);
if (_asTableRule != null) delete.AsTable(old => _asTableRule(tracking.DeleteLog[a].Item1, old));
affrows += await delete.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrowsAsync(cancellationToken);
if (deletedOutput != null) deletedOutput.AddRange(tracking.DeleteLog[a].Item2);
UnitOfWork?.EntityChangeReport?.Report.AddRange(tracking.DeleteLog[a].Item2.Select(x =>
new DbContext.EntityChangeReport.ChangeInfo
Expand Down Expand Up @@ -249,9 +250,10 @@ async Task<int> SaveTrackingChangeAsync(AggregateRootTrackingChangeInfo tracking
}

for (var a = tracking.DeleteLog.Count - 1; a >= 0; a--)
{
affrows += await Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1).AsTable(_asTableRule)
.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrowsAsync(cancellationToken);
{
var delete = Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1);
if (_asTableRule != null) delete.AsTable(old => _asTableRule(tracking.DeleteLog[a].Item1, old));
affrows += await delete.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrowsAsync(cancellationToken);
UnitOfWork?.EntityChangeReport?.Report.AddRange(tracking.DeleteLog[a].Item2.Select(x =>
new DbContext.EntityChangeReport.ChangeInfo
{
Expand All @@ -274,8 +276,10 @@ async Task<int> SaveTrackingChangeAsync(AggregateRootTrackingChangeInfo tracking
{
foreach (var dl2 in dl.Value)
{
affrows += await Orm.Update<object>().AsType(dl.Key).AsTable(_asTableRule)
.SetSource(dl2.Value.Select(a => a.AfterObject).ToArray())
var update = Orm.Update<object>().AsType(dl.Key);
if (_asTableRule != null) update.AsTable(old => _asTableRule(dl.Key, old));
affrows += await update
.SetSource(dl2.Value.Select(a => a.AfterObject).ToArray())
.UpdateColumns(dl2.Value.First().UpdateColumns.ToArray())
.ExecuteAffrowsAsync(cancellationToken);
UnitOfWork?.EntityChangeReport?.Report.AddRange(dl2.Value.Select(x =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,10 @@ int DeleteWithinBoundary(IEnumerable<TEntity> entitys, List<object> deletedOutpu
}
var affrows = 0;
for (var a = tracking.DeleteLog.Count - 1; a >= 0; a--)
{
affrows += Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1).AsTable(_asTableRule)
.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrows();
{
var delete = Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1);
if (_asTableRule != null) delete.AsTable(old => _asTableRule(tracking.DeleteLog[a].Item1, old));
affrows += delete.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrows();
if (deletedOutput != null) deletedOutput.AddRange(tracking.DeleteLog[a].Item2);
UnitOfWork?.EntityChangeReport?.Report.AddRange(tracking.DeleteLog[a].Item2.Select(x =>
new DbContext.EntityChangeReport.ChangeInfo
Expand Down Expand Up @@ -300,9 +301,10 @@ int SaveTrackingChange(AggregateRootTrackingChangeInfo tracking)
}

for (var a = tracking.DeleteLog.Count - 1; a >= 0; a--)
{
affrows += Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1).AsTable(_asTableRule)
.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrows();
{
var delete = Orm.Delete<object>().AsType(tracking.DeleteLog[a].Item1);
if (_asTableRule != null) delete.AsTable(old => _asTableRule(tracking.DeleteLog[a].Item1, old));
affrows += delete.WhereDynamic(tracking.DeleteLog[a].Item2).ExecuteAffrows();
UnitOfWork?.EntityChangeReport?.Report.AddRange(tracking.DeleteLog[a].Item2.Select(x =>
new DbContext.EntityChangeReport.ChangeInfo
{
Expand All @@ -325,8 +327,10 @@ int SaveTrackingChange(AggregateRootTrackingChangeInfo tracking)
{
foreach (var dl2 in dl.Value)
{
affrows += Orm.Update<object>().AsType(dl.Key).AsTable(_asTableRule)
.SetSource(dl2.Value.Select(a => a.AfterObject).ToArray())
var update = Orm.Update<object>().AsType(dl.Key);
if (_asTableRule != null) update.AsTable(old => _asTableRule(dl.Key, old));
affrows += update
.SetSource(dl2.Value.Select(a => a.AfterObject).ToArray())
.UpdateColumns(dl2.Value.First().UpdateColumns.ToArray())
.ExecuteAffrows();
UnitOfWork?.EntityChangeReport?.Report.AddRange(dl2.Value.Select(x =>
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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
112 changes: 112 additions & 0 deletions FreeSql/FreeSql.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</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.806-preview20231213</Version>
<Version>3.2.806-preview20231214</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Loading

0 comments on commit 09c8725

Please sign in to comment.