Skip to content

Commit

Permalink
.net版本升级至8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
izanhzh committed Jul 8, 2024
1 parent 2eab82f commit 980dee8
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 55 deletions.
35 changes: 17 additions & 18 deletions framework/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<Project>
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>Amos.Abp</RootNamespace>
<Authors>Amos</Authors>
<Version>1.1.3</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageProjectUrl>https://github.com/izanhzh/Amos.Abp</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/izanhzh/Amos.Abp.git</RepositoryUrl>
<PackageOutputPath>$(MSBuildThisFileDirectory)build\$(Configuration)\</PackageOutputPath>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>Amos.Abp</RootNamespace>
<Authors>Amos</Authors>
<Version>2.0.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageProjectUrl>https://github.com/izanhzh/Amos.Abp</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/izanhzh/Amos.Abp.git</RepositoryUrl>
<PackageOutputPath>$(MSBuildThisFileDirectory)build\$(Configuration)\</PackageOutputPath>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions framework/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="3.0.2"/>
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.2" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageVersion Include="NSubstitute" Version="4.2.2" />
<PackageVersion Include="Scriban" Version="5.9.0" />
<PackageVersion Include="Shouldly" Version="4.0.3" />
<PackageVersion Include="Volo.Abp.Authorization" Version="4.4.4" />
<PackageVersion Include="Volo.Abp.Autofac" Version="4.4.4" />
<PackageVersion Include="Volo.Abp.Dapper" Version="4.4.4" />
<PackageVersion Include="Volo.Abp.Ddd.Domain" Version="4.4.4" />
<PackageVersion Include="Volo.Abp.EntityFrameworkCore" Version="4.4.4" />
<PackageVersion Include="Volo.Abp.TestBase" Version="4.4.4" />
<PackageVersion Include="Volo.Abp.Authorization" Version="8.2.0" />
<PackageVersion Include="Volo.Abp.Autofac" Version="8.2.0" />
<PackageVersion Include="Volo.Abp.Dapper" Version="8.2.0" />
<PackageVersion Include="Volo.Abp.Ddd.Domain" Version="8.2.0" />
<PackageVersion Include="Volo.Abp.EntityFrameworkCore" Version="8.2.0" />
<PackageVersion Include="Volo.Abp.TestBase" Version="8.2.0" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3"/>
</ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions framework/src/Amos.Abp.Domain/Amos.Abp.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain"/>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;

namespace Amos.Abp.Domain.Repositories
{
/// <summary>
/// SqlScriptKey格式约定:<script-namespace>:<script-id>
/// SqlScriptKey格式约定:script-namespace:script-id
/// </summary>
public interface ISqlScriptRepository : IRepository
public interface ISqlScriptRepository
{
Task<string> GetSqlScriptAsync(string sqlScriptKey, object scriptRenderParam = null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;

namespace Amos.Abp.Domain.Repositories
{
public interface ITempTableRepository : IRepository
public interface ITempTableRepository
{
Task<IQueryable<TTempTable>> InsertIntoTempTableAsync<TTempTable>(IEnumerable<TTempTable> entities) where TTempTable : class, ITempTable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Newtonsoft.Json;
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;

namespace Amos.Abp.Extensions.ObjectExtension
{
Expand Down Expand Up @@ -110,7 +110,7 @@ public static string CreatePropertyValueMd5Sign(TObj instance, params string[] p
}

MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] encryptedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(propertyValues).ToUpper()));
byte[] encryptedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(JsonSerializer.Serialize(propertyValues).ToUpper()));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < encryptedBytes.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore"/>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public static class AmosAbpEfCoreServiceCollectionExtensions
/// <typeparam name="TDbContext"></typeparam>
/// <param name="services"></param>
/// <param name="optionsBuilder"></param>
/// <param name="registerTempTableRepository"></param>
/// <param name="registerBacthBulkExecuter"></param>
/// <returns></returns>
public static IServiceCollection AddAbpDbContextEx<TDbContext>(
this IServiceCollection services,
Expand All @@ -42,7 +40,7 @@ private static void RegisterAutoAddEntityRepository<TDbContext>(IServiceCollecti

foreach (var dbContextType in replacedDbContextTypes)
{
options.ReplaceDbContext(dbContextType);
options.ReplaceDbContext(dbContextType.Type, multiTenancySides: dbContextType.MultiTenancySide);
}

optionsBuilder?.Invoke(options);
Expand Down
6 changes: 5 additions & 1 deletion framework/src/Amos.Abp.SqlScript/Amos.Abp.SqlScript.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Scriban"/>
<PackageReference Include="Volo.Abp.Dapper"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Amos.Abp.Domain.Repositories;
using Amos.Abp.SqlScript;
using Dapper;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Data;
Expand All @@ -10,11 +11,13 @@

namespace Amos.Abp.Repositories
{
public abstract class SqlScriptRepository<TDbContext> : DapperRepository<TDbContext>, ISqlScriptRepository where TDbContext : IEfCoreDbContext
public abstract class SqlScriptRepository<TDbContext> : DapperRepository<TDbContext>, ISqlScriptRepository where TDbContext : DbContext, IEfCoreDbContext
{
private readonly IDbContextProvider<TDbContext> _dbContextProvider;
private readonly ISqlScriptProvider _sqlScriptProvider;

public bool? IsChangeTrackingEnabled { get; }

public SqlScriptRepository(
IDbContextProvider<TDbContext> dbContextProvider,
ISqlScriptProvider sqlScriptProvider) : base(dbContextProvider)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Amos.Abp.TempTable\Amos.Abp.TempTable.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Task BulkInsertAsync<TDbContext, TTempTable>(
IEnumerable<TTempTable> entities,
TempTableBulkExecutorOptions options,
CancellationToken cancellationToken = default)
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
where TTempTable : class, ITempTable
{
if (entityType == null)
Expand All @@ -39,7 +39,7 @@ public async Task BulkInsertAsync<TDbContext, TTempTable>(
string tableName,
TempTableBulkExecutorOptions options,
CancellationToken cancellationToken = default)
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
where TTempTable : class, ITempTable
{
if (ctx == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public async Task<string> CreateTempTableAsync<TDbContext>(
IEntityType entityType,
TempTableCreationOptions options,
CancellationToken cancellationToken = default)
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
{
if (ctx == null)
throw new ArgumentNullException(nameof(ctx));
Expand Down Expand Up @@ -52,7 +52,7 @@ public async Task CreatePrimaryKeyAsync<TDbContext>(
string tableName,
bool checkForExistence = false,
CancellationToken cancellationToken = default)
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
{
if (ctx == null)
throw new ArgumentNullException(nameof(ctx));
Expand Down
6 changes: 5 additions & 1 deletion framework/src/Amos.Abp.TempTable/Amos.Abp.TempTable.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient"/>
<PackageReference Include="Volo.Abp.EntityFrameworkCore"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
using Amos.Abp.EntityFrameworkCore;
using Amos.Abp.TempTable;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EntityFrameworkCore;

namespace Amos.Abp.Domain.Repositories
{
public abstract class EfCoreTempTableRepository<TDbContext> : ITempTableRepository where TDbContext : IEfCoreDbContext
public abstract class EfCoreTempTableRepository<TDbContext> : ITempTableRepository where TDbContext : DbContext, IEfCoreDbContext
{
private readonly IDbContextProvider<TDbContext> _dbContextProvider;

public bool? IsChangeTrackingEnabled { get; }

public EfCoreTempTableRepository(IDbContextProvider<TDbContext> dbContextProvider)
{
_dbContextProvider = dbContextProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ public static class DbContextTempTableExtensions
/// <param name="entities">Entities to insert.</param>
/// <param name="options">Options.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <typeparam name="TDbContext">DbContext type.</typeparam>
/// <typeparam name="TTempTable">Entity type.</typeparam>
/// <returns>A query for accessing the inserted values.</returns>
/// <exception cref="ArgumentNullException"> <paramref name="ctx"/> or <paramref name="entities"/> is <c>null</c>.</exception>
public static async Task<IQueryable<TTempTable>> InsertIntoTempTableAsync<TDbContext, TTempTable>(this TDbContext ctx, IEnumerable<TTempTable> entities, TempTableInsertOptions options = null, CancellationToken cancellationToken = default)
where TTempTable : class, ITempTable
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
{
if (ctx == null)
throw new ArgumentNullException(nameof(ctx));
Expand All @@ -54,7 +55,7 @@ public static async Task<IQueryable<TTempTable>> InsertIntoTempTableAsync<TDbCon

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

private static IQueryable<TTempTable> GetTempTableQuery<TDbContext, TTempTable>(this TDbContext ctx, string tableName)
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
where TTempTable : class, ITempTable
{
var sql = $"SELECT * FROM [{tableName}]";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -14,7 +15,7 @@ Task BulkInsertAsync<TDbContext, TTempTable>(
IEnumerable<TTempTable> entities,
TempTableBulkExecutorOptions options,
CancellationToken cancellationToken = default)
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
where TTempTable : class, ITempTable;

Task BulkInsertAsync<TDbContext, TTempTable>(
Expand All @@ -25,7 +26,7 @@ Task BulkInsertAsync<TDbContext, TTempTable>(
string tableName,
TempTableBulkExecutorOptions options,
CancellationToken cancellationToken = default)
where TDbContext : IEfCoreDbContext
where TDbContext : DbContext
where TTempTable : class, ITempTable;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -25,7 +26,7 @@ public interface ITempTableCreator
/// <paramref name="entityType"/> is <c>null</c>.
/// </exception>
/// <exception cref="ArgumentException">The provided type <paramref name="entityType"/> is not known by the <paramref name="ctx"/>.</exception>
Task<string> CreateTempTableAsync<TDbContext>(TDbContext ctx, IEntityType entityType, TempTableCreationOptions options, CancellationToken cancellationToken = default) where TDbContext : IEfCoreDbContext;
Task<string> CreateTempTableAsync<TDbContext>(TDbContext ctx, IEntityType entityType, TempTableCreationOptions options, CancellationToken cancellationToken = default) where TDbContext : DbContext;

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

0 comments on commit 980dee8

Please sign in to comment.