Browse Source

Merge branch 'rel-5.0' of https://github.com/abpframework/abp into rel-5.0

pull/10969/head
Alper Ebicoglu 5 years ago
parent
commit
422f5c68ff
  1. 23
      framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs
  2. 16
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  3. 3
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
  4. 2
      framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo.Abp.EntityFrameworkCore.Oracle.csproj
  5. 30
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
  6. 6
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
  7. 6
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.css
  8. 2
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.min.css
  9. 4
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.scss
  10. 37
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs
  11. 2
      nupkg/common.ps1

23
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.Reflection;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation;
using Volo.Abp.AspNetCore.VirtualFileSystem;
using Volo.Abp.DependencyInjection;
namespace Microsoft.Extensions.DependencyInjection
{
@ -11,12 +15,12 @@ namespace Microsoft.Extensions.DependencyInjection
{
mvcBuilder.PartManager.ApplicationParts.AddIfNotContains(assembly);
}
public static void AddApplicationPartIfNotExists(this IMvcCoreBuilder mvcCoreBuilder, Assembly assembly)
{
mvcCoreBuilder.PartManager.ApplicationParts.AddIfNotContains(assembly);
}
public static void AddIfNotContains(this IList<ApplicationPart> applicationParts, Assembly assembly)
{
if (applicationParts.Any(
@ -27,5 +31,18 @@ namespace Microsoft.Extensions.DependencyInjection
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>>()
)
);
});
}
}
}

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

@ -119,7 +119,6 @@ namespace Volo.Abp.AspNetCore.Mvc
);
var mvcBuilder = context.Services.AddMvc()
.AddRazorRuntimeCompilation()
.AddDataAnnotationsLocalization(options =>
{
options.DataAnnotationLocalizerProvider = (type, factory) =>
@ -139,16 +138,13 @@ namespace Volo.Abp.AspNetCore.Mvc
})
.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();
Configure<MvcRazorRuntimeCompilationOptions>(options =>
if (context.Services.GetHostingEnvironment().IsDevelopment() &&
context.Services.ExecutePreConfiguredActions<AbpAspNetCoreMvcOptions>().EnableRazorRuntimeCompilationOnDevelopment)
{
options.FileProviders.Add(
new RazorViewEngineVirtualFileProvider(
context.Services.GetSingletonInstance<IObjectAccessor<IServiceProvider>>()
)
);
});
mvcCoreBuilder.AddAbpRazorRuntimeCompilation();
}
mvcCoreBuilder.AddAbpHybridJson();
context.Services.ExecutePreConfiguredActions(mvcBuilder);

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

@ -14,11 +14,14 @@ namespace Volo.Abp.AspNetCore.Mvc
public bool AutoModelValidation { get; set; }
public bool EnableRazorRuntimeCompilationOnDevelopment { get; set; }
public AbpAspNetCoreMvcOptions()
{
ConventionalControllers = new AbpConventionalControllerOptions();
IgnoredControllersOnModelExclusion = new HashSet<Type>();
AutoModelValidation = true;
EnableRazorRuntimeCompilationOnDevelopment = true;
}
}
}

2
framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo.Abp.EntityFrameworkCore.Oracle.csproj

@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.4" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

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

@ -40,36 +40,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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. -->
<Target Name="CopyDepsFiles" AfterTargets="Build" Condition="'$(TargetFramework)'!=''">

6
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 Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Authorization;
@ -115,6 +116,11 @@ namespace 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 =>
{
options.Maps.Add("SerialNumber", () => ClaimTypes.SerialNumber);

6
modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.css

@ -58,7 +58,11 @@ a {
.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-select:focus, .docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-select:active, .docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-select:hover, .docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-select:visited, .docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-select:focus, .docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:active, .docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:hover, .docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:visited {
box-shadow: none; }
.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-select {
padding: 0 10px 2px 6px; }
padding: 0 10px 2px 6px;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
background-repeat: no-repeat !important;
background-position: right 0.75rem center !important;
background-size: 16px 12px !important; }
.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-filter {
padding: 0 1rem;
margin: .5rem 0;

2
modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.min.css

File diff suppressed because one or more lines are too long

4
modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.scss

@ -83,6 +83,10 @@ a { text-decoration: none;}
select.form-select {
padding: 0 10px 2px 6px;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
background-repeat: no-repeat !important;
background-position: right 0.75rem center !important;
background-size: 16px 12px !important;
}
}
}

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

2
nupkg/common.ps1

@ -135,7 +135,7 @@ $projects = (
"framework/src/Volo.Abp.Emailing",
"framework/src/Volo.Abp.EntityFrameworkCore",
"framework/src/Volo.Abp.EntityFrameworkCore.MySQL",
# "framework/src/Volo.Abp.EntityFrameworkCore.Oracle",
"framework/src/Volo.Abp.EntityFrameworkCore.Oracle",
# "framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart",
"framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql",
"framework/src/Volo.Abp.EntityFrameworkCore.Sqlite",

Loading…
Cancel
Save