Skip to content

Commit 980dee8

Browse files
committed
.net版本升级至8.0
1 parent 2eab82f commit 980dee8

File tree

18 files changed

+80
-55
lines changed

18 files changed

+80
-55
lines changed

framework/Directory.Build.props

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<Project>
2-
<PropertyGroup>
3-
<TargetFramework>netstandard2.1</TargetFramework>
4-
<RootNamespace>Amos.Abp</RootNamespace>
5-
<Authors>Amos</Authors>
6-
<Version>1.1.3</Version>
7-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
8-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9-
<PackageReadmeFile>README.md</PackageReadmeFile>
10-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11-
<PackageProjectUrl>https://github.com/izanhzh/Amos.Abp</PackageProjectUrl>
12-
<RepositoryType>git</RepositoryType>
13-
<RepositoryUrl>https://github.com/izanhzh/Amos.Abp.git</RepositoryUrl>
14-
<PackageOutputPath>$(MSBuildThisFileDirectory)build\$(Configuration)\</PackageOutputPath>
15-
</PropertyGroup>
2+
<PropertyGroup>
3+
<RootNamespace>Amos.Abp</RootNamespace>
4+
<Authors>Amos</Authors>
5+
<Version>2.0.0</Version>
6+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
7+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
8+
<PackageReadmeFile>README.md</PackageReadmeFile>
9+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
10+
<PackageProjectUrl>https://github.com/izanhzh/Amos.Abp</PackageProjectUrl>
11+
<RepositoryType>git</RepositoryType>
12+
<RepositoryUrl>https://github.com/izanhzh/Amos.Abp.git</RepositoryUrl>
13+
<PackageOutputPath>$(MSBuildThisFileDirectory)build\$(Configuration)\</PackageOutputPath>
14+
</PropertyGroup>
1615

17-
<ItemGroup>
18-
<None Include="README.md" Pack="true" PackagePath="\" />
19-
</ItemGroup>
20-
</Project>
16+
<ItemGroup>
17+
<None Include="README.md" Pack="true" PackagePath="\" />
18+
</ItemGroup>
19+
</Project>

framework/Directory.Packages.props

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageVersion Include="coverlet.collector" Version="3.0.2"/>
7-
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.2" />
7+
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.1" />
88
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
99
<PackageVersion Include="NSubstitute" Version="4.2.2" />
1010
<PackageVersion Include="Scriban" Version="5.9.0" />
1111
<PackageVersion Include="Shouldly" Version="4.0.3" />
12-
<PackageVersion Include="Volo.Abp.Authorization" Version="4.4.4" />
13-
<PackageVersion Include="Volo.Abp.Autofac" Version="4.4.4" />
14-
<PackageVersion Include="Volo.Abp.Dapper" Version="4.4.4" />
15-
<PackageVersion Include="Volo.Abp.Ddd.Domain" Version="4.4.4" />
16-
<PackageVersion Include="Volo.Abp.EntityFrameworkCore" Version="4.4.4" />
17-
<PackageVersion Include="Volo.Abp.TestBase" Version="4.4.4" />
12+
<PackageVersion Include="Volo.Abp.Authorization" Version="8.2.0" />
13+
<PackageVersion Include="Volo.Abp.Autofac" Version="8.2.0" />
14+
<PackageVersion Include="Volo.Abp.Dapper" Version="8.2.0" />
15+
<PackageVersion Include="Volo.Abp.Ddd.Domain" Version="8.2.0" />
16+
<PackageVersion Include="Volo.Abp.EntityFrameworkCore" Version="8.2.0" />
17+
<PackageVersion Include="Volo.Abp.TestBase" Version="8.2.0" />
1818
<PackageVersion Include="xunit" Version="2.4.1" />
1919
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3"/>
2020
</ItemGroup>

framework/src/Amos.Abp.Domain/Amos.Abp.Domain.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Volo.Abp.Ddd.Domain"/>
59
</ItemGroup>

framework/src/Amos.Abp.Domain/Domain/Repositories/ISqlScriptRepository.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
using System.Collections.Generic;
22
using System.Data;
33
using System.Threading.Tasks;
4-
using Volo.Abp.Domain.Repositories;
54

65
namespace Amos.Abp.Domain.Repositories
76
{
87
/// <summary>
9-
/// SqlScriptKey格式约定:<script-namespace>:<script-id>
8+
/// SqlScriptKey格式约定:script-namespace:script-id
109
/// </summary>
11-
public interface ISqlScriptRepository : IRepository
10+
public interface ISqlScriptRepository
1211
{
1312
Task<string> GetSqlScriptAsync(string sqlScriptKey, object scriptRenderParam = null);
1413

framework/src/Amos.Abp.Domain/Domain/Repositories/ITempTableRepository.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5-
using Volo.Abp.Domain.Repositories;
65

76
namespace Amos.Abp.Domain.Repositories
87
{
9-
public interface ITempTableRepository : IRepository
8+
public interface ITempTableRepository
109
{
1110
Task<IQueryable<TTempTable>> InsertIntoTempTableAsync<TTempTable>(IEnumerable<TTempTable> entities) where TTempTable : class, ITempTable;
1211

framework/src/Amos.Abp.Domain/Extensions/ObjectExtension/PropertyEmit.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using Newtonsoft.Json;
2-
using System;
1+
using System;
32
using System.Collections.Concurrent;
43
using System.Collections.Generic;
54
using System.Linq;
65
using System.Reflection;
76
using System.Security.Cryptography;
87
using System.Text;
8+
using System.Text.Json;
99

1010
namespace Amos.Abp.Extensions.ObjectExtension
1111
{
@@ -110,7 +110,7 @@ public static string CreatePropertyValueMd5Sign(TObj instance, params string[] p
110110
}
111111

112112
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
113-
byte[] encryptedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(propertyValues).ToUpper()));
113+
byte[] encryptedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(JsonSerializer.Serialize(propertyValues).ToUpper()));
114114
StringBuilder sb = new StringBuilder();
115115
for (int i = 0; i < encryptedBytes.Length; i++)
116116
{

framework/src/Amos.Abp.EntityFrameworkCore/Amos.Abp.EntityFrameworkCore.csproj

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Volo.Abp.EntityFrameworkCore"/>
59
</ItemGroup>

framework/src/Amos.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AmosAbpEfCoreServiceCollectionExtensions.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ public static class AmosAbpEfCoreServiceCollectionExtensions
1717
/// <typeparam name="TDbContext"></typeparam>
1818
/// <param name="services"></param>
1919
/// <param name="optionsBuilder"></param>
20-
/// <param name="registerTempTableRepository"></param>
21-
/// <param name="registerBacthBulkExecuter"></param>
2220
/// <returns></returns>
2321
public static IServiceCollection AddAbpDbContextEx<TDbContext>(
2422
this IServiceCollection services,
@@ -42,7 +40,7 @@ private static void RegisterAutoAddEntityRepository<TDbContext>(IServiceCollecti
4240

4341
foreach (var dbContextType in replacedDbContextTypes)
4442
{
45-
options.ReplaceDbContext(dbContextType);
43+
options.ReplaceDbContext(dbContextType.Type, multiTenancySides: dbContextType.MultiTenancySide);
4644
}
4745

4846
optionsBuilder?.Invoke(options);

framework/src/Amos.Abp.SqlScript/Amos.Abp.SqlScript.csproj

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Scriban"/>
59
<PackageReference Include="Volo.Abp.Dapper"/>

framework/src/Amos.Abp.SqlScript/Domain/Repositories/SqlScriptRepository.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Amos.Abp.Domain.Repositories;
22
using Amos.Abp.SqlScript;
33
using Dapper;
4+
using Microsoft.EntityFrameworkCore;
45
using System;
56
using System.Collections.Generic;
67
using System.Data;
@@ -10,11 +11,13 @@
1011

1112
namespace Amos.Abp.Repositories
1213
{
13-
public abstract class SqlScriptRepository<TDbContext> : DapperRepository<TDbContext>, ISqlScriptRepository where TDbContext : IEfCoreDbContext
14+
public abstract class SqlScriptRepository<TDbContext> : DapperRepository<TDbContext>, ISqlScriptRepository where TDbContext : DbContext, IEfCoreDbContext
1415
{
1516
private readonly IDbContextProvider<TDbContext> _dbContextProvider;
1617
private readonly ISqlScriptProvider _sqlScriptProvider;
1718

19+
public bool? IsChangeTrackingEnabled { get; }
20+
1821
public SqlScriptRepository(
1922
IDbContextProvider<TDbContext> dbContextProvider,
2023
ISqlScriptProvider sqlScriptProvider) : base(dbContextProvider)

framework/src/Amos.Abp.TempTable.SqlServer/Amos.Abp.TempTable.SqlServer.csproj

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<ProjectReference Include="..\Amos.Abp.TempTable\Amos.Abp.TempTable.csproj" />
59
</ItemGroup>

framework/src/Amos.Abp.TempTable.SqlServer/TempTable/SqlServer/SqlServerTempTableBulkExecutor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public Task BulkInsertAsync<TDbContext, TTempTable>(
2222
IEnumerable<TTempTable> entities,
2323
TempTableBulkExecutorOptions options,
2424
CancellationToken cancellationToken = default)
25-
where TDbContext : IEfCoreDbContext
25+
where TDbContext : DbContext
2626
where TTempTable : class, ITempTable
2727
{
2828
if (entityType == null)
@@ -39,7 +39,7 @@ public async Task BulkInsertAsync<TDbContext, TTempTable>(
3939
string tableName,
4040
TempTableBulkExecutorOptions options,
4141
CancellationToken cancellationToken = default)
42-
where TDbContext : IEfCoreDbContext
42+
where TDbContext : DbContext
4343
where TTempTable : class, ITempTable
4444
{
4545
if (ctx == null)

framework/src/Amos.Abp.TempTable.SqlServer/TempTable/SqlServer/SqlServerTempTableCreator.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public async Task<string> CreateTempTableAsync<TDbContext>(
1818
IEntityType entityType,
1919
TempTableCreationOptions options,
2020
CancellationToken cancellationToken = default)
21-
where TDbContext : IEfCoreDbContext
21+
where TDbContext : DbContext
2222
{
2323
if (ctx == null)
2424
throw new ArgumentNullException(nameof(ctx));
@@ -52,7 +52,7 @@ public async Task CreatePrimaryKeyAsync<TDbContext>(
5252
string tableName,
5353
bool checkForExistence = false,
5454
CancellationToken cancellationToken = default)
55-
where TDbContext : IEfCoreDbContext
55+
where TDbContext : DbContext
5656
{
5757
if (ctx == null)
5858
throw new ArgumentNullException(nameof(ctx));

framework/src/Amos.Abp.TempTable/Amos.Abp.TempTable.csproj

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Microsoft.Data.SqlClient"/>
59
<PackageReference Include="Volo.Abp.EntityFrameworkCore"/>

framework/src/Amos.Abp.TempTable/Domain/Repositories/EfCoreTempTableRepository.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
using Amos.Abp.EntityFrameworkCore;
22
using Amos.Abp.TempTable;
3+
using Microsoft.EntityFrameworkCore;
34
using System.Collections.Generic;
45
using System.Linq;
56
using System.Threading.Tasks;
7+
using Volo.Abp.Domain.Repositories;
68
using Volo.Abp.EntityFrameworkCore;
79

810
namespace Amos.Abp.Domain.Repositories
911
{
10-
public abstract class EfCoreTempTableRepository<TDbContext> : ITempTableRepository where TDbContext : IEfCoreDbContext
12+
public abstract class EfCoreTempTableRepository<TDbContext> : ITempTableRepository where TDbContext : DbContext, IEfCoreDbContext
1113
{
1214
private readonly IDbContextProvider<TDbContext> _dbContextProvider;
1315

16+
public bool? IsChangeTrackingEnabled { get; }
17+
1418
public EfCoreTempTableRepository(IDbContextProvider<TDbContext> dbContextProvider)
1519
{
1620
_dbContextProvider = dbContextProvider;

framework/src/Amos.Abp.TempTable/EntityFrameworkCore/DbContextTempTableExtensions.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ public static class DbContextTempTableExtensions
2222
/// <param name="entities">Entities to insert.</param>
2323
/// <param name="options">Options.</param>
2424
/// <param name="cancellationToken">Cancellation token.</param>
25+
/// <typeparam name="TDbContext">DbContext type.</typeparam>
2526
/// <typeparam name="TTempTable">Entity type.</typeparam>
2627
/// <returns>A query for accessing the inserted values.</returns>
2728
/// <exception cref="ArgumentNullException"> <paramref name="ctx"/> or <paramref name="entities"/> is <c>null</c>.</exception>
2829
public static async Task<IQueryable<TTempTable>> InsertIntoTempTableAsync<TDbContext, TTempTable>(this TDbContext ctx, IEnumerable<TTempTable> entities, TempTableInsertOptions options = null, CancellationToken cancellationToken = default)
2930
where TTempTable : class, ITempTable
30-
where TDbContext : IEfCoreDbContext
31+
where TDbContext : DbContext
3132
{
3233
if (ctx == null)
3334
throw new ArgumentNullException(nameof(ctx));
@@ -54,7 +55,7 @@ public static async Task<IQueryable<TTempTable>> InsertIntoTempTableAsync<TDbCon
5455

5556
public static async Task<string> InsertIntoTempTableAndGetTableNameAsync<TDbContext, TTempTable>(this TDbContext ctx, IEnumerable<TTempTable> entities, TempTableInsertOptions options = null, CancellationToken cancellationToken = default)
5657
where TTempTable : class, ITempTable
57-
where TDbContext : IEfCoreDbContext
58+
where TDbContext : DbContext
5859
{
5960
if (ctx == null)
6061
throw new ArgumentNullException(nameof(ctx));
@@ -80,7 +81,7 @@ public static async Task<string> InsertIntoTempTableAndGetTableNameAsync<TDbCont
8081
}
8182

8283
private static IQueryable<TTempTable> GetTempTableQuery<TDbContext, TTempTable>(this TDbContext ctx, string tableName)
83-
where TDbContext : IEfCoreDbContext
84+
where TDbContext : DbContext
8485
where TTempTable : class, ITempTable
8586
{
8687
var sql = $"SELECT * FROM [{tableName}]";

framework/src/Amos.Abp.TempTable/TempTable/ITempTableBulkExecutor.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.EntityFrameworkCore.Metadata;
1+
using Microsoft.EntityFrameworkCore;
2+
using Microsoft.EntityFrameworkCore.Metadata;
23
using System.Collections.Generic;
34
using System.Threading;
45
using System.Threading.Tasks;
@@ -14,7 +15,7 @@ Task BulkInsertAsync<TDbContext, TTempTable>(
1415
IEnumerable<TTempTable> entities,
1516
TempTableBulkExecutorOptions options,
1617
CancellationToken cancellationToken = default)
17-
where TDbContext : IEfCoreDbContext
18+
where TDbContext : DbContext
1819
where TTempTable : class, ITempTable;
1920

2021
Task BulkInsertAsync<TDbContext, TTempTable>(
@@ -25,7 +26,7 @@ Task BulkInsertAsync<TDbContext, TTempTable>(
2526
string tableName,
2627
TempTableBulkExecutorOptions options,
2728
CancellationToken cancellationToken = default)
28-
where TDbContext : IEfCoreDbContext
29+
where TDbContext : DbContext
2930
where TTempTable : class, ITempTable;
3031
}
3132
}

framework/src/Amos.Abp.TempTable/TempTable/ITempTableCreator.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.EntityFrameworkCore.Metadata;
1+
using Microsoft.EntityFrameworkCore;
2+
using Microsoft.EntityFrameworkCore.Metadata;
23
using System;
34
using System.Threading;
45
using System.Threading.Tasks;
@@ -25,7 +26,7 @@ public interface ITempTableCreator
2526
/// <paramref name="entityType"/> is <c>null</c>.
2627
/// </exception>
2728
/// <exception cref="ArgumentException">The provided type <paramref name="entityType"/> is not known by the <paramref name="ctx"/>.</exception>
28-
Task<string> CreateTempTableAsync<TDbContext>(TDbContext ctx, IEntityType entityType, TempTableCreationOptions options, CancellationToken cancellationToken = default) where TDbContext : IEfCoreDbContext;
29+
Task<string> CreateTempTableAsync<TDbContext>(TDbContext ctx, IEntityType entityType, TempTableCreationOptions options, CancellationToken cancellationToken = default) where TDbContext : DbContext;
2930

3031
/// <summary>
3132
/// Creates a primary key in a temp table with provided <paramref name="tableName"/>.
@@ -40,6 +41,6 @@ public interface ITempTableCreator
4041
/// <param name="tableName">Table name to create the primary key in.</param>
4142
/// <param name="checkForExistence">If <c>true</c> then the primary key is not going to be created if it exists already.</param>
4243
/// <param name="cancellationToken">Cancellation token.</param>
43-
Task CreatePrimaryKeyAsync<TDbContext>(TDbContext ctx, IEntityType entityType, string tableName, bool checkForExistence = false, CancellationToken cancellationToken = default) where TDbContext : IEfCoreDbContext;
44+
Task CreatePrimaryKeyAsync<TDbContext>(TDbContext ctx, IEntityType entityType, string tableName, bool checkForExistence = false, CancellationToken cancellationToken = default) where TDbContext : DbContext;
4445
}
4546
}

0 commit comments

Comments
 (0)