Browse Source

Merge pull request #10994 from abpframework/auto-merge/rel-5-0/727

Merge branch dev with rel-5.0
pull/10999/head
albert 5 years ago
committed by GitHub
parent
commit
29366d4ae0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/en/Getting-Started-AspNetCore-Application.md
  2. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs
  3. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/sweetalert2/abp-sweetalert2.js
  4. 19
      framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs
  5. 30
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  6. 3
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
  7. 2
      framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo.Abp.BackgroundWorkers.Hangfire.csproj
  8. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlerBase.cs
  9. 30
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
  10. 10
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
  11. 2
      modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs
  12. 35
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs
  13. 2
      nupkg/common.ps1
  14. 5
      nupkg/push_packages.ps1

4
docs/en/Getting-Started-AspNetCore-Application.md

@ -21,7 +21,7 @@ This tutorial explains how to start ABP from scratch with minimal dependencies.
Volo.Abp.AspNetCore.Mvc is the AspNet Core MVC integration package for ABP. So, install it on your project: Volo.Abp.AspNetCore.Mvc is the AspNet Core MVC integration package for ABP. So, install it on your project:
```` ````
Install-Package Volo.Abp.AspNetCore.Mvc -Version 5.0.0-rc.1 Install-Package Volo.Abp.AspNetCore.Mvc
```` ````
## Create the First ABP Module ## Create the First ABP Module
@ -105,7 +105,7 @@ Replacing AspNet Core's DI system by Autofac and integrating to ABP is pretty ea
1. Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) package 1. Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) package
```` ````
Install-Package Volo.Abp.Autofac -Version 5.0.0-rc.1 Install-Package Volo.Abp.Autofac
```` ````
2. Add the ``AbpAutofacModule`` Dependency 2. Add the ``AbpAutofacModule`` Dependency

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs

@ -54,7 +54,7 @@ public class AbpInputTagHelperService : AbpTagHelperService<AbpInputTagHelper>
output.TagMode = TagMode.StartTagAndEndTag; output.TagMode = TagMode.StartTagAndEndTag;
output.TagName = "div"; output.TagName = "div";
LeaveOnlyGroupAttributes(context, output); LeaveOnlyGroupAttributes(context, output);
output.Attributes.AddClass("mb-3"); output.Attributes.AddClass(isCheckBox ? "mb-2" : "mb-3");
if (isCheckBox) if (isCheckBox)
{ {
output.Attributes.AddClass("form-check"); output.Attributes.AddClass("form-check");
@ -104,9 +104,9 @@ public class AbpInputTagHelperService : AbpTagHelperService<AbpInputTagHelper>
protected virtual string SurroundInnerHtmlAndGet(TagHelperContext context, TagHelperOutput output, string innerHtml, bool isCheckbox) protected virtual string SurroundInnerHtmlAndGet(TagHelperContext context, TagHelperOutput output, string innerHtml, bool isCheckbox)
{ {
return "<div class=\"" + (isCheckbox ? "mb-3 form-check" : "mb-3") + "\">" + return "<div class=\"" + (isCheckbox ? "mb-2 form-check" : "mb-3") + "\">" +
Environment.NewLine + innerHtml + Environment.NewLine + Environment.NewLine + innerHtml + Environment.NewLine +
"</div>"; "</div>";
} }
protected virtual TagHelper GetInputTagHelper(TagHelperContext context, TagHelperOutput output) protected virtual TagHelper GetInputTagHelper(TagHelperContext context, TagHelperOutput output)
@ -197,7 +197,7 @@ public class AbpInputTagHelperService : AbpTagHelperService<AbpInputTagHelper>
protected virtual void AddDisabledAttribute(TagHelperOutput inputTagHelperOutput) protected virtual void AddDisabledAttribute(TagHelperOutput inputTagHelperOutput)
{ {
if (inputTagHelperOutput.Attributes.ContainsName("disabled") == false && if (inputTagHelperOutput.Attributes.ContainsName("disabled") == false &&
(TagHelper.IsDisabled || TagHelper.AspFor.ModelExplorer.GetAttribute<DisabledInput>() != null)) (TagHelper.IsDisabled || TagHelper.AspFor.ModelExplorer.GetAttribute<DisabledInput>() != null))
{ {
inputTagHelperOutput.Attributes.Add("disabled", ""); inputTagHelperOutput.Attributes.Add("disabled", "");
} }

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/sweetalert2/abp-sweetalert2.js

@ -101,6 +101,9 @@ var abp = abp || {};
var l = abp.localization.getResource('AbpUi'); var l = abp.localization.getResource('AbpUi');
abp.libs.sweetAlert.config.confirm.title = l('AreYouSure'); abp.libs.sweetAlert.config.confirm.title = l('AreYouSure');
abp.libs.sweetAlert.config.confirm.confirmButtonText = l('Yes');
abp.libs.sweetAlert.config.confirm.denyButtonText = l('No');
abp.libs.sweetAlert.config.confirm.cancelButtonText = l('Cancel');
abp.libs.sweetAlert.config.confirm.showCancelButton = true; abp.libs.sweetAlert.config.confirm.showCancelButton = true;
abp.libs.sweetAlert.config.confirm.reverseButtons = true; abp.libs.sweetAlert.config.confirm.reverseButtons = true;
}); });

19
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs

@ -1,7 +1,11 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation;
using Volo.Abp.AspNetCore.VirtualFileSystem;
using Volo.Abp.DependencyInjection;
namespace Microsoft.Extensions.DependencyInjection; namespace Microsoft.Extensions.DependencyInjection;
@ -27,4 +31,17 @@ public static class AbpMvcBuilderExtensions
applicationParts.Add(new AssemblyPart(assembly)); applicationParts.Add(new AssemblyPart(assembly));
} }
public static void AddAbpRazorRuntimeCompilation(this IMvcCoreBuilder mvcCoreBuilder)
{
mvcCoreBuilder.AddRazorRuntimeCompilation();
mvcCoreBuilder.Services.Configure<MvcRazorRuntimeCompilationOptions>(options =>
{
options.FileProviders.Add(
new RazorViewEngineVirtualFileProvider(
mvcCoreBuilder.Services.GetSingletonInstance<IObjectAccessor<IServiceProvider>>()
)
);
});
}
} }

30
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -77,12 +77,12 @@ public class AbpAspNetCoreMvcModule : AbpModule
{ {
var statusCodes = new List<int> var statusCodes = new List<int>
{ {
(int) HttpStatusCode.Forbidden, (int) HttpStatusCode.Forbidden,
(int) HttpStatusCode.Unauthorized, (int) HttpStatusCode.Unauthorized,
(int) HttpStatusCode.BadRequest, (int) HttpStatusCode.BadRequest,
(int) HttpStatusCode.NotFound, (int) HttpStatusCode.NotFound,
(int) HttpStatusCode.NotImplemented, (int) HttpStatusCode.NotImplemented,
(int) HttpStatusCode.InternalServerError (int) HttpStatusCode.InternalServerError
}; };
options.SupportedResponseTypes.AddIfNotContains(statusCodes.Select(statusCode => new ApiResponseType options.SupportedResponseTypes.AddIfNotContains(statusCodes.Select(statusCode => new ApiResponseType
@ -119,7 +119,6 @@ public class AbpAspNetCoreMvcModule : AbpModule
); );
var mvcBuilder = context.Services.AddMvc() var mvcBuilder = context.Services.AddMvc()
.AddRazorRuntimeCompilation()
.AddDataAnnotationsLocalization(options => .AddDataAnnotationsLocalization(options =>
{ {
options.DataAnnotationLocalizerProvider = (type, factory) => options.DataAnnotationLocalizerProvider = (type, factory) =>
@ -134,21 +133,18 @@ public class AbpAspNetCoreMvcModule : AbpModule
} }
return factory.CreateDefaultOrNull() ?? return factory.CreateDefaultOrNull() ??
factory.Create(type); factory.Create(type);
}; };
}) })
.AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it. .AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it.
mvcCoreBuilder.AddAbpHybridJson(); if (context.Services.GetHostingEnvironment().IsDevelopment() &&
context.Services.ExecutePreConfiguredActions<AbpAspNetCoreMvcOptions>().EnableRazorRuntimeCompilationOnDevelopment)
Configure<MvcRazorRuntimeCompilationOptions>(options =>
{ {
options.FileProviders.Add( mvcCoreBuilder.AddAbpRazorRuntimeCompilation();
new RazorViewEngineVirtualFileProvider( }
context.Services.GetSingletonInstance<IObjectAccessor<IServiceProvider>>()
) mvcCoreBuilder.AddAbpHybridJson();
);
});
context.Services.ExecutePreConfiguredActions(mvcBuilder); context.Services.ExecutePreConfiguredActions(mvcBuilder);

3
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs

@ -14,10 +14,13 @@ public class AbpAspNetCoreMvcOptions
public bool AutoModelValidation { get; set; } public bool AutoModelValidation { get; set; }
public bool EnableRazorRuntimeCompilationOnDevelopment { get; set; }
public AbpAspNetCoreMvcOptions() public AbpAspNetCoreMvcOptions()
{ {
ConventionalControllers = new AbpConventionalControllerOptions(); ConventionalControllers = new AbpConventionalControllerOptions();
IgnoredControllersOnModelExclusion = new HashSet<Type>(); IgnoredControllersOnModelExclusion = new HashSet<Type>();
AutoModelValidation = true; AutoModelValidation = true;
EnableRazorRuntimeCompilationOnDevelopment = true;
} }
} }

2
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo.Abp.BackgroundWorkers.Hangfire.csproj

@ -16,7 +16,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Volo.Abp.BackgroundWorkers\Volo.Abp.BackgroundWorkers.csproj" /> <ProjectReference Include="..\Volo.Abp.BackgroundWorkers\Volo.Abp.BackgroundWorkers.csproj" />
<ProjectReference Include="..\Volo.Abp.Hangfire\Volo.Abp.Hangfire.csproj" /> <ProjectReference Include="..\Volo.Abp.HangFire\Volo.Abp.HangFire.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

6
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlerBase.cs

@ -15,7 +15,7 @@ namespace Volo.Abp.Cli.Bundling;
public abstract class BundlerBase : IBundler, ITransientDependency public abstract class BundlerBase : IBundler, ITransientDependency
{ {
private static string[] _minFileSuffixes = { "min", "prod" }; private static string[] _minFileSuffixes = {"min", "prod"};
protected IMinifier Minifier { get; } protected IMinifier Minifier { get; }
public ILogger<BundlerBase> Logger { get; set; } public ILogger<BundlerBase> Logger { get; set; }
@ -38,7 +38,7 @@ public abstract class BundlerBase : IBundler, ITransientDependency
var bundledContent = BundleFiles(options, bundleFileDefinitions); var bundledContent = BundleFiles(options, bundleFileDefinitions);
File.WriteAllText(bundleFilePath, bundledContent); File.WriteAllText(bundleFilePath, bundledContent);
return GenerateDefinition(bundleFilePath, fileDefinitionsExcludingFromBundle); return GenerateDefinition(bundleFilePath,fileDefinitionsExcludingFromBundle);
} }
private bool IsMinFile(string fileName, string content) private bool IsMinFile(string fileName, string content)
@ -85,7 +85,7 @@ public abstract class BundlerBase : IBundler, ITransientDependency
{ {
var pathFragments = definition.Source.Split('/').ToList(); var pathFragments = definition.Source.Split('/').ToList();
var basePath = $"{pathFragments[0]}/{pathFragments[1]}"; var basePath = $"{pathFragments[0]}/{pathFragments[1]}";
var path = contentRoots.FirstOrDefault(x => x.IndexOf($"\\{pathFragments[1]}\\", StringComparison.OrdinalIgnoreCase) > 0); var path = contentRoots.FirstOrDefault(x => x.IndexOf(Path.DirectorySeparatorChar + pathFragments[1] + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) > 0);
if (path == null) if (path == null)
{ {
throw new AbpException("Not found: " + definition.Source); throw new AbpException("Not found: " + definition.Source);

30
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj

@ -40,36 +40,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Update="Volo\Abp\AspNetCore\Mvc\Uow\UnitOfWorkTestPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="Volo\Abp\AspNetCore\Mvc\Auditing\AuditTestPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="Volo\Abp\AspNetCore\Mvc\Features\FeatureTestPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="Volo\Abp\AspNetCore\Mvc\ExceptionHandling\ExceptionTestPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="Volo\Abp\AspNetCore\Mvc\Authorization\AuthTestPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="Volo\Abp\AspNetCore\Mvc\GlobalFeature\DisabledGlobalFeatureTestPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="Volo\Abp\AspNetCore\Mvc\GlobalFeature\EnabledGlobalFeatureTestPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<!-- https://github.com/NuGet/Home/issues/4412. --> <!-- https://github.com/NuGet/Home/issues/4412. -->
<Target Name="CopyDepsFiles" AfterTargets="Build" Condition="'$(TargetFramework)'!=''"> <Target Name="CopyDepsFiles" AfterTargets="Build" Condition="'$(TargetFramework)'!=''">

10
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Security.Claims; using System.Security.Claims;
using Localization.Resources.AbpUi; using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Authorization; using Volo.Abp.AspNetCore.Mvc.Authorization;
@ -69,12 +70,12 @@ public class AbpAspNetCoreMvcTestModule : AbpModule
options.AddPolicy("TestPermission1_And_TestPermission2", policy => options.AddPolicy("TestPermission1_And_TestPermission2", policy =>
{ {
policy.Requirements.Add(new PermissionsRequirement(new[] { "TestPermission1", "TestPermission2" }, requiresAll: true)); policy.Requirements.Add(new PermissionsRequirement(new []{"TestPermission1", "TestPermission2"}, requiresAll: true));
}); });
options.AddPolicy("TestPermission1_Or_TestPermission2", policy => options.AddPolicy("TestPermission1_Or_TestPermission2", policy =>
{ {
policy.Requirements.Add(new PermissionsRequirement(new[] { "TestPermission1", "TestPermission2" }, requiresAll: false)); policy.Requirements.Add(new PermissionsRequirement(new []{"TestPermission1", "TestPermission2"}, requiresAll: false));
}); });
}); });
@ -115,6 +116,11 @@ public class AbpAspNetCoreMvcTestModule : AbpModule
options.RootDirectory = "/Volo/Abp/AspNetCore/Mvc"; options.RootDirectory = "/Volo/Abp/AspNetCore/Mvc";
}); });
Configure<RazorViewEngineOptions>(options =>
{
options.ViewLocationFormats.Add("/Volo/Abp/AspNetCore/App/Views/{1}/{0}.cshtml");
});
Configure<AbpClaimsMapOptions>(options => Configure<AbpClaimsMapOptions>(options =>
{ {
options.Maps.Add("SerialNumber", () => ClaimTypes.SerialNumber); options.Maps.Add("SerialNumber", () => ClaimTypes.SerialNumber);

2
modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs

@ -137,7 +137,7 @@ namespace Volo.Docs.Areas.Documents.TagHelpers
} }
else if (node.LastSignificantUpdateTime != null && node.LastSignificantUpdateTime + TimeSpan.FromDays(14) > DateTime.Now) else if (node.LastSignificantUpdateTime != null && node.LastSignificantUpdateTime + TimeSpan.FromDays(14) > DateTime.Now)
{ {
var updBadge = sb.Append("<span class='badge bg-light ms-2' title=\"").Append(_localizer["UpdatedExplanation"]).Append("\">").Append(_localizer["Upd"]).Append("</span>").ToString(); var updBadge = sb.Append("<span class='badge bg-primary ms-2' title=\"").Append(_localizer["UpdatedExplanation"]).Append("\">").Append(_localizer["Upd"]).Append("</span>").ToString();
badgeStringBuilder.Append(updBadge); badgeStringBuilder.Append(updBadge);
} }
} }

35
modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs

@ -1,9 +1,9 @@
using System.Threading.Tasks; using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Devices;
using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.Grants;
using Volo.Abp.Timing;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace Volo.Abp.IdentityServer.Tokens; namespace Volo.Abp.IdentityServer.Tokens;
@ -12,43 +12,32 @@ public class TokenCleanupService : ITransientDependency
{ {
protected IPersistentGrantRepository PersistentGrantRepository { get; } protected IPersistentGrantRepository PersistentGrantRepository { get; }
protected IDeviceFlowCodesRepository DeviceFlowCodesRepository { get; } protected IDeviceFlowCodesRepository DeviceFlowCodesRepository { get; }
protected IClock Clock { get; }
protected TokenCleanupOptions Options { get; } protected TokenCleanupOptions Options { get; }
public TokenCleanupService( public TokenCleanupService(
IPersistentGrantRepository persistentGrantRepository, IPersistentGrantRepository persistentGrantRepository,
IDeviceFlowCodesRepository deviceFlowCodesRepository, IDeviceFlowCodesRepository deviceFlowCodesRepository,
IClock clock,
IOptions<TokenCleanupOptions> options) IOptions<TokenCleanupOptions> options)
{ {
PersistentGrantRepository = persistentGrantRepository; PersistentGrantRepository = persistentGrantRepository;
DeviceFlowCodesRepository = deviceFlowCodesRepository; DeviceFlowCodesRepository = deviceFlowCodesRepository;
Clock = clock;
Options = options.Value; Options = options.Value;
} }
public virtual async Task CleanAsync() public virtual async Task CleanAsync()
{ {
await RemoveGrantsAsync() await RemoveGrantsAsync();
;
await RemoveDeviceCodesAsync(); await RemoveDeviceCodesAsync();
} }
[UnitOfWork] [UnitOfWork]
protected virtual async Task RemoveGrantsAsync() protected virtual async Task RemoveGrantsAsync()
{ {
for (int i = 0; i < Options.CleanupLoopCount; i++) for (var i = 0; i < Options.CleanupLoopCount; i++)
{ {
var persistentGrants = await PersistentGrantRepository var persistentGrants = await PersistentGrantRepository.GetListByExpirationAsync(DateTime.UtcNow, Options.CleanupBatchSize);
.GetListByExpirationAsync(Clock.Now, Options.CleanupBatchSize);
//TODO: Can be optimized if the repository implements the batch deletion await PersistentGrantRepository.DeleteManyAsync(persistentGrants);
foreach (var persistentGrant in persistentGrants)
{
await PersistentGrantRepository
.DeleteAsync(persistentGrant);
}
//No need to continue to query if it gets more than max items. //No need to continue to query if it gets more than max items.
if (persistentGrants.Count < Options.CleanupBatchSize) if (persistentGrants.Count < Options.CleanupBatchSize)
@ -60,17 +49,11 @@ public class TokenCleanupService : ITransientDependency
protected virtual async Task RemoveDeviceCodesAsync() protected virtual async Task RemoveDeviceCodesAsync()
{ {
for (int i = 0; i < Options.CleanupLoopCount; i++) for (var i = 0; i < Options.CleanupLoopCount; i++)
{ {
var deviceFlowCodeses = await DeviceFlowCodesRepository var deviceFlowCodeses = await DeviceFlowCodesRepository.GetListByExpirationAsync(DateTime.UtcNow, Options.CleanupBatchSize);
.GetListByExpirationAsync(Clock.Now, Options.CleanupBatchSize);
//TODO: Can be optimized if the repository implements the batch deletion await DeviceFlowCodesRepository.DeleteManyAsync(deviceFlowCodeses);
foreach (var deviceFlowCodes in deviceFlowCodeses)
{
await DeviceFlowCodesRepository
.DeleteAsync(deviceFlowCodes);
}
//No need to continue to query if it gets more than max items. //No need to continue to query if it gets more than max items.
if (deviceFlowCodeses.Count < Options.CleanupBatchSize) if (deviceFlowCodeses.Count < Options.CleanupBatchSize)

2
nupkg/common.ps1

@ -266,7 +266,7 @@ $projects = (
"modules/docs/src/Volo.Docs.HttpApi.Client", "modules/docs/src/Volo.Docs.HttpApi.Client",
"modules/docs/src/Volo.Docs.HttpApi", "modules/docs/src/Volo.Docs.HttpApi",
"modules/docs/src/Volo.Docs.MongoDB", "modules/docs/src/Volo.Docs.MongoDB",
"modules/docs/src/Volo.Docs.Web",, "modules/docs/src/Volo.Docs.Web",
"studio/source-codes/Volo.Docs.SourceCode", "studio/source-codes/Volo.Docs.SourceCode",
# modules/feature-management # modules/feature-management

5
nupkg/push_packages.ps1

@ -9,6 +9,7 @@ $version = $commonPropsXml.Project.PropertyGroup.Version
# Publish all packages # Publish all packages
$i = 0 $i = 0
$errorCount = 0 $errorCount = 0
$totalProjectsCount = $projects.length
$nugetUrl = "https://api.nuget.org/v3/index.json" $nugetUrl = "https://api.nuget.org/v3/index.json"
Set-Location $packFolder Set-Location $packFolder
@ -19,12 +20,12 @@ foreach($project in $projects) {
$nugetPackageName = $projectName + "." + $version + ".nupkg" $nugetPackageName = $projectName + "." + $version + ".nupkg"
$nugetPackageExists = Test-Path $nugetPackageName -PathType leaf $nugetPackageExists = Test-Path $nugetPackageName -PathType leaf
Write-Host ("-----===[ $i / " + $projects.length + " - " + $nugetPackageName + " ]===-----") Write-Info "[$i / $totalProjectsCount] - Pushing: $nugetPackageName"
if ($nugetPackageExists) if ($nugetPackageExists)
{ {
dotnet nuget push $nugetPackageName --skip-duplicate -s $nugetUrl --api-key "$apiKey" dotnet nuget push $nugetPackageName --skip-duplicate -s $nugetUrl --api-key "$apiKey"
Write-Host ("Deleting package from local: " + $nugetPackageName) #Write-Host ("Deleting package from local: " + $nugetPackageName)
#Remove-Item $nugetPackageName -Force #Remove-Item $nugetPackageName -Force
} }
else else

Loading…
Cancel
Save