Browse Source

upgrade: upgrade abp framework to 8.1.1

pull/946/head
colin 2 years ago
parent
commit
27a3259acb
  1. 2
      .github/workflows/publish.yml
  2. 4
      .github/workflows/release.yml
  3. 6
      Directory.Packages.props
  4. 49
      aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs
  5. 1
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs
  6. 8
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs
  7. 1
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs
  8. 4
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs
  9. 4
      common.props

2
.github/workflows/publish.yml

@ -2,7 +2,7 @@ name: "Publish"
on:
push:
branches: [ rel-8.1.0 ]
branches: [ rel-8.1.1 ]
env:
DOTNET_VERSION: "8.0.200"

4
.github/workflows/release.yml

@ -2,7 +2,7 @@ name: "Tagged Release"
on:
push:
branches: [ rel-8.1.0 ]
branches: [ rel-8.1.1 ]
jobs:
tagged-release:
@ -14,4 +14,4 @@ jobs:
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
automatic_release_tag: "8.1.0"
automatic_release_tag: "8.1.1"

6
Directory.Packages.props

@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<DotNetCoreCAPPackageVersion>8.1.0</DotNetCoreCAPPackageVersion>
<DotNetCoreCAPPackageVersion>8.1.1</DotNetCoreCAPPackageVersion>
<ElsaPackageVersion>2.14.1</ElsaPackageVersion>
<VoloAbpPackageVersion>8.1.0</VoloAbpPackageVersion>
<VoloAbpPackageVersion>8.1.1</VoloAbpPackageVersion>
<MicrosoftExtensionsPackageVersion>8.0.0</MicrosoftExtensionsPackageVersion>
<MicrosoftAspNetCorePackageVersion>8.0.0</MicrosoftAspNetCorePackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>8.0.0</MicrosoftEntityFrameworkCorePackageVersion>
@ -229,7 +229,7 @@
<PackageVersion Include="Hangfire.MySqlStorage" Version="2.0.3" />
<PackageVersion Include="HangFire.SqlServer" Version="1.8.6" />
<PackageVersion Include="IdentityModel" Version="6.2.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2022.1.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageVersion Include="Markdig" Version="0.34.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NEST" Version="7.15.1" />

49
aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Saas.Features;
using LINGYUN.Abp.Saas.Tenants;
using LINGYUN.Abp.Saas.Tenants;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
@ -53,37 +52,31 @@ public class PlatformDbMigrationEventHandler :
var hostDefaultConnectionString = Configuration.GetConnectionString(ConnectionStrings.DefaultConnectionStringName);
using (CurrentTenant.Change(eventData.Id))
{
// 租户删除时的资源回收策略
var strategyFeature = await FeatureChecker.GetOrNullAsync(SaasFeatureNames.Tenant.RecycleStrategy);
if (!strategyFeature.IsNullOrWhiteSpace() && Enum.TryParse<RecycleStrategy>(strategyFeature, out var strategy))
// 需要回收策略为回收且存在默认连接字符串且默认连接字符串与宿主不同
if (eventData.Strategy == RecycleStrategy.Recycle && !eventData.DefaultConnectionString.IsNullOrWhiteSpace())
{
// 需要回收策略为回收且存在默认连接字符串且默认连接字符串与宿主不同
if (strategy == RecycleStrategy.Recycle && !eventData.DefaultConnectionString.IsNullOrWhiteSpace())
var hostConnection = new DbConnectionStringBuilder()
{
var hostConnection = new DbConnectionStringBuilder()
{
ConnectionString = hostDefaultConnectionString,
};
var tenantConnection = new DbConnectionStringBuilder()
{
ConnectionString = eventData.DefaultConnectionString,
};
if (hostConnection.EquivalentTo(tenantConnection))
{
return;
}
ConnectionString = hostDefaultConnectionString,
};
var tenantConnection = new DbConnectionStringBuilder()
{
ConnectionString = eventData.DefaultConnectionString,
};
if (hostConnection.EquivalentTo(tenantConnection))
{
return;
}
using var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
var buildr = new DbContextOptionsBuilder();
buildr.UseMySql(eventData.DefaultConnectionString, ServerVersion.AutoDetect(eventData.DefaultConnectionString));
await using var dbConnection = new DbContext(buildr.Options);
if ((await dbConnection.Database.GetAppliedMigrationsAsync()).Any())
{
await dbConnection.Database.EnsureDeletedAsync();
}
using var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
var buildr = new DbContextOptionsBuilder();
buildr.UseMySql(eventData.DefaultConnectionString, ServerVersion.AutoDetect(eventData.DefaultConnectionString));
await using var dbConnection = new DbContext(buildr.Options);
if ((await dbConnection.Database.GetAppliedMigrationsAsync()).Any())
{
await dbConnection.Database.EnsureDeletedAsync();
}
}
}
}
}

1
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs

@ -19,6 +19,7 @@ namespace LINGYUN.Abp.Account
{
var user = await GetCurrentUserAsync();
// TODO: Use AbpClaimTypes.Picture
user.Claims.RemoveAll(x => x.ClaimType.Equals(IdentityConsts.ClaimType.Avatar.Name));
user.AddClaim(GuidGenerator, new Claim(IdentityConsts.ClaimType.Avatar.Name, input.AvatarUrl));

8
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using LINGYUN.Abp.Saas.Features;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
@ -7,6 +8,7 @@ using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Features;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectExtending;
@ -153,10 +155,14 @@ public class TenantAppService : AbpSaasAppServiceBase, ITenantAppService
{
return;
}
// 租户删除时查询会失效, 在删除前确认
var strategy = await FeatureChecker.GetAsync(SaasFeatureNames.Tenant.RecycleStrategy, RecycleStrategy.Recycle);
var eto = new TenantDeletedEto
{
Id = tenant.Id,
Name = tenant.Name,
Strategy = strategy,
EntityVersion = tenant.EntityVersion,
DefaultConnectionString = tenant.FindDefaultConnectionString(),
};

1
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs

@ -7,5 +7,6 @@ namespace LINGYUN.Abp.Saas.Tenants;
[EventName("abp.saas.tenant.deleted")]
public class TenantDeletedEto : TenantEto
{
public RecycleStrategy Strategy { get; set; }
public string DefaultConnectionString { get; set; }
}

4
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs

@ -43,14 +43,14 @@ public class SaasFeatureDefinitionProvider : FeatureDefinitionProvider
defaultValue: 15.ToString(),
displayName: L("Features:ExpirationReminderDays"),
description: L("Features:ExpirationReminderDaysDesc"),
valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)),
valueType: new FreeTextStringValueType(new NumericValueValidator(1, 30)),
isAvailableToHost: false);
saas.AddFeature(
name: SaasFeatureNames.Tenant.ExpiredRecoveryTime,
defaultValue: 15.ToString(),
displayName: L("Features:ExpiredRecoveryTime"),
description: L("Features:ExpiredRecoveryTimeDesc"),
valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)),
valueType: new FreeTextStringValueType(new NumericValueValidator(1, 30)),
isAvailableToHost: false);
}

4
common.props

@ -1,12 +1,12 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>8.1.0</Version>
<Version>8.1.1</Version>
<Authors>colin</Authors>
<NoWarn>$(NoWarn);CS1591;CS0436;CS8618;NU1803</NoWarn>
<PackageProjectUrl>https://github.com/colinin/abp-next-admin</PackageProjectUrl>
<PackageOutputPath>$(SolutionDir)LocalNuget</PackageOutputPath>
<PackageVersion>8.1.0</PackageVersion>
<PackageVersion>8.1.1</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/colinin/abp-next-admin</RepositoryUrl>

Loading…
Cancel
Save