diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1693728ca..424bf8708 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,14 +15,6 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- - name: Setup dotnet6.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 6.0.x
- - name: Setup dotnet7.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 7.0.x
- name: Setup dotnet8.0
uses: actions/setup-dotnet@v1
with:
@@ -30,7 +22,11 @@ jobs:
- name: Setup dotnet9.0
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 9.0.x
+ dotnet-version: 9.0.x
+ - name: Setup dotnet10.0
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 10.0.x
- name: Linux Build
run: |
dotnet build ./src/OSharp.Utils/OSharp.Utils.csproj
@@ -60,14 +56,6 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- - name: Setup dotnet6.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 6.0.x
- - name: Setup dotnet7.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 7.0.x
- name: Setup dotnet8.0
uses: actions/setup-dotnet@v1
with:
@@ -75,7 +63,11 @@ jobs:
- name: Setup dotnet9.0
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 9.0.x
+ dotnet-version: 9.0.x
+ - name: Setup dotnet10.0
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 10.0.x
- name: Windows Build
run: |
dotnet build ./src/OSharp.Wpf/OSharp.Wpf.csproj
diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml
index b0369f63b..6100ea086 100644
--- a/.github/workflows/nuget.yml
+++ b/.github/workflows/nuget.yml
@@ -15,14 +15,6 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- - name: Setup dotnet6.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 6.0.x
- - name: Setup dotnet7.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 7.0.x
- name: Setup dotnet8.0
uses: actions/setup-dotnet@v1
with:
@@ -31,6 +23,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.x
+ - name: Setup dotnet10.0
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 10.0.x
- name: Restore
run: dotnet restore
- name: Build and Pack
diff --git a/build/OSharpNS.nuspec b/build/OSharpNS.nuspec
index 81502397d..f16c23fea 100644
--- a/build/OSharpNS.nuspec
+++ b/build/OSharpNS.nuspec
@@ -1,37 +1,29 @@
-
+
+
-
- OSharpNS
- 9.0.0-preview.304
- OSharpFramework(.NET6.0/.NETCoreApp3.1)
- 柳柳软件(66soft.net)
- LiuliuSoft nnc
- false
- Apache-2.0
- icon.png
- https://github.com/dotnetcore/osharp
- OSharp Framework with .NET,此Package包含了OSharp的所有常用组件
- https://github.com/dotnetcore/osharp/releases
- Copyright (c) 2014-2022 LIULIUSOFT. All rights reserved.
- osharp
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+ OSharpNS
+ 10.0.0
+ OSharpFramework
+ 柳柳软件(66soft.net)
+ LiuliuSoft nnc
+ false
+ Apache-2.0
+ icon.png
+ https://github.com/dotnetcore/osharp
+ OSharp Framework with .NET,此Package包含了OSharp的所有常用组件
+ https://github.com/dotnetcore/osharp/releases
+ Copyright (c) 2014-2026 LIULIUSOFT. All rights reserved.
+ osharp
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/nuget-push.ps1 b/build/nuget-push.ps1
index 4f5cf293b..e99682e56 100644
--- a/build/nuget-push.ps1
+++ b/build/nuget-push.ps1
@@ -19,7 +19,7 @@ function GetVersion()
$server = "https://www.nuget.org"
$readkey = Read-Host "默认服务器为nuget.org,确认按回车键`n如要切换为nuget.66soft.net,按 1`n如要切换为ncc.myget.org,按 2`n如要切换为osharp.myget.org,按3"
if ($readkey -eq 1) {
- $server = "http://nuget.66soft.net/nuget"
+ $server = "https://nuget.66soft.net/nuget"
}
elseif ($readkey -eq 2) {
$server = "https://www.myget.org/F/ncc/api/v2/package"
diff --git a/build/version.props b/build/version.props
index 32bc59fc5..168b61acb 100644
--- a/build/version.props
+++ b/build/version.props
@@ -1,12 +1,12 @@
- 9.0
+ 10.0
0
-preview.
- 907
- $(VersionMain).$(VersionPrefix)$(VersionSuffix)$(VersionSuffixVersion)
- $(VersionMain).$(VersionPrefix).$(VersionSuffixVersion)
-
+ 117
+
+ $(VersionMain).$(VersionPrefix)
+ $(VersionMain).$(VersionPrefix)
diff --git a/global.json b/global.json
index 00b67caef..fe7e453b1 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "9.0.100",
+ "version": "10.0.100",
"rollForward": "latestFeature",
"allowPrerelease": false
}
diff --git a/samples/web/Liuliu.Demo.Core/Liuliu.Demo.Core.csproj b/samples/web/Liuliu.Demo.Core/Liuliu.Demo.Core.csproj
index 9953da691..3b8f74969 100644
--- a/samples/web/Liuliu.Demo.Core/Liuliu.Demo.Core.csproj
+++ b/samples/web/Liuliu.Demo.Core/Liuliu.Demo.Core.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
Liuliu.Demo
false
diff --git a/samples/web/Liuliu.Demo.EntityConfiguration/Liuliu.Demo.EntityConfiguration.csproj b/samples/web/Liuliu.Demo.EntityConfiguration/Liuliu.Demo.EntityConfiguration.csproj
index df9841777..945684ff5 100644
--- a/samples/web/Liuliu.Demo.EntityConfiguration/Liuliu.Demo.EntityConfiguration.csproj
+++ b/samples/web/Liuliu.Demo.EntityConfiguration/Liuliu.Demo.EntityConfiguration.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
false
diff --git a/samples/web/Liuliu.Demo.Web/Liuliu.Demo.Web.csproj b/samples/web/Liuliu.Demo.Web/Liuliu.Demo.Web.csproj
index a3aa93031..e6178f9be 100644
--- a/samples/web/Liuliu.Demo.Web/Liuliu.Demo.Web.csproj
+++ b/samples/web/Liuliu.Demo.Web/Liuliu.Demo.Web.csproj
@@ -16,22 +16,6 @@
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
@@ -48,6 +32,14 @@
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
diff --git a/src/OSharp.AspNetCore/OSharp.AspNetCore.csproj b/src/OSharp.AspNetCore/OSharp.AspNetCore.csproj
index b7c412276..c3f41ee18 100644
--- a/src/OSharp.AspNetCore/OSharp.AspNetCore.csproj
+++ b/src/OSharp.AspNetCore/OSharp.AspNetCore.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0
OSharp.AspNetCore
OSharp AspNetCore组件
OSharp AspNetCore组件,提供AspNetCore的服务端功能的封装
@@ -15,16 +15,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -35,6 +25,11 @@
+
+
+
+
+
diff --git a/src/OSharp.Authorization.Datas/OSharp.Authorization.Datas.csproj b/src/OSharp.Authorization.Datas/OSharp.Authorization.Datas.csproj
index 64f155d20..81d1a0f61 100644
--- a/src/OSharp.Authorization.Datas/OSharp.Authorization.Datas.csproj
+++ b/src/OSharp.Authorization.Datas/OSharp.Authorization.Datas.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Authorization.Datas
OSharp 数据权限组件
OSharp 数据权限组件,对应用中数据权限进行授权的设计实现
diff --git a/src/OSharp.Authorization.Functions/OSharp.Authorization.Functions.csproj b/src/OSharp.Authorization.Functions/OSharp.Authorization.Functions.csproj
index 7d4a547bf..7e17aaa26 100644
--- a/src/OSharp.Authorization.Functions/OSharp.Authorization.Functions.csproj
+++ b/src/OSharp.Authorization.Functions/OSharp.Authorization.Functions.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Authorization.Functions
OSharp 功能权限组件
OSharp 功能权限组件,API功能权限授权的设计实现
diff --git a/src/OSharp.AutoMapper/OSharp.AutoMapper.csproj b/src/OSharp.AutoMapper/OSharp.AutoMapper.csproj
index cae6b75e7..439d7ded8 100644
--- a/src/OSharp.AutoMapper/OSharp.AutoMapper.csproj
+++ b/src/OSharp.AutoMapper/OSharp.AutoMapper.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.AutoMapper
OSharp AutoMapper 对象映射组件
OSharp AutoMapper 对象映射组件,封装基于AutoMapper的对象映射实现
diff --git a/src/OSharp.EntityFrameworkCore.MySql/OSharp.EntityFrameworkCore.MySql.csproj b/src/OSharp.EntityFrameworkCore.MySql/OSharp.EntityFrameworkCore.MySql.csproj
index e01ac7a6c..5bf7fa2a9 100644
--- a/src/OSharp.EntityFrameworkCore.MySql/OSharp.EntityFrameworkCore.MySql.csproj
+++ b/src/OSharp.EntityFrameworkCore.MySql/OSharp.EntityFrameworkCore.MySql.csproj
@@ -4,28 +4,21 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0
OSharp.EntityFrameworkCore.MySql
OSharp 数据访问组件,封装EntityFrameworkCore的MySql数据访问功能的实现
OSharp 数据访问组件MySql
OSharp.Entity.MySql
-
-
-
-
-
-
-
+
-
diff --git a/src/OSharp.EntityFrameworkCore.Oracle/OSharp.EntityFrameworkCore.Oracle.csproj b/src/OSharp.EntityFrameworkCore.Oracle/OSharp.EntityFrameworkCore.Oracle.csproj
index 60c165185..2b80f7f4f 100644
--- a/src/OSharp.EntityFrameworkCore.Oracle/OSharp.EntityFrameworkCore.Oracle.csproj
+++ b/src/OSharp.EntityFrameworkCore.Oracle/OSharp.EntityFrameworkCore.Oracle.csproj
@@ -4,19 +4,13 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.EntityFrameworkCore.Oracle
OSharp 数据访问组件,封装EntityFrameworkCore的Oracle数据访问功能的实现
OSharp 数据访问组件Oracle
OSharp.Entity.Oracle
-
-
-
-
-
-
@@ -25,6 +19,11 @@
+
+
+
+
+
diff --git a/src/OSharp.EntityFrameworkCore.PostgreSql/OSharp.EntityFrameworkCore.PostgreSql.csproj b/src/OSharp.EntityFrameworkCore.PostgreSql/OSharp.EntityFrameworkCore.PostgreSql.csproj
index 6b8d9775e..6e20e4f4b 100644
--- a/src/OSharp.EntityFrameworkCore.PostgreSql/OSharp.EntityFrameworkCore.PostgreSql.csproj
+++ b/src/OSharp.EntityFrameworkCore.PostgreSql/OSharp.EntityFrameworkCore.PostgreSql.csproj
@@ -4,25 +4,22 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.EntityFrameworkCore.PostgreSql
OSharp 数据访问组件,封装EntityFrameworkCore的PostgreSql数据访问功能的实现
OSharp 数据访问组件PostgreSql
OSharp.Entity.PostgreSql
-
-
-
-
-
-
+
+
+
diff --git a/src/OSharp.EntityFrameworkCore.SqlServer/OSharp.EntityFrameworkCore.SqlServer.csproj b/src/OSharp.EntityFrameworkCore.SqlServer/OSharp.EntityFrameworkCore.SqlServer.csproj
index e8ef9975a..a446e62eb 100644
--- a/src/OSharp.EntityFrameworkCore.SqlServer/OSharp.EntityFrameworkCore.SqlServer.csproj
+++ b/src/OSharp.EntityFrameworkCore.SqlServer/OSharp.EntityFrameworkCore.SqlServer.csproj
@@ -4,25 +4,22 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.EntityFrameworkCore.SqlServer
OSharp 数据访问组件,封装EntityFrameworkCore的SqlServer数据访问功能的实现
OSharp 数据访问组件SqlServer
OSharp.Entity.SqlServer
-
-
-
-
-
-
+
+
+
diff --git a/src/OSharp.EntityFrameworkCore.Sqlite/OSharp.EntityFrameworkCore.Sqlite.csproj b/src/OSharp.EntityFrameworkCore.Sqlite/OSharp.EntityFrameworkCore.Sqlite.csproj
index 74fe87d71..dfcb0f87d 100644
--- a/src/OSharp.EntityFrameworkCore.Sqlite/OSharp.EntityFrameworkCore.Sqlite.csproj
+++ b/src/OSharp.EntityFrameworkCore.Sqlite/OSharp.EntityFrameworkCore.Sqlite.csproj
@@ -4,25 +4,23 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.EntityFrameworkCore.Sqlite
OSharp 数据访问组件,封装EntityFrameworkCore的Sqlite数据访问功能的实现
OSharp 数据访问组件Sqlite
OSharp.Entity.Sqlite
-
-
-
-
-
-
+
+
+
+
diff --git a/src/OSharp.EntityFrameworkCore/EntityManager.cs b/src/OSharp.EntityFrameworkCore/EntityManager.cs
index 23c1d1010..b4bef0222 100644
--- a/src/OSharp.EntityFrameworkCore/EntityManager.cs
+++ b/src/OSharp.EntityFrameworkCore/EntityManager.cs
@@ -14,11 +14,12 @@ namespace OSharp.Entity;
///
public class EntityManager : IEntityManager
{
- private readonly ConcurrentDictionary _entityRegistersDict
- = new ConcurrentDictionary();
+ private readonly ConcurrentDictionary _entityRegistersDict = new();
private readonly ILogger _logger;
private bool _initialized;
+ public static bool IncludeSpecialTable = true;
+
///
/// 初始化一个类型的新实例
///
@@ -33,7 +34,7 @@ public EntityManager(IServiceProvider provider)
public virtual void Initialize()
{
var dict = _entityRegistersDict;
- Type[] types = AssemblyManager.FindTypesByBase();
+ Type[] types = AssemblyManager.FindTypesByBase().Where(m => !m.IsNestedPrivate).ToArray();
if (types.Length == 0 || _initialized)
{
_logger.LogDebug("数据库上下文实体已初始化,跳过");
@@ -48,14 +49,14 @@ public virtual void Initialize()
foreach (IGrouping group in groups)
{
key = group.Key ?? typeof(DefaultDbContext);
- List list = dict.ContainsKey(key) ? dict[key].ToList() : new List();
+ List list = dict.TryGetValue(key, out var value) ? value.ToList() : new List();
list.AddRange(group);
dict[key] = list.ToArray();
}
//添加框架的一些默认实体的实体映射信息(如果不存在)
key = typeof(DefaultDbContext);
- if (dict.ContainsKey(key))
+ if (dict.ContainsKey(key) && IncludeSpecialTable)
{
List list = dict[key].ToList();
list.AddIfNotExist(new EntityInfoConfiguration(), m => m.EntityType.IsBaseOn());
@@ -87,7 +88,7 @@ public virtual IEntityRegister[] GetEntityRegisters(Type dbContextType)
{
throw new OsharpException("数据访问模块未初始化,请确认数据上下文配置节点 OSharp:DbContexts 与要使用的数据库类型是否匹配");
}
- return _entityRegistersDict.ContainsKey(dbContextType) ? _entityRegistersDict[dbContextType] : Array.Empty();
+ return _entityRegistersDict.TryGetValue(dbContextType, out var value) ? value : Array.Empty();
}
///
diff --git a/src/OSharp.EntityFrameworkCore/EntityTypeConfigurationBase.cs b/src/OSharp.EntityFrameworkCore/EntityTypeConfigurationBase.cs
index 2a75d09a9..47c6a2bde 100644
--- a/src/OSharp.EntityFrameworkCore/EntityTypeConfigurationBase.cs
+++ b/src/OSharp.EntityFrameworkCore/EntityTypeConfigurationBase.cs
@@ -48,4 +48,4 @@ public void RegisterTo(ModelBuilder modelBuilder)
///
/// 实体类型创建器
public abstract void Configure(EntityTypeBuilder builder);
-}
+}
diff --git a/src/OSharp.EntityFrameworkCore/OSharp.EntityFrameworkCore.csproj b/src/OSharp.EntityFrameworkCore/OSharp.EntityFrameworkCore.csproj
index 0b1bc06d2..51a9f6452 100644
--- a/src/OSharp.EntityFrameworkCore/OSharp.EntityFrameworkCore.csproj
+++ b/src/OSharp.EntityFrameworkCore/OSharp.EntityFrameworkCore.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.EntityFrameworkCore
OSharp数据访问组件,封装EntityFrameworkCore数据访问功能的实现
OSharp数据访问组件
@@ -12,29 +12,24 @@
1701;1702;1591
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
diff --git a/src/OSharp.EntityFrameworkCore/Repository.cs b/src/OSharp.EntityFrameworkCore/Repository.cs
index cfba552f3..a92dd0956 100644
--- a/src/OSharp.EntityFrameworkCore/Repository.cs
+++ b/src/OSharp.EntityFrameworkCore/Repository.cs
@@ -734,8 +734,8 @@ public virtual async Task DeleteBatchAsync(Expression>
{
// 物理删除
count = await _dbSet.Where(predicate).DeleteAsync(_cancellationTokenProvider.Token);
- }
-
+ }
+
await unitOfWork.CommitAsync(_cancellationTokenProvider.Token);
return count;
}
@@ -828,8 +828,8 @@ public virtual async Task UpdateBatchAsync(Expression>
//走EF.Plus的时候,是不调用SaveChanges的,需要手动开启事务
await ((DbContextBase)_dbContext).BeginOrUseTransactionAsync(_cancellationTokenProvider.Token);
- int count = await _dbSet.Where(predicate).UpdateAsync(updateExpression, _cancellationTokenProvider.Token);
-
+ int count = await _dbSet.Where(predicate).UpdateAsync(updateExpression, _cancellationTokenProvider.Token);
+
await unitOfWork.CommitAsync(_cancellationTokenProvider.Token);
return count;
}
@@ -937,16 +937,16 @@ private void CheckDataAuth(DataAuthOperation operation, params TEntity[] entitie
if (entities.Length == 0 || _dataAuthService == null)
{
return;
- }
-
+ }
+
bool flag = _dataAuthService.CheckDataAuth(operation, entities);
if (!flag)
{
throw new OsharpException(
$"{operation.ToDescription()}编号为 {entities.ExpandAndToString(m => m.Id.ToString())} 的 {typeof(TEntity).GetDescription()} 时操作权限不足(403)");
}
- }
-
+ }
+
private TEntity[] CheckInsert(params TEntity[] entities)
{
for (int i = 0; i < entities.Length; i++)
diff --git a/src/OSharp.EntityFrameworkCore/UnitOfWork.cs b/src/OSharp.EntityFrameworkCore/UnitOfWork.cs
index 369e6144b..c75d3f6e7 100644
--- a/src/OSharp.EntityFrameworkCore/UnitOfWork.cs
+++ b/src/OSharp.EntityFrameworkCore/UnitOfWork.cs
@@ -264,7 +264,21 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
-
+
+ ///
+ /// 重写以实现释放派生类资源的逻辑
+ ///
+ protected override void Disposing()
+ {
+ foreach (var contexts in _contextDict.Values)
+ {
+ foreach (var context in contexts)
+ {
+ context.Dispose();
+ }
+ }
+ }
+
///
/// 对数据库连接开启事务
///
diff --git a/src/OSharp.Exceptionless/OSharp.Exceptionless.csproj b/src/OSharp.Exceptionless/OSharp.Exceptionless.csproj
index 3e6158d0b..cb709e50a 100644
--- a/src/OSharp.Exceptionless/OSharp.Exceptionless.csproj
+++ b/src/OSharp.Exceptionless/OSharp.Exceptionless.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Exceptionless
OSharp Exceptionless 分布式日志组件
OSharp Exceptionless 分布式日志组件,封装基于Exceptionless 分布式日志记录实现
diff --git a/src/OSharp.Hangfire/OSharp.Hangfire.csproj b/src/OSharp.Hangfire/OSharp.Hangfire.csproj
index 2ccf040c8..f62e969ad 100644
--- a/src/OSharp.Hangfire/OSharp.Hangfire.csproj
+++ b/src/OSharp.Hangfire/OSharp.Hangfire.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Hangfire
OSharp Hangfire 后台任务组件
OSharp Hangfire 后台任务组件,封装基于Hangfire后台任务的服务端实现
diff --git a/src/OSharp.Hosting.Apis/OSharp.Hosting.Apis.csproj b/src/OSharp.Hosting.Apis/OSharp.Hosting.Apis.csproj
index f159755d0..e725f4425 100644
--- a/src/OSharp.Hosting.Apis/OSharp.Hosting.Apis.csproj
+++ b/src/OSharp.Hosting.Apis/OSharp.Hosting.Apis.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Hosting.Apis
Library
OSharp框架非业务WebAPI实现
@@ -19,17 +19,15 @@
-
-
-
-
-
-
+
+
+
+
diff --git a/src/OSharp.Hosting.Core/Identity/RoleStore.cs b/src/OSharp.Hosting.Core/Identity/RoleStore.cs
index 64acffd45..f6dc1e99d 100644
--- a/src/OSharp.Hosting.Core/Identity/RoleStore.cs
+++ b/src/OSharp.Hosting.Core/Identity/RoleStore.cs
@@ -23,4 +23,5 @@ public class RoleStore : OSharp.Identity.RoleStoreBase roleRepository, IRepository roleClaimRepository)
: base(roleRepository, roleClaimRepository)
{ }
+
}
diff --git a/src/OSharp.Hosting.Core/Identity/UserStore.cs b/src/OSharp.Hosting.Core/Identity/UserStore.cs
index de39a5571..0a5a1af0f 100644
--- a/src/OSharp.Hosting.Core/Identity/UserStore.cs
+++ b/src/OSharp.Hosting.Core/Identity/UserStore.cs
@@ -36,4 +36,5 @@ public UserStore(IRepository userRepository,
IEventBus eventBus)
: base(userRepository, userLoginRepository, userClaimRepository, userTokenRepository, roleRepository, userRoleRepository, eventBus)
{ }
+
}
diff --git a/src/OSharp.Hosting.Core/OSharp.Hosting.Core.csproj b/src/OSharp.Hosting.Core/OSharp.Hosting.Core.csproj
index 2334d141d..3f57dc8be 100644
--- a/src/OSharp.Hosting.Core/OSharp.Hosting.Core.csproj
+++ b/src/OSharp.Hosting.Core/OSharp.Hosting.Core.csproj
@@ -4,26 +4,22 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Hosting.Core
OSharp框架非业务核心
OSharp框架业务核心,封装框架非业务如认证,权限,系统,消息等模块的接口与业务实现
OSharp.Hosting
-
-
-
-
-
+
-
+
-
+
-
+
diff --git a/src/OSharp.Hosting.EntityConfiguration/OSharp.Hosting.EntityConfiguration.csproj b/src/OSharp.Hosting.EntityConfiguration/OSharp.Hosting.EntityConfiguration.csproj
index 0858f31bb..0bc5a7baa 100644
--- a/src/OSharp.Hosting.EntityConfiguration/OSharp.Hosting.EntityConfiguration.csproj
+++ b/src/OSharp.Hosting.EntityConfiguration/OSharp.Hosting.EntityConfiguration.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Hosting.EntityConfiguration
OSharp框架非业务实体映射
OSharp框架非业务实体映射,封装框架非业务如认证,权限,系统,消息等模块的EFCore实体映射
@@ -13,9 +13,20 @@
-
+
+
+
+
diff --git a/src/OSharp.Identity/Identity/RoleStoreBase.cs b/src/OSharp.Identity/Identity/RoleStoreBase.cs
index 7a3a20fd4..120982d04 100644
--- a/src/OSharp.Identity/Identity/RoleStoreBase.cs
+++ b/src/OSharp.Identity/Identity/RoleStoreBase.cs
@@ -336,4 +336,16 @@ public Task FindByNameAsync(string normalizedRoleName, CancellationToken
}
#endregion
+
+ #region Overrides of Disposable
+
+ ///
+ /// 重写以实现释放派生类资源的逻辑
+ ///
+ protected override void Disposing()
+ {
+
+ }
+
+ #endregion
}
diff --git a/src/OSharp.Identity/Identity/UserStoreBase.cs b/src/OSharp.Identity/Identity/UserStoreBase.cs
index 6f230d449..d89e45f5b 100644
--- a/src/OSharp.Identity/Identity/UserStoreBase.cs
+++ b/src/OSharp.Identity/Identity/UserStoreBase.cs
@@ -1,4 +1,4 @@
-// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
//
// Copyright (c) 2014-2020 OSharp. All rights reserved.
//
@@ -1298,4 +1298,16 @@ protected void ThrowIfDisposed()
}
#endregion
-}
\ No newline at end of file
+
+ #region Overrides of Disposable
+
+ ///
+ /// 重写以实现释放派生类资源的逻辑
+ ///
+ protected override void Disposing()
+ {
+
+ }
+
+ #endregion
+}
diff --git a/src/OSharp.Identity/OSharp.Identity.csproj b/src/OSharp.Identity/OSharp.Identity.csproj
index 7ec33d92f..c2129253e 100644
--- a/src/OSharp.Identity/OSharp.Identity.csproj
+++ b/src/OSharp.Identity/OSharp.Identity.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Identity
OSharp 身份认证组件
OSharp 身份认证组件,基于AspNetCore.Identity和Osharp仓储系统的身份认证实现
@@ -17,14 +17,6 @@
-
-
-
-
-
-
-
-
@@ -33,6 +25,10 @@
+
+
+
+
diff --git a/src/OSharp.Log4Net/Log4NetLoggerProvider.cs b/src/OSharp.Log4Net/Log4NetLoggerProvider.cs
index 2241396d9..75e1fb325 100644
--- a/src/OSharp.Log4Net/Log4NetLoggerProvider.cs
+++ b/src/OSharp.Log4Net/Log4NetLoggerProvider.cs
@@ -92,13 +92,11 @@ private static Assembly GetCallingAssemblyFromStartup()
return null;
}
- protected override void Dispose(bool disposing)
+ ///
+ /// 重写以实现释放派生类资源的逻辑
+ ///
+ protected override void Disposing()
{
- if (!Disposed)
- {
- _loggers.Clear();
- }
-
- base.Dispose(disposing);
+ _loggers.Clear();
}
}
diff --git a/src/OSharp.Log4Net/OSharp.Log4Net.csproj b/src/OSharp.Log4Net/OSharp.Log4Net.csproj
index 08173d8f2..f0387f5e5 100644
--- a/src/OSharp.Log4Net/OSharp.Log4Net.csproj
+++ b/src/OSharp.Log4Net/OSharp.Log4Net.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Log4Net
OSharp Log4Net组件
OSharp Log4Net组件,封装使用log4net组件来实现框架的日志输出功能
diff --git a/src/OSharp.MiniProfiler/OSharp.MiniProfiler.csproj b/src/OSharp.MiniProfiler/OSharp.MiniProfiler.csproj
index be700663e..073402b17 100644
--- a/src/OSharp.MiniProfiler/OSharp.MiniProfiler.csproj
+++ b/src/OSharp.MiniProfiler/OSharp.MiniProfiler.csproj
@@ -4,25 +4,13 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0
OSharp.MiniProfiler
OSharp MiniProfiler 性能监测组件
OSharp MiniProfiler 性能监测组件,基于MiniProfiler实现的性能监测组件
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/OSharp.NLog/NLogLoggerProvider.cs b/src/OSharp.NLog/NLogLoggerProvider.cs
index 51f5f08f0..a20da0e14 100644
--- a/src/OSharp.NLog/NLogLoggerProvider.cs
+++ b/src/OSharp.NLog/NLogLoggerProvider.cs
@@ -93,14 +93,12 @@ private static Assembly GetCallingAssemblyFromStartup()
return null;
}
- protected override void Dispose(bool disposing)
+ ///
+ /// 重写以实现释放派生类资源的逻辑
+ ///
+ protected override void Disposing()
{
- if (!Disposed)
- {
- _loggers.Clear();
- }
-
- base.Dispose(disposing);
+ _loggers.Clear();
}
}
}
diff --git a/src/OSharp.NLog/OSharp.NLog.csproj b/src/OSharp.NLog/OSharp.NLog.csproj
index 2f0d71625..0e09e3655 100644
--- a/src/OSharp.NLog/OSharp.NLog.csproj
+++ b/src/OSharp.NLog/OSharp.NLog.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.NLog
OSharp NLog组件,封装使用nlog组件来实现框架的日志输出功能
OSharp NLog组件
diff --git a/src/OSharp.Redis/OSharp.Redis.csproj b/src/OSharp.Redis/OSharp.Redis.csproj
index 085433ce4..bb8d604da 100644
--- a/src/OSharp.Redis/OSharp.Redis.csproj
+++ b/src/OSharp.Redis/OSharp.Redis.csproj
@@ -4,24 +4,21 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Redis
OSharp Redis 缓存组件
OSharp Redis 缓存组件,封装基于Redis客户端的缓存实现
-
-
-
-
-
-
+
+
+
diff --git a/src/OSharp.Swagger/OSharp.Swagger.csproj b/src/OSharp.Swagger/OSharp.Swagger.csproj
index 5ae573f27..5e451050b 100644
--- a/src/OSharp.Swagger/OSharp.Swagger.csproj
+++ b/src/OSharp.Swagger/OSharp.Swagger.csproj
@@ -4,7 +4,7 @@
- net6.0;net7.0;net8.0;net9.0
+ net8.0;net9.0;net10.0
OSharp.Swagger
OSharp Swagger 客户端组件
OSharp Swagger 客户端组件,封装基于Redis客户端实现
diff --git a/src/OSharp.Utils/Data/Disposable.cs b/src/OSharp.Utils/Data/Disposable.cs
index f63de8a03..85f12ed66 100644
--- a/src/OSharp.Utils/Data/Disposable.cs
+++ b/src/OSharp.Utils/Data/Disposable.cs
@@ -1,4 +1,4 @@
-// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
//
// Copyright (c) 2014-2020 OSharp. All rights reserved.
//
@@ -21,12 +21,22 @@ public abstract class Disposable : IDisposable
protected virtual void Dispose(bool disposing)
{
+ if (Disposed)
+ {
+ return;
+ }
if (disposing)
{
- Disposed = true;
+ Disposing();
}
+ Disposed = true;
}
+ ///
+ /// 重写以实现释放派生类资源的逻辑
+ ///
+ protected abstract void Disposing();
+
/// 执行与释放或重置非托管资源关联的应用程序定义的任务。
public void Dispose()
{
@@ -39,4 +49,4 @@ public void Dispose()
Dispose(false);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/OSharp.Utils/Data/TreeHelper.README.md b/src/OSharp.Utils/Data/TreeHelper.README.md
new file mode 100644
index 000000000..0374430fb
--- /dev/null
+++ b/src/OSharp.Utils/Data/TreeHelper.README.md
@@ -0,0 +1,261 @@
+# TreeHelper 树形数据辅助类
+
+`TreeHelper` 是一个功能强大的树形数据操作工具类,提供了平面数据与树形数据之间的相互转换功能,以及树形数据的遍历操作。**无需实现特定接口,完全兼容现有代码**。
+
+## 功能特性
+
+- ✅ **平面数据转树形数据** - 将扁平的父子关系数据转换为树形结构
+- ✅ **树形数据转平面数据** - 将树形结构数据转换为扁平列表
+- ✅ **树形数据遍历** - 非递归的前序遍历算法
+- ✅ **泛型支持** - 支持 int、string、Guid 等各种类型的节点ID
+- ✅ **高性能** - 使用字典查找,时间复杂度 O(n)
+- ✅ **非递归实现** - 避免栈溢出,适合深层树结构
+- ✅ **完全兼容** - 无需实现接口,适配任何现有类
+- ✅ **完整测试** - 100% 单元测试覆盖
+
+## 核心方法
+
+### 1. ToTree - 平面数据转树形数据
+
+将具有父子关系的平面数据转换为树形结构。
+
+```csharp
+public static IList ToTree(
+ IEnumerable flatData,
+ Func getId,
+ Func getParentId,
+ Func> getChildren,
+ Action> setChildren,
+ TKey rootId = default(TKey))
+```
+
+**参数说明:**
+- `flatData`: 平面数据列表
+- `getId`: 获取节点ID的委托函数
+- `getParentId`: 获取父节点ID的委托函数
+- `getChildren`: 获取子节点集合的委托函数
+- `setChildren`: 设置子节点集合的委托函数
+- `rootId`: 根节点ID,默认为 `default(TKey)`
+
+**返回值:**
+- 树形数据列表(根节点集合)
+
+### 2. ToFlat - 树形数据转平面数据
+
+将树形结构数据转换为扁平列表,支持深度优先遍历。
+
+```csharp
+public static IList ToFlat(
+ IEnumerable treeData,
+ Func> getChildren,
+ Func createFlatNode)
+```
+
+**参数说明:**
+- `treeData`: 树形数据列表
+- `getChildren`: 获取子节点集合的委托函数
+- `createFlatNode`: 创建平面节点的委托函数
+
+**返回值:**
+- 平面数据列表
+
+### 3. TraverseWithStack - 树形数据遍历
+
+使用堆栈实现树的前序遍历(非递归)。
+
+```csharp
+public static void TraverseWithStack(
+ T root,
+ Func> getChildNodes,
+ Action processNode)
+```
+
+**参数说明:**
+- `root`: 根节点
+- `getChildNodes`: 获取节点子节点的委托函数
+- `processNode`: 处理节点的委托函数
+
+## 使用示例
+
+### 基本用法
+
+```csharp
+// 1. 定义树节点类(无需实现任何接口)
+public class TreeNode
+{
+ public int Id { get; set; }
+ public int ParentId { get; set; }
+ public string Name { get; set; }
+ public IList Children { get; set; } = new List();
+}
+
+// 2. 创建平面数据
+var flatData = new List
+{
+ new TreeNode { Id = 1, ParentId = 0, Name = "根节点1" },
+ new TreeNode { Id = 2, ParentId = 0, Name = "根节点2" },
+ new TreeNode { Id = 3, ParentId = 1, Name = "子节点1-1" },
+ new TreeNode { Id = 4, ParentId = 1, Name = "子节点1-2" },
+ new TreeNode { Id = 5, ParentId = 2, Name = "子节点2-1" }
+};
+
+// 3. 平面数据转树形数据
+var treeData = TreeHelper.ToTree(
+ flatData,
+ x => x.Id, // 获取ID
+ x => x.ParentId, // 获取父ID
+ x => x.Children, // 获取子节点集合
+ (x, children) => x.Children = children, // 设置子节点集合
+ 0 // 根节点ID
+);
+
+// 4. 树形数据转平面数据
+var flatResult = TreeHelper.ToFlat(
+ treeData,
+ x => x.Children, // 获取子节点集合
+ x => new TreeNode // 创建平面节点
+ {
+ Id = x.Id,
+ ParentId = x.ParentId,
+ Name = x.Name,
+ Children = null
+ }
+);
+
+// 5. 树形数据遍历
+TreeHelper.TraverseWithStack(
+ treeData.First(),
+ x => x.Children,
+ x => Console.WriteLine($"处理节点: {x.Name}")
+);
+```
+
+### 高级用法
+
+#### 支持不同属性名
+
+```csharp
+public class MenuItem
+{
+ public string MenuId { get; set; }
+ public string ParentMenuId { get; set; }
+ public string MenuName { get; set; }
+ public List