From 75e458e48c64670f2133d1397106bd491b1ae765 Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Mon, 21 Dec 2020 15:07:30 +0300 Subject: [PATCH 001/119] source code link added to post --- .../POST.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/POST.md b/docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/POST.md index 7b1ae846af..02cef11a2e 100644 --- a/docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/POST.md +++ b/docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/POST.md @@ -260,7 +260,7 @@ import { MatFormFieldModule } from "@angular/material/form-field"; import { MatInputModule } from "@angular/material/input"; import { MatSelectModule } from "@angular/material/select"; import { MatIconModule } from "@angular/material/icon"; -import { MatNativeDateModule } from '@angular/material/core'; +import { MatNativeDateModule } from "@angular/material/core"; @NgModule({ imports: [ @@ -1576,6 +1576,10 @@ Final UI looks as shown below: ![Author With Books](./author-with-books.gif) +## The Source Code + +You can download the source code from [here](https://github.com/abpframework/abp-samples/tree/master/AcmeBookStoreAngularMaterial). + ## Conclusion We implemented Angular Material Components to our angular application which was created with ABP Framework. There is no blocker case of using angular libraries with the ABP framework. From 43172fc2fbc1f6eb63077874937435532f1751d4 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 25 Dec 2020 15:27:30 +0800 Subject: [PATCH 002/119] Reduce unnecessary dependency injection. --- .../Mvc/Auditing/AbpAuditActionFilter.cs | 22 ++---- .../Mvc/Auditing/AbpAuditPageFilter.cs | 26 +++---- .../ExceptionHandling/AbpExceptionFilter.cs | 41 ++++------- .../AbpExceptionPageFilter.cs | 40 ++++------ .../Mvc/Features/AbpFeatureActionFilter.cs | 13 +--- .../Mvc/Features/AbpFeaturePageFilter.cs | 14 +--- .../GlobalFeatureActionFilter.cs | 14 ++-- .../GlobalFeatures/GlobalFeaturePageFilter.cs | 14 ++-- .../Mvc/Json/AbpHybridJsonInputFormatter.cs | 15 +++- .../Mvc/Json/AbpHybridJsonOptionsSetup.cs | 73 +++++++++++++++++++ .../Mvc/Json/AbpHybridJsonOutputFormatter.cs | 14 +++- .../Mvc/Json/MvcCoreBuilderExtensions.cs | 67 +---------------- .../AspNetCore/Mvc/Uow/AbpUowActionFilter.cs | 27 +++---- .../AspNetCore/Mvc/Uow/AbpUowPageFilter.cs | 26 +++---- .../Validation/AbpValidationActionFilter.cs | 10 +-- 15 files changed, 184 insertions(+), 232 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOptionsSetup.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs index 0ee62f9b65..2e05204304 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.Aspects; using Volo.Abp.Auditing; @@ -12,17 +13,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing { public class AbpAuditActionFilter : IAsyncActionFilter, ITransientDependency { - protected AbpAuditingOptions Options { get; } - private readonly IAuditingHelper _auditingHelper; - private readonly IAuditingManager _auditingManager; - - public AbpAuditActionFilter(IOptions options, IAuditingHelper auditingHelper, IAuditingManager auditingManager) - { - Options = options.Value; - _auditingHelper = auditingHelper; - _auditingManager = auditingManager; - } - public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { if (!ShouldSaveAudit(context, out var auditLog, out var auditLogAction)) @@ -63,7 +53,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing auditLog = null; auditLogAction = null; - if (!Options.IsEnabled) + var options = context.HttpContext.RequestServices.GetRequiredService>().Value; + if (!options.IsEnabled) { return false; } @@ -73,19 +64,20 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing return false; } - var auditLogScope = _auditingManager.Current; + var auditLogScope = context.HttpContext.RequestServices.GetRequiredService().Current; if (auditLogScope == null) { return false; } - if (!_auditingHelper.ShouldSaveAudit(context.ActionDescriptor.GetMethodInfo(), true)) + var auditingHelper = context.HttpContext.RequestServices.GetRequiredService(); + if (!auditingHelper.ShouldSaveAudit(context.ActionDescriptor.GetMethodInfo(), true)) { return false; } auditLog = auditLogScope.Log; - auditLogAction = _auditingHelper.CreateAuditLogAction( + auditLogAction = auditingHelper.CreateAuditLogAction( auditLog, context.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.AsType(), context.ActionDescriptor.AsControllerActionDescriptor().MethodInfo, diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs index 6e9996574c..70fac063b5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.Aspects; using Volo.Abp.Auditing; @@ -12,22 +13,11 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing { public class AbpAuditPageFilter : IAsyncPageFilter, ITransientDependency { - protected AbpAuditingOptions Options { get; } - private readonly IAuditingHelper _auditingHelper; - private readonly IAuditingManager _auditingManager; - - public AbpAuditPageFilter(IOptions options, IAuditingHelper auditingHelper, IAuditingManager auditingManager) - { - Options = options.Value; - _auditingHelper = auditingHelper; - _auditingManager = auditingManager; - } - public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) { return Task.CompletedTask; } - + public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next) { if (context.HandlerMethod == null || !ShouldSaveAudit(context, out var auditLog, out var auditLogAction)) @@ -68,7 +58,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing auditLog = null; auditLogAction = null; - if (!Options.IsEnabled) + var options = context.HttpContext.RequestServices.GetRequiredService>().Value; + if (!options.IsEnabled) { return false; } @@ -78,19 +69,20 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing return false; } - var auditLogScope = _auditingManager.Current; + var auditLogScope = context.HttpContext.RequestServices.GetRequiredService().Current; if (auditLogScope == null) { return false; } - if (!_auditingHelper.ShouldSaveAudit(context.HandlerMethod.MethodInfo, true)) + var auditingHelper = context.HttpContext.RequestServices.GetRequiredService(); + if (!auditingHelper.ShouldSaveAudit(context.HandlerMethod.MethodInfo, true)) { return false; } auditLog = auditLogScope.Log; - auditLogAction = _auditingHelper.CreateAuditLogAction( + auditLogAction = auditingHelper.CreateAuditLogAction( auditLog, context.HandlerMethod.GetType(), context.HandlerMethod.MethodInfo, @@ -100,4 +92,4 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing return true; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs index c6f353b876..2a28d2cc0a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs @@ -19,27 +19,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling { public class AbpExceptionFilter : IAsyncExceptionFilter, ITransientDependency { - public ILogger Logger { get; set; } - - private readonly IExceptionToErrorInfoConverter _errorInfoConverter; - private readonly IHttpExceptionStatusCodeFinder _statusCodeFinder; - private readonly IJsonSerializer _jsonSerializer; - private readonly AbpExceptionHandlingOptions _exceptionHandlingOptions; - - public AbpExceptionFilter( - IExceptionToErrorInfoConverter errorInfoConverter, - IHttpExceptionStatusCodeFinder statusCodeFinder, - IJsonSerializer jsonSerializer, - IOptions exceptionHandlingOptions) - { - _errorInfoConverter = errorInfoConverter; - _statusCodeFinder = statusCodeFinder; - _jsonSerializer = jsonSerializer; - _exceptionHandlingOptions = exceptionHandlingOptions.Value; - - Logger = NullLogger.Instance; - } - public async Task OnExceptionAsync(ExceptionContext context) { if (!ShouldHandleException(context)) @@ -78,9 +57,14 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling //TODO: Trigger an AbpExceptionHandled event or something like that. context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); - context.HttpContext.Response.StatusCode = (int)_statusCodeFinder.GetStatusCode(context.HttpContext, context.Exception); + context.HttpContext.Response.StatusCode = (int) context.HttpContext.RequestServices + .GetRequiredService() + .GetStatusCode(context.HttpContext, context.Exception); - var remoteServiceErrorInfo = _errorInfoConverter.Convert(context.Exception, _exceptionHandlingOptions.SendExceptionsDetailsToClients); + var remoteServiceErrorInfo = context.HttpContext.RequestServices + .GetRequiredService().Convert(context.Exception, + context.HttpContext.RequestServices.GetRequiredService>() + .Value.SendExceptionsDetailsToClients); context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo)); @@ -88,10 +72,15 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling var remoteServiceErrorInfoBuilder = new StringBuilder(); remoteServiceErrorInfoBuilder.AppendLine($"---------- {nameof(RemoteServiceErrorInfo)} ----------"); - remoteServiceErrorInfoBuilder.AppendLine( _jsonSerializer.Serialize(remoteServiceErrorInfo, indented: true)); - Logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString()); + remoteServiceErrorInfoBuilder.AppendLine(context.HttpContext.RequestServices + .GetRequiredService().Serialize(remoteServiceErrorInfo, indented: true)); + + var logger = context.HttpContext.RequestServices.GetService>() ?? + NullLogger.Instance; + + logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString()); - Logger.LogException(context.Exception, logLevel); + logger.LogException(context.Exception, logLevel); await context.HttpContext .RequestServices diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs index 9ef0378909..a91980043b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs @@ -19,27 +19,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling { public class AbpExceptionPageFilter : IAsyncPageFilter, ITransientDependency { - public ILogger Logger { get; set; } - - private readonly IExceptionToErrorInfoConverter _errorInfoConverter; - private readonly IHttpExceptionStatusCodeFinder _statusCodeFinder; - private readonly IJsonSerializer _jsonSerializer; - private readonly AbpExceptionHandlingOptions _exceptionHandlingOptions; - - public AbpExceptionPageFilter( - IExceptionToErrorInfoConverter errorInfoConverter, - IHttpExceptionStatusCodeFinder statusCodeFinder, - IJsonSerializer jsonSerializer, - IOptions exceptionHandlingOptions) - { - _errorInfoConverter = errorInfoConverter; - _statusCodeFinder = statusCodeFinder; - _jsonSerializer = jsonSerializer; - _exceptionHandlingOptions = exceptionHandlingOptions.Value; - - Logger = NullLogger.Instance; - } - public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) { return Task.CompletedTask; @@ -90,9 +69,14 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling //TODO: Trigger an AbpExceptionHandled event or something like that. context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); - context.HttpContext.Response.StatusCode = (int)_statusCodeFinder.GetStatusCode(context.HttpContext, context.Exception); + context.HttpContext.Response.StatusCode = (int) context.HttpContext.RequestServices + .GetRequiredService() + .GetStatusCode(context.HttpContext, context.Exception); - var remoteServiceErrorInfo = _errorInfoConverter.Convert(context.Exception, _exceptionHandlingOptions.SendExceptionsDetailsToClients); + var remoteServiceErrorInfo = context.HttpContext.RequestServices + .GetRequiredService().Convert(context.Exception, + context.HttpContext.RequestServices.GetRequiredService>() + .Value.SendExceptionsDetailsToClients); context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo)); @@ -100,10 +84,14 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling var remoteServiceErrorInfoBuilder = new StringBuilder(); remoteServiceErrorInfoBuilder.AppendLine($"---------- {nameof(RemoteServiceErrorInfo)} ----------"); - remoteServiceErrorInfoBuilder.AppendLine( _jsonSerializer.Serialize(remoteServiceErrorInfo, indented: true)); - Logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString()); + remoteServiceErrorInfoBuilder.AppendLine(context.HttpContext.RequestServices + .GetRequiredService().Serialize(remoteServiceErrorInfo, indented: true)); + + var logger = context.HttpContext.RequestServices.GetService>() ?? + NullLogger.Instance; + logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString()); - Logger.LogException(context.Exception, logLevel); + logger.LogException(context.Exception, logLevel); await context.HttpContext .RequestServices diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs index 577acda339..82cc65ff0b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc.Filters; -using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.Features; @@ -10,15 +10,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { public class AbpFeatureActionFilter : IAsyncActionFilter, ITransientDependency { - private readonly IMethodInvocationFeatureCheckerService _methodInvocationAuthorizationService; - - public AbpFeatureActionFilter(IMethodInvocationFeatureCheckerService methodInvocationAuthorizationService) - { - _methodInvocationAuthorizationService = methodInvocationAuthorizationService; - } - public async Task OnActionExecutionAsync( - ActionExecutingContext context, + ActionExecutingContext context, ActionExecutionDelegate next) { if (!context.ActionDescriptor.IsControllerAction()) @@ -31,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features using (AbpCrossCuttingConcerns.Applying(context.Controller, AbpCrossCuttingConcerns.FeatureChecking)) { - await _methodInvocationAuthorizationService.CheckAsync( + await context.HttpContext.RequestServices.GetRequiredService().CheckAsync( new MethodInvocationFeatureCheckerContext(methodInfo) ); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs index 83e26ace9c..3f54597c2a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.Features; @@ -9,18 +10,11 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { public class AbpFeaturePageFilter : IAsyncPageFilter, ITransientDependency { - private readonly IMethodInvocationFeatureCheckerService _methodInvocationAuthorizationService; - - public AbpFeaturePageFilter(IMethodInvocationFeatureCheckerService methodInvocationAuthorizationService) - { - _methodInvocationAuthorizationService = methodInvocationAuthorizationService; - } - public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) { return Task.CompletedTask; } - + public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next) { if (context.HandlerMethod == null || !context.ActionDescriptor.IsPageAction()) @@ -33,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features using (AbpCrossCuttingConcerns.Applying(context.HandlerInstance, AbpCrossCuttingConcerns.FeatureChecking)) { - await _methodInvocationAuthorizationService.CheckAsync( + await context.HttpContext.RequestServices.GetRequiredService().CheckAsync( new MethodInvocationFeatureCheckerContext(methodInfo) ); @@ -41,4 +35,4 @@ namespace Volo.Abp.AspNetCore.Mvc.Features } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs index e3fa489115..f0f08fad16 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.DependencyInjection; @@ -13,13 +14,6 @@ namespace Volo.Abp.AspNetCore.Mvc.GlobalFeatures { public class GlobalFeatureActionFilter : IAsyncActionFilter, ITransientDependency { - public ILogger Logger { get; set; } - - public GlobalFeatureActionFilter() - { - Logger = NullLogger.Instance; - } - public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { if (!context.ActionDescriptor.IsControllerAction()) @@ -30,7 +24,11 @@ namespace Volo.Abp.AspNetCore.Mvc.GlobalFeatures if (!IsGlobalFeatureEnabled(context.Controller.GetType(), out var attribute)) { - Logger.LogWarning($"The '{context.Controller.GetType().FullName}' controller needs to enable '{attribute.Name}' feature."); + var logger = + context.HttpContext.RequestServices.GetRequiredService>() ?? + NullLogger.Instance; + + logger.LogWarning($"The '{context.Controller.GetType().FullName}' controller needs to enable '{attribute.Name}' feature."); context.Result = new NotFoundResult(); return; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs index d29c44b4af..18c56ab698 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.DependencyInjection; @@ -13,13 +14,6 @@ namespace Volo.Abp.AspNetCore.Mvc.GlobalFeatures { public class GlobalFeaturePageFilter: IAsyncPageFilter, ITransientDependency { - public ILogger Logger { get; set; } - - public GlobalFeaturePageFilter() - { - Logger = NullLogger.Instance; - } - public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) { return Task.CompletedTask; @@ -35,7 +29,11 @@ namespace Volo.Abp.AspNetCore.Mvc.GlobalFeatures if (!IsGlobalFeatureEnabled(context.HandlerInstance.GetType(), out var attribute)) { - Logger.LogWarning($"The '{context.HandlerInstance.GetType().FullName}' page needs to enable '{attribute.Name}' feature."); + var logger = + context.HttpContext.RequestServices.GetRequiredService>() ?? + NullLogger.Instance; + + logger.LogWarning($"The '{context.HandlerInstance.GetType().FullName}' page needs to enable '{attribute.Name}' feature."); context.Result = new NotFoundResult(); return; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonInputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonInputFormatter.cs index bd2ade69ad..8c0277321e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonInputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonInputFormatter.cs @@ -8,8 +8,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Json { public class AbpHybridJsonInputFormatter : TextInputFormatter, IInputFormatterExceptionPolicy { - public AbpHybridJsonInputFormatter() + private readonly SystemTextJsonInputFormatter _systemTextJsonInputFormatter; + private readonly NewtonsoftJsonInputFormatter _newtonsoftJsonInputFormatter; + + public AbpHybridJsonInputFormatter(SystemTextJsonInputFormatter systemTextJsonInputFormatter, NewtonsoftJsonInputFormatter newtonsoftJsonInputFormatter) { + _systemTextJsonInputFormatter = systemTextJsonInputFormatter; + _newtonsoftJsonInputFormatter = newtonsoftJsonInputFormatter; + SupportedEncodings.Add(UTF8EncodingWithoutBOM); SupportedEncodings.Add(UTF16EncodingLittleEndian); @@ -18,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Json SupportedMediaTypes.Add(MediaTypeHeaderValues.ApplicationAnyJsonSyntax); } - public async override Task ReadRequestBodyAsync(InputFormatterContext context, Encoding encoding) + public override async Task ReadRequestBodyAsync(InputFormatterContext context, Encoding encoding) { return await GetTextInputFormatter(context).ReadRequestBodyAsync(context, encoding); } @@ -26,12 +32,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Json protected virtual TextInputFormatter GetTextInputFormatter(InputFormatterContext context) { var typesMatcher = context.HttpContext.RequestServices.GetRequiredService(); + if (!typesMatcher.Match(context.ModelType)) { - return context.HttpContext.RequestServices.GetRequiredService(); + return _systemTextJsonInputFormatter; } - return context.HttpContext.RequestServices.GetRequiredService(); + return _newtonsoftJsonInputFormatter; } public virtual InputFormatterExceptionPolicy ExceptionPolicy => InputFormatterExceptionPolicy.MalformedInputExceptions; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOptionsSetup.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOptionsSetup.cs new file mode 100644 index 0000000000..c0987e8f76 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOptionsSetup.cs @@ -0,0 +1,73 @@ +using System.Buffers; +using System.Text.Encodings.Web; +using System.Text.Json; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.ObjectPool; +using Microsoft.Extensions.Options; + +namespace Volo.Abp.AspNetCore.Mvc.Json +{ + public class AbpHybridJsonOptionsSetup : IConfigureOptions + { + private readonly IOptions _jsonOptions; + private readonly IOptions _mvcNewtonsoftJsonOptions; + private readonly ILoggerFactory _loggerFactory; + private readonly ArrayPool _charPool; + private readonly ObjectPoolProvider _objectPoolProvider; + + public AbpHybridJsonOptionsSetup( + IOptions jsonOptions, + IOptions mvcNewtonsoftJsonOptions, + ILoggerFactory loggerFactory, + ArrayPool charPool, + ObjectPoolProvider objectPoolProvider) + { + _jsonOptions = jsonOptions; + _mvcNewtonsoftJsonOptions = mvcNewtonsoftJsonOptions; + _loggerFactory = loggerFactory; + _charPool = charPool; + _objectPoolProvider = objectPoolProvider; + } + + public void Configure(MvcOptions options) + { + var systemTextJsonInputFormatter = new SystemTextJsonInputFormatter( + _jsonOptions.Value, + _loggerFactory.CreateLogger()); + + var newtonsoftJsonInputFormatter = new NewtonsoftJsonInputFormatter( + _loggerFactory.CreateLogger(), + _mvcNewtonsoftJsonOptions.Value.SerializerSettings, + _charPool, + _objectPoolProvider, + options, + _mvcNewtonsoftJsonOptions.Value); + + options.InputFormatters.RemoveType(); + options.InputFormatters.RemoveType(); + options.InputFormatters.Add(new AbpHybridJsonInputFormatter(systemTextJsonInputFormatter, newtonsoftJsonInputFormatter)); + + var jsonSerializerOptions = _jsonOptions.Value.JsonSerializerOptions; + if (jsonSerializerOptions.Encoder is null) + { + // If the user hasn't explicitly configured the encoder, use the less strict encoder that does not encode all non-ASCII characters. + jsonSerializerOptions = new JsonSerializerOptions(jsonSerializerOptions) + { + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, + }; + } + + var systemTextJsonOutputFormatter = new SystemTextJsonOutputFormatter(jsonSerializerOptions); + var newtonsoftJsonOutputFormatter = new NewtonsoftJsonOutputFormatter( + _mvcNewtonsoftJsonOptions.Value.SerializerSettings, + _charPool, + options); + + options.OutputFormatters.RemoveType(); + options.OutputFormatters.RemoveType(); + options.OutputFormatters.Add(new AbpHybridJsonOutputFormatter(systemTextJsonOutputFormatter, newtonsoftJsonOutputFormatter)); + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOutputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOutputFormatter.cs index 1507457f08..1dcd5d0fac 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOutputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/AbpHybridJsonOutputFormatter.cs @@ -8,8 +8,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Json { public class AbpHybridJsonOutputFormatter : TextOutputFormatter { - public AbpHybridJsonOutputFormatter() + private readonly SystemTextJsonOutputFormatter _systemTextJsonOutputFormatter; + private readonly NewtonsoftJsonOutputFormatter _newtonsoftJsonOutputFormatter; + + public AbpHybridJsonOutputFormatter(SystemTextJsonOutputFormatter systemTextJsonOutputFormatter, NewtonsoftJsonOutputFormatter newtonsoftJsonOutputFormatter) { + _systemTextJsonOutputFormatter = systemTextJsonOutputFormatter; + _newtonsoftJsonOutputFormatter = newtonsoftJsonOutputFormatter; + SupportedEncodings.Add(Encoding.UTF8); SupportedEncodings.Add(Encoding.Unicode); @@ -18,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Json SupportedMediaTypes.Add(MediaTypeHeaderValues.ApplicationAnyJsonSyntax); } - public async override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding) + public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding) { await GetTextInputFormatter(context).WriteResponseBodyAsync(context, selectedEncoding); } @@ -28,10 +34,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Json var typesMatcher = context.HttpContext.RequestServices.GetRequiredService(); if (!typesMatcher.Match(context.ObjectType)) { - return context.HttpContext.RequestServices.GetRequiredService(); + return _systemTextJsonOutputFormatter; } - return context.HttpContext.RequestServices.GetRequiredService(); + return _newtonsoftJsonOutputFormatter; } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs index b4e19e6ae7..366a24e8f4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Json/MvcCoreBuilderExtensions.cs @@ -1,12 +1,7 @@ -using System.Buffers; -using System.Text.Json; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; -using System.Text.Encodings.Web; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.ObjectPool; using Volo.Abp.Json; @@ -24,68 +19,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Json return builder; } - //SystemTextJsonInputFormatter - builder.Services.AddTransient(provider => - { - var jsonOptions = provider.GetRequiredService>(); - var logger = provider.GetRequiredService().CreateLogger(); - return new SystemTextJsonInputFormatter(jsonOptions.Value, logger); - }); - builder.Services.TryAddTransient(); - //NewtonsoftJsonInputFormatter - builder.Services.AddTransient(provider => - { - var jsonOptions = provider.GetRequiredService>().Value; - - return new NewtonsoftJsonInputFormatter( - provider.GetRequiredService().CreateLogger(), - jsonOptions.SerializerSettings, - provider.GetRequiredService>(), - provider.GetRequiredService(), - provider.GetRequiredService>().Value, - jsonOptions); - }); - - //SystemTextJsonOutputFormatter - builder.Services.AddTransient(provider => - { - var jsonSerializerOptions = provider.GetRequiredService>().Value.JsonSerializerOptions; - if (jsonSerializerOptions.Encoder is null) - { - // If the user hasn't explicitly configured the encoder, use the less strict encoder that does not encode all non-ASCII characters. - jsonSerializerOptions = new JsonSerializerOptions(jsonSerializerOptions) - { - Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, - }; - } - return new SystemTextJsonOutputFormatter(jsonSerializerOptions); - }); - - //NewtonsoftJsonOutputFormatter - builder.Services.AddTransient(provider => - { - var jsonOptions = provider.GetRequiredService>().Value; - return new NewtonsoftJsonOutputFormatter( - jsonOptions.SerializerSettings, - provider.GetRequiredService>(), - provider.GetRequiredService>().Value); - }); - builder.Services.TryAddEnumerable(ServiceDescriptor.Transient, AbpJsonOptionsSetup>()); builder.Services.TryAddEnumerable(ServiceDescriptor.Transient, AbpMvcNewtonsoftJsonOptionsSetup>()); - - builder.Services.Configure(options => - { - options.InputFormatters.RemoveType(); - options.InputFormatters.RemoveType(); - options.InputFormatters.Add(new AbpHybridJsonInputFormatter()); - - options.OutputFormatters.RemoveType(); - options.OutputFormatters.RemoveType(); - options.OutputFormatters.Add(new AbpHybridJsonOutputFormatter()); - }); - + builder.Services.TryAddEnumerable(ServiceDescriptor.Transient, AbpHybridJsonOptionsSetup>()); return builder; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs index 552ce7e04e..8f11ede0a5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs @@ -1,8 +1,9 @@ -using System; +using System; using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Uow; using Volo.Abp.DependencyInjection; @@ -12,15 +13,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow { public class AbpUowActionFilter : IAsyncActionFilter, ITransientDependency { - private readonly IUnitOfWorkManager _unitOfWorkManager; - private readonly AbpUnitOfWorkDefaultOptions _defaultOptions; - - public AbpUowActionFilter(IUnitOfWorkManager unitOfWorkManager, IOptions options) - { - _unitOfWorkManager = unitOfWorkManager; - _defaultOptions = options.Value; - } - public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { if (!context.ActionDescriptor.IsControllerAction()) @@ -45,20 +37,22 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow var options = CreateOptions(context, unitOfWorkAttr); + var unitOfWorkManager = context.HttpContext.RequestServices.GetRequiredService(); + //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware - if (_unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) + if (unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) { var result = await next(); if (!Succeed(result)) { - await RollbackAsync(context); + await RollbackAsync(context, unitOfWorkManager); } return; } //Begin a new, independent unit of work - using (var uow = _unitOfWorkManager.Begin(options)) + using (var uow = unitOfWorkManager.Begin(options)) { var result = await next(); if (Succeed(result)) @@ -76,7 +70,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow if (unitOfWorkAttribute?.IsTransactional == null) { - options.IsTransactional = _defaultOptions.CalculateIsTransactional( + var abpUnitOfWorkDefaultOptions = context.HttpContext.RequestServices.GetRequiredService>().Value; + options.IsTransactional = abpUnitOfWorkDefaultOptions.CalculateIsTransactional( autoValue: !string.Equals(context.HttpContext.Request.Method, HttpMethod.Get.Method, StringComparison.OrdinalIgnoreCase) ); } @@ -84,9 +79,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow return options; } - private async Task RollbackAsync(ActionExecutingContext context) + private async Task RollbackAsync(ActionExecutingContext context, IUnitOfWorkManager unitOfWorkManager) { - var currentUow = _unitOfWorkManager.Current; + var currentUow = unitOfWorkManager.Current; if (currentUow != null) { await currentUow.RollbackAsync(context.HttpContext.RequestAborted); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs index bcef10ecd4..7dbc65319e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs @@ -1,8 +1,9 @@ -using System; +using System; using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Uow; using Volo.Abp.DependencyInjection; @@ -12,14 +13,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow { public class AbpUowPageFilter : IAsyncPageFilter, ITransientDependency { - private readonly IUnitOfWorkManager _unitOfWorkManager; - private readonly AbpUnitOfWorkDefaultOptions _defaultOptions; - - public AbpUowPageFilter(IUnitOfWorkManager unitOfWorkManager, IOptions options) - { - _unitOfWorkManager = unitOfWorkManager; - _defaultOptions = options.Value; - } public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) { return Task.CompletedTask; @@ -49,20 +42,22 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow var options = CreateOptions(context, unitOfWorkAttr); + var unitOfWorkManager = context.HttpContext.RequestServices.GetRequiredService(); + //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware - if (_unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) + if (unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) { var result = await next(); if (!Succeed(result)) { - await RollbackAsync(context); + await RollbackAsync(context, unitOfWorkManager); } return; } //Begin a new, independent unit of work - using (var uow = _unitOfWorkManager.Begin(options)) + using (var uow = unitOfWorkManager.Begin(options)) { var result = await next(); if (Succeed(result)) @@ -80,7 +75,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow if (unitOfWorkAttribute?.IsTransactional == null) { - options.IsTransactional = _defaultOptions.CalculateIsTransactional( + var abpUnitOfWorkDefaultOptions = context.HttpContext.RequestServices.GetRequiredService>().Value; + options.IsTransactional = abpUnitOfWorkDefaultOptions.CalculateIsTransactional( autoValue: !string.Equals(context.HttpContext.Request.Method, HttpMethod.Get.Method, StringComparison.OrdinalIgnoreCase) ); } @@ -88,9 +84,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow return options; } - private async Task RollbackAsync(PageHandlerExecutingContext context) + private async Task RollbackAsync(PageHandlerExecutingContext context, IUnitOfWorkManager unitOfWorkManager) { - var currentUow = _unitOfWorkManager.Current; + var currentUow = unitOfWorkManager.Current; if (currentUow != null) { await currentUow.RollbackAsync(context.HttpContext.RequestAborted); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs index 8fe699f4ba..fe74419654 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs @@ -1,19 +1,13 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Mvc.Validation { public class AbpValidationActionFilter : IAsyncActionFilter, ITransientDependency { - private readonly IModelStateValidator _validator; - - public AbpValidationActionFilter(IModelStateValidator validator) - { - _validator = validator; - } - public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { //TODO: Configuration to disable validation for controllers..? @@ -25,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation return; } - _validator.Validate(context.ModelState); + context.HttpContext.RequestServices.GetRequiredService().Validate(context.ModelState); await next(); } } From c74ee641784a9ff06537218f198775357d34943a Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 28 Dec 2020 10:10:05 +0800 Subject: [PATCH 003/119] Add AbpActionContextExtensions. --- .../Mvc/AbpActionContextExtensions.cs | 20 +++++++++++++++ .../Mvc/Auditing/AbpAuditActionFilter.cs | 7 +++--- .../Mvc/Auditing/AbpAuditPageFilter.cs | 7 +++--- .../ExceptionHandling/AbpExceptionFilter.cs | 25 ++++++------------- .../AbpExceptionPageFilter.cs | 23 ++++++----------- .../Mvc/Features/AbpFeatureActionFilter.cs | 10 +++----- .../Mvc/Features/AbpFeaturePageFilter.cs | 6 ++--- .../GlobalFeatureActionFilter.cs | 6 +---- .../GlobalFeatures/GlobalFeaturePageFilter.cs | 6 +---- .../AspNetCore/Mvc/Uow/AbpUowActionFilter.cs | 5 ++-- .../AspNetCore/Mvc/Uow/AbpUowPageFilter.cs | 5 ++-- .../Validation/AbpValidationActionFilter.cs | 3 +-- 12 files changed, 53 insertions(+), 70 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpActionContextExtensions.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpActionContextExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpActionContextExtensions.cs new file mode 100644 index 0000000000..07b54cc5df --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpActionContextExtensions.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; + +namespace Volo.Abp.AspNetCore.Mvc +{ + internal static class AbpActionContextExtensions + { + public static T GetRequiredService(this FilterContext context) + where T : class + { + return context.HttpContext.RequestServices.GetRequiredService(); + } + + public static T GetService(this FilterContext context, T defaultValue = default) + where T : class + { + return context.HttpContext.RequestServices.GetService() ?? defaultValue; + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs index 2e05204304..33db273c07 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.Aspects; using Volo.Abp.Auditing; @@ -53,7 +52,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing auditLog = null; auditLogAction = null; - var options = context.HttpContext.RequestServices.GetRequiredService>().Value; + var options = context.GetRequiredService>().Value; if (!options.IsEnabled) { return false; @@ -64,13 +63,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing return false; } - var auditLogScope = context.HttpContext.RequestServices.GetRequiredService().Current; + var auditLogScope = context.GetRequiredService().Current; if (auditLogScope == null) { return false; } - var auditingHelper = context.HttpContext.RequestServices.GetRequiredService(); + var auditingHelper = context.GetRequiredService(); if (!auditingHelper.ShouldSaveAudit(context.ActionDescriptor.GetMethodInfo(), true)) { return false; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs index 70fac063b5..cc12120280 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.Aspects; using Volo.Abp.Auditing; @@ -58,7 +57,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing auditLog = null; auditLogAction = null; - var options = context.HttpContext.RequestServices.GetRequiredService>().Value; + var options = context.GetRequiredService>().Value; if (!options.IsEnabled) { return false; @@ -69,13 +68,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing return false; } - var auditLogScope = context.HttpContext.RequestServices.GetRequiredService().Current; + var auditLogScope = context.GetRequiredService().Current; if (auditLogScope == null) { return false; } - var auditingHelper = context.HttpContext.RequestServices.GetRequiredService(); + var auditingHelper = context.GetRequiredService(); if (!auditingHelper.ShouldSaveAudit(context.HandlerMethod.MethodInfo, true)) { return false; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs index 2a28d2cc0a..6c447bc893 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs @@ -1,11 +1,10 @@ -using System; +using System; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; @@ -57,14 +56,13 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling //TODO: Trigger an AbpExceptionHandled event or something like that. context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); - context.HttpContext.Response.StatusCode = (int) context.HttpContext.RequestServices + context.HttpContext.Response.StatusCode = (int) context .GetRequiredService() .GetStatusCode(context.HttpContext, context.Exception); - var remoteServiceErrorInfo = context.HttpContext.RequestServices - .GetRequiredService().Convert(context.Exception, - context.HttpContext.RequestServices.GetRequiredService>() - .Value.SendExceptionsDetailsToClients); + var exceptionHandlingOptions = context.GetRequiredService>().Value; + var exceptionToErrorInfoConverter = context.GetRequiredService(); + var remoteServiceErrorInfo = exceptionToErrorInfoConverter.Convert(context.Exception, exceptionHandlingOptions.SendExceptionsDetailsToClients); context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo)); @@ -72,22 +70,15 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling var remoteServiceErrorInfoBuilder = new StringBuilder(); remoteServiceErrorInfoBuilder.AppendLine($"---------- {nameof(RemoteServiceErrorInfo)} ----------"); - remoteServiceErrorInfoBuilder.AppendLine(context.HttpContext.RequestServices - .GetRequiredService().Serialize(remoteServiceErrorInfo, indented: true)); + remoteServiceErrorInfoBuilder.AppendLine(context.GetRequiredService().Serialize(remoteServiceErrorInfo, indented: true)); - var logger = context.HttpContext.RequestServices.GetService>() ?? - NullLogger.Instance; + var logger = context.GetService>(NullLogger.Instance); logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString()); logger.LogException(context.Exception, logLevel); - await context.HttpContext - .RequestServices - .GetRequiredService() - .NotifyAsync( - new ExceptionNotificationContext(context.Exception) - ); + await context.GetRequiredService().NotifyAsync(new ExceptionNotificationContext(context.Exception)); context.Exception = null; //Handled! } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs index a91980043b..f3666d2f91 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs @@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; @@ -69,14 +68,13 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling //TODO: Trigger an AbpExceptionHandled event or something like that. context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); - context.HttpContext.Response.StatusCode = (int) context.HttpContext.RequestServices + context.HttpContext.Response.StatusCode = (int) context .GetRequiredService() .GetStatusCode(context.HttpContext, context.Exception); - var remoteServiceErrorInfo = context.HttpContext.RequestServices - .GetRequiredService().Convert(context.Exception, - context.HttpContext.RequestServices.GetRequiredService>() - .Value.SendExceptionsDetailsToClients); + var exceptionHandlingOptions = context.GetRequiredService>().Value; + var exceptionToErrorInfoConverter = context.GetRequiredService(); + var remoteServiceErrorInfo = exceptionToErrorInfoConverter.Convert(context.Exception, exceptionHandlingOptions.SendExceptionsDetailsToClients); context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo)); @@ -84,21 +82,14 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling var remoteServiceErrorInfoBuilder = new StringBuilder(); remoteServiceErrorInfoBuilder.AppendLine($"---------- {nameof(RemoteServiceErrorInfo)} ----------"); - remoteServiceErrorInfoBuilder.AppendLine(context.HttpContext.RequestServices - .GetRequiredService().Serialize(remoteServiceErrorInfo, indented: true)); + remoteServiceErrorInfoBuilder.AppendLine(context.GetRequiredService().Serialize(remoteServiceErrorInfo, indented: true)); - var logger = context.HttpContext.RequestServices.GetService>() ?? - NullLogger.Instance; + var logger = context.GetService>(NullLogger.Instance); logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString()); logger.LogException(context.Exception, logLevel); - await context.HttpContext - .RequestServices - .GetRequiredService() - .NotifyAsync( - new ExceptionNotificationContext(context.Exception) - ); + await context.GetRequiredService().NotifyAsync(new ExceptionNotificationContext(context.Exception)); context.Exception = null; //Handled! } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs index 82cc65ff0b..2d468b30d9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Mvc.Filters; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.Features; @@ -10,9 +9,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { public class AbpFeatureActionFilter : IAsyncActionFilter, ITransientDependency { - public async Task OnActionExecutionAsync( - ActionExecutingContext context, - ActionExecutionDelegate next) + public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { if (!context.ActionDescriptor.IsControllerAction()) { @@ -24,9 +21,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Features using (AbpCrossCuttingConcerns.Applying(context.Controller, AbpCrossCuttingConcerns.FeatureChecking)) { - await context.HttpContext.RequestServices.GetRequiredService().CheckAsync( - new MethodInvocationFeatureCheckerContext(methodInfo) - ); + var methodInvocationFeatureCheckerService = context.GetRequiredService(); + await methodInvocationFeatureCheckerService.CheckAsync(new MethodInvocationFeatureCheckerContext(methodInfo)); await next(); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs index 3f54597c2a..913716ab33 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeaturePageFilter.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.Features; @@ -27,9 +26,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Features using (AbpCrossCuttingConcerns.Applying(context.HandlerInstance, AbpCrossCuttingConcerns.FeatureChecking)) { - await context.HttpContext.RequestServices.GetRequiredService().CheckAsync( - new MethodInvocationFeatureCheckerContext(methodInfo) - ); + var methodInvocationFeatureCheckerService = context.GetRequiredService(); + await methodInvocationFeatureCheckerService.CheckAsync(new MethodInvocationFeatureCheckerContext(methodInfo)); await next(); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs index f0f08fad16..9498b31a3f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs @@ -3,7 +3,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.DependencyInjection; @@ -24,10 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc.GlobalFeatures if (!IsGlobalFeatureEnabled(context.Controller.GetType(), out var attribute)) { - var logger = - context.HttpContext.RequestServices.GetRequiredService>() ?? - NullLogger.Instance; - + var logger = context.GetService>(NullLogger.Instance); logger.LogWarning($"The '{context.Controller.GetType().FullName}' controller needs to enable '{attribute.Name}' feature."); context.Result = new NotFoundResult(); return; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs index 18c56ab698..a3415f6be8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs @@ -3,7 +3,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.DependencyInjection; @@ -29,10 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.GlobalFeatures if (!IsGlobalFeatureEnabled(context.HandlerInstance.GetType(), out var attribute)) { - var logger = - context.HttpContext.RequestServices.GetRequiredService>() ?? - NullLogger.Instance; - + var logger = context.GetService>(NullLogger.Instance); logger.LogWarning($"The '{context.HandlerInstance.GetType().FullName}' page needs to enable '{attribute.Name}' feature."); context.Result = new NotFoundResult(); return; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs index 8f11ede0a5..d4b2087281 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs @@ -3,7 +3,6 @@ using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Uow; using Volo.Abp.DependencyInjection; @@ -37,7 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow var options = CreateOptions(context, unitOfWorkAttr); - var unitOfWorkManager = context.HttpContext.RequestServices.GetRequiredService(); + var unitOfWorkManager = context.GetRequiredService(); //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware if (unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) @@ -70,7 +69,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow if (unitOfWorkAttribute?.IsTransactional == null) { - var abpUnitOfWorkDefaultOptions = context.HttpContext.RequestServices.GetRequiredService>().Value; + var abpUnitOfWorkDefaultOptions = context.GetRequiredService>().Value; options.IsTransactional = abpUnitOfWorkDefaultOptions.CalculateIsTransactional( autoValue: !string.Equals(context.HttpContext.Request.Method, HttpMethod.Get.Method, StringComparison.OrdinalIgnoreCase) ); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs index 7dbc65319e..6ab5ba8909 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs @@ -3,7 +3,6 @@ using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Uow; using Volo.Abp.DependencyInjection; @@ -42,7 +41,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow var options = CreateOptions(context, unitOfWorkAttr); - var unitOfWorkManager = context.HttpContext.RequestServices.GetRequiredService(); + var unitOfWorkManager = context.GetRequiredService(); //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware if (unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) @@ -75,7 +74,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow if (unitOfWorkAttribute?.IsTransactional == null) { - var abpUnitOfWorkDefaultOptions = context.HttpContext.RequestServices.GetRequiredService>().Value; + var abpUnitOfWorkDefaultOptions = context.GetRequiredService>().Value; options.IsTransactional = abpUnitOfWorkDefaultOptions.CalculateIsTransactional( autoValue: !string.Equals(context.HttpContext.Request.Method, HttpMethod.Get.Method, StringComparison.OrdinalIgnoreCase) ); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs index fe74419654..751afe84d0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Mvc.Validation @@ -19,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation return; } - context.HttpContext.RequestServices.GetRequiredService().Validate(context.ModelState); + context.GetRequiredService().Validate(context.ModelState); await next(); } } From d3c44651219e8c8e480a665d0d814949353fd101 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 28 Dec 2020 10:38:45 +0800 Subject: [PATCH 004/119] Use IServiceProvider in Interceptors. --- .../Volo/Abp/Auditing/AuditingInterceptor.cs | 19 ++++++++++--------- .../Volo/Abp/Features/FeatureInterceptor.cs | 15 ++++++++------- .../Volo/Abp/Uow/UnitOfWorkInterceptor.cs | 16 ++++++++-------- .../Abp/Validation/ValidationInterceptor.cs | 2 +- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs index 0eef78ed6a..681dc0eb0d 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.DynamicProxy; @@ -9,16 +10,14 @@ namespace Volo.Abp.Auditing { public class AuditingInterceptor : AbpInterceptor, ITransientDependency { - private readonly IAuditingHelper _auditingHelper; - private readonly IAuditingManager _auditingManager; + private readonly IServiceProvider _serviceProvider; - public AuditingInterceptor(IAuditingHelper auditingHelper, IAuditingManager auditingManager) + public AuditingInterceptor(IServiceProvider serviceProvider) { - _auditingHelper = auditingHelper; - _auditingManager = auditingManager; + _serviceProvider = serviceProvider; } - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction)) { @@ -58,19 +57,21 @@ namespace Volo.Abp.Auditing return false; } - var auditLogScope = _auditingManager.Current; + var auditingManager = _serviceProvider.GetRequiredService(); + var auditLogScope = auditingManager.Current; if (auditLogScope == null) { return false; } - if (!_auditingHelper.ShouldSaveAudit(invocation.Method)) + var auditingHelper = _serviceProvider.GetRequiredService(); + if (!auditingHelper.ShouldSaveAudit(invocation.Method)) { return false; } auditLog = auditLogScope.Log; - auditLogAction = _auditingHelper.CreateAuditLogAction( + auditLogAction = auditingHelper.CreateAuditLogAction( auditLog, invocation.TargetObject.GetType(), invocation.Method, diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs index 7b84593378..aff34d358f 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs @@ -1,4 +1,6 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.DynamicProxy; @@ -7,15 +9,14 @@ namespace Volo.Abp.Features { public class FeatureInterceptor : AbpInterceptor, ITransientDependency { - private readonly IMethodInvocationFeatureCheckerService _methodInvocationFeatureCheckerService; + private readonly IServiceProvider _serviceProvider; - public FeatureInterceptor( - IMethodInvocationFeatureCheckerService methodInvocationFeatureCheckerService) + public FeatureInterceptor(IServiceProvider serviceProvider) { - _methodInvocationFeatureCheckerService = methodInvocationFeatureCheckerService; + _serviceProvider = serviceProvider; } - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.FeatureChecking)) { @@ -29,7 +30,7 @@ namespace Volo.Abp.Features protected virtual async Task CheckFeaturesAsync(IAbpMethodInvocation invocation) { - await _methodInvocationFeatureCheckerService.CheckAsync( + await _serviceProvider.GetRequiredService().CheckAsync( new MethodInvocationFeatureCheckerContext( invocation.Method ) diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs index f5afcea494..c161184071 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; using Volo.Abp.DynamicProxy; @@ -9,16 +10,14 @@ namespace Volo.Abp.Uow { public class UnitOfWorkInterceptor : AbpInterceptor, ITransientDependency { - private readonly IUnitOfWorkManager _unitOfWorkManager; - private readonly AbpUnitOfWorkDefaultOptions _defaultOptions; + private readonly IServiceProvider _serviceProvider; - public UnitOfWorkInterceptor(IUnitOfWorkManager unitOfWorkManager, IOptions options) + public UnitOfWorkInterceptor(IServiceProvider serviceProvider) { - _unitOfWorkManager = unitOfWorkManager; - _defaultOptions = options.Value; + _serviceProvider = serviceProvider; } - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute)) { @@ -26,7 +25,7 @@ namespace Volo.Abp.Uow return; } - using (var uow = _unitOfWorkManager.Begin(CreateOptions(invocation, unitOfWorkAttribute))) + using (var uow = _serviceProvider.GetRequiredService().Begin(CreateOptions(invocation, unitOfWorkAttribute))) { await invocation.ProceedAsync(); await uow.CompleteAsync(); @@ -41,7 +40,8 @@ namespace Volo.Abp.Uow if (unitOfWorkAttribute?.IsTransactional == null) { - options.IsTransactional = _defaultOptions.CalculateIsTransactional( + var defaultOptions = _serviceProvider.GetRequiredService>().Value; + options.IsTransactional = defaultOptions.CalculateIsTransactional( autoValue: !invocation.Method.Name.StartsWith("Get", StringComparison.InvariantCultureIgnoreCase) ); } diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs index d0d9e7594d..b4ce642471 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.Validation _methodInvocationValidator = methodInvocationValidator; } - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { Validate(invocation); await invocation.ProceedAsync(); From e799338781381e4c2c0bf1d661348101ef4730c5 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 28 Dec 2020 10:44:17 +0800 Subject: [PATCH 005/119] Use IServiceProvider in MethodInvocationAuthorizationService. --- .../MethodInvocationAuthorizationService.cs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs index fb35d142cb..7a34598a66 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs @@ -1,23 +1,21 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; namespace Volo.Abp.Authorization { public class MethodInvocationAuthorizationService : IMethodInvocationAuthorizationService, ITransientDependency { - private readonly IAbpAuthorizationPolicyProvider _abpAuthorizationPolicyProvider; - private readonly IAbpAuthorizationService _abpAuthorizationService; + private readonly IServiceProvider _serviceProvider; - public MethodInvocationAuthorizationService( - IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider, - IAbpAuthorizationService abpAuthorizationService) + public MethodInvocationAuthorizationService(IServiceProvider serviceProvider) { - _abpAuthorizationPolicyProvider = abpAuthorizationPolicyProvider; - _abpAuthorizationService = abpAuthorizationService; + _serviceProvider = serviceProvider; } public async Task CheckAsync(MethodInvocationAuthorizationContext context) @@ -28,7 +26,7 @@ namespace Volo.Abp.Authorization } var authorizationPolicy = await AuthorizationPolicy.CombineAsync( - _abpAuthorizationPolicyProvider, + _serviceProvider.GetRequiredService(), GetAuthorizationDataAttributes(context.Method) ); @@ -36,8 +34,8 @@ namespace Volo.Abp.Authorization { return; } - - await _abpAuthorizationService.CheckAsync(authorizationPolicy); + + await _serviceProvider.GetRequiredService().CheckAsync(authorizationPolicy); } protected virtual bool AllowAnonymous(MethodInvocationAuthorizationContext context) @@ -64,4 +62,4 @@ namespace Volo.Abp.Authorization return attributes; } } -} \ No newline at end of file +} From 4b595a1427c47542eb8da41b876db718b0bbc554 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 28 Dec 2020 15:21:25 +0800 Subject: [PATCH 006/119] Use IAbpLazyServiceProvider instead of property injection. --- .../AbpLazyServiceProvider.cs | 60 +++++++++++++++++++ .../IAbpLazyServiceProvider.cs | 23 +++++++ .../Repositories/BasicRepositoryBase.cs | 14 +++-- .../EntityFrameworkCore/EfCoreRepository.cs | 44 +++++++------- .../Abp/EntityFrameworkCore/AbpDbContext.cs | 28 ++++----- 5 files changed, 125 insertions(+), 44 deletions(-) create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/IAbpLazyServiceProvider.cs diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs new file mode 100644 index 0000000000..b085b90722 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using Microsoft.Extensions.DependencyInjection; + +namespace Volo.Abp.DependencyInjection +{ + public class AbpLazyServiceProvider : IAbpLazyServiceProvider, ITransientDependency + { + protected IDictionary> CachedTypes { get; set; } + + protected IServiceProvider ServiceProvider { get; set; } + + public AbpLazyServiceProvider(IServiceProvider serviceProvider) + { + ServiceProvider = serviceProvider; + + CachedTypes = new Dictionary>(); + } + + public virtual T LazyGetRequiredService() + { + return (T)CachedTypes.GetOrAdd(typeof(T), () => new Lazy(() => (T) ServiceProvider.GetRequiredService(typeof(T)))).Value; + } + + public virtual object LazyGetRequiredService(Type serviceType) + { + return CachedTypes.GetOrAdd(serviceType, () => new Lazy(() => ServiceProvider.GetRequiredService(serviceType))).Value; + } + + public virtual T LazyGetService() + { + return (T)CachedTypes.GetOrAdd(typeof(T), () => new Lazy(() => (T) ServiceProvider.GetService(typeof(T)))).Value; + } + + public virtual object LazyGetService(Type serviceType) + { + return CachedTypes.GetOrAdd(serviceType, () => new Lazy(() => ServiceProvider.GetService(serviceType))).Value; + } + + public virtual T LazyGetService(T defaultValue) + { + return LazyGetService() ?? defaultValue; + } + + public virtual object LazyGetService(Type serviceType, object defaultValue) + { + return LazyGetService(serviceType) ?? defaultValue; + } + + public virtual object LazyGetService(Type serviceType, Func factory) + { + return CachedTypes.GetOrAdd(serviceType, () => new Lazy(() => factory(ServiceProvider))).Value; + } + + public virtual T LazyGetService(Func factory) + { + return (T)CachedTypes.GetOrAdd(typeof(T), () => new Lazy(() => factory(ServiceProvider))).Value; + } + } +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/IAbpLazyServiceProvider.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/IAbpLazyServiceProvider.cs new file mode 100644 index 0000000000..cea6c05ebf --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/IAbpLazyServiceProvider.cs @@ -0,0 +1,23 @@ +using System; + +namespace Volo.Abp.DependencyInjection +{ + public interface IAbpLazyServiceProvider + { + T LazyGetRequiredService(); + + object LazyGetRequiredService(Type serviceType); + + T LazyGetService(); + + object LazyGetService(Type serviceType); + + T LazyGetService(T defaultValue); + + object LazyGetService(Type serviceType, object defaultValue); + + object LazyGetService(Type serviceType, Func factory); + + T LazyGetService(Func factory); + } +} diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs index 8bcf98dff1..65c2cc897b 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs @@ -19,21 +19,23 @@ namespace Volo.Abp.Domain.Repositories IUnitOfWorkEnabled where TEntity : class, IEntity { + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IServiceProvider ServiceProvider { get; set; } - public IDataFilter DataFilter { get; set; } + public IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService(); - public ICurrentTenant CurrentTenant { get; set; } + public ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService(); - public IAsyncQueryableExecuter AsyncExecuter { get; set; } + public IAsyncQueryableExecuter AsyncExecuter => LazyServiceProvider.LazyGetRequiredService(); - public IUnitOfWorkManager UnitOfWorkManager { get; set; } + public IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); - public ICancellationTokenProvider CancellationTokenProvider { get; set; } + public ICancellationTokenProvider CancellationTokenProvider => LazyServiceProvider.LazyGetService(NullCancellationTokenProvider.Instance); protected BasicRepositoryBase() { - CancellationTokenProvider = NullCancellationTokenProvider.Instance; + } public abstract Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default); diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index ca885bd4fb..2e1d79f2f9 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -2,7 +2,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using Nito.AsyncEx; using System; using System.Collections.Generic; using System.Linq; @@ -32,14 +31,13 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore private readonly IDbContextProvider _dbContextProvider; private readonly Lazy> _entityOptionsLazy; - public virtual IGuidGenerator GuidGenerator { get; set; } + public virtual IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - public IEfCoreBulkOperationProvider BulkOperationProvider { get; set; } + public IEfCoreBulkOperationProvider BulkOperationProvider => LazyServiceProvider.LazyGetRequiredService(); public EfCoreRepository(IDbContextProvider dbContextProvider) { _dbContextProvider = dbContextProvider; - GuidGenerator = SimpleGuidGenerator.Instance; _entityOptionsLazy = new Lazy>( () => ServiceProvider @@ -49,15 +47,15 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore ); } - public async override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) + public override async Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) { CheckAndSetId(entity); - var savedEntity = DbSet.Add(entity).Entity; + var savedEntity = (await DbSet.AddAsync(entity, GetCancellationToken(cancellationToken))).Entity; if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); + await DbContext.SaveChangesAsync(GetCancellationToken(GetCancellationToken(cancellationToken))); } return savedEntity; @@ -76,20 +74,20 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore this, entities, autoSave, - cancellationToken + GetCancellationToken(cancellationToken) ); return; } - await DbSet.AddRangeAsync(entities); + await DbSet.AddRangeAsync(entities, GetCancellationToken(cancellationToken)); if (autoSave) { - await DbContext.SaveChangesAsync(); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } } - public async override Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) + public override async Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) { DbContext.Attach(entity); @@ -111,7 +109,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore this, entities, autoSave, - cancellationToken + GetCancellationToken(cancellationToken) ); return; @@ -121,11 +119,11 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } } - public async override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) + public override async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) { DbSet.Remove(entity); @@ -152,23 +150,23 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } } - public async override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) + public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) { return includeDetails ? await WithDetails().ToListAsync(GetCancellationToken(cancellationToken)) : await DbSet.ToListAsync(GetCancellationToken(cancellationToken)); } - public async override Task GetCountAsync(CancellationToken cancellationToken = default) + public override async Task GetCountAsync(CancellationToken cancellationToken = default) { return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken)); } - public async override Task> GetPagedListAsync( + public override async Task> GetPagedListAsync( int skipCount, int maxResultCount, string sorting, @@ -190,10 +188,10 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore protected override Task SaveChangesAsync(CancellationToken cancellationToken) { - return DbContext.SaveChangesAsync(cancellationToken); + return DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } - public async override Task FindAsync( + public override async Task FindAsync( Expression> predicate, bool includeDetails = true, CancellationToken cancellationToken = default) @@ -207,7 +205,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore .SingleOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async override Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default) + public override async Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default) { var entities = await GetQueryable() .Where(predicate) @@ -344,9 +342,9 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore await DeleteAsync(entity, autoSave, cancellationToken); } - public async virtual Task DeleteManyAsync([NotNull] IEnumerable ids, bool autoSave = false, CancellationToken cancellationToken = default) + public virtual async Task DeleteManyAsync([NotNull] IEnumerable ids, bool autoSave = false, CancellationToken cancellationToken = default) { - var entities = await DbSet.Where(x => ids.Contains(x.Id)).ToListAsync(); + var entities = await DbSet.Where(x => ids.Contains(x.Id)).ToListAsync(GetCancellationToken(cancellationToken)); await DeleteManyAsync(entities, autoSave, cancellationToken); } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index a17aab8621..24ba939e90 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -23,7 +23,6 @@ using Volo.Abp.EntityFrameworkCore.EntityHistory; using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.EntityFrameworkCore.ValueConverters; using Volo.Abp.Guids; -using Volo.Abp.Localization; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectExtending; using Volo.Abp.Reflection; @@ -35,31 +34,33 @@ namespace Volo.Abp.EntityFrameworkCore public abstract class AbpDbContext : DbContext, IAbpEfCoreDbContext, ITransientDependency where TDbContext : DbContext { + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + protected virtual Guid? CurrentTenantId => CurrentTenant?.Id; protected virtual bool IsMultiTenantFilterEnabled => DataFilter?.IsEnabled() ?? false; protected virtual bool IsSoftDeleteFilterEnabled => DataFilter?.IsEnabled() ?? false; - public ICurrentTenant CurrentTenant { get; set; } + public ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService(); - public IGuidGenerator GuidGenerator { get; set; } + public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - public IDataFilter DataFilter { get; set; } + public IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService(); - public IEntityChangeEventHelper EntityChangeEventHelper { get; set; } + public IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService(NullEntityChangeEventHelper.Instance); - public IAuditPropertySetter AuditPropertySetter { get; set; } + public IAuditPropertySetter AuditPropertySetter => LazyServiceProvider.LazyGetRequiredService(); - public IEntityHistoryHelper EntityHistoryHelper { get; set; } + public IEntityHistoryHelper EntityHistoryHelper => LazyServiceProvider.LazyGetService(NullEntityHistoryHelper.Instance); - public IAuditingManager AuditingManager { get; set; } + public IAuditingManager AuditingManager => LazyServiceProvider.LazyGetRequiredService(); - public IUnitOfWorkManager UnitOfWorkManager { get; set; } + public IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); - public IClock Clock { get; set; } + public IClock Clock => LazyServiceProvider.LazyGetRequiredService(); - public ILogger> Logger { get; set; } + public ILogger> Logger => LazyServiceProvider.LazyGetService>>(NullLogger>.Instance); private static readonly MethodInfo ConfigureBasePropertiesMethodInfo = typeof(AbpDbContext) @@ -85,10 +86,7 @@ namespace Volo.Abp.EntityFrameworkCore protected AbpDbContext(DbContextOptions options) : base(options) { - GuidGenerator = SimpleGuidGenerator.Instance; - EntityChangeEventHelper = NullEntityChangeEventHelper.Instance; - EntityHistoryHelper = NullEntityHistoryHelper.Instance; - Logger = NullLogger>.Instance; + } protected override void OnModelCreating(ModelBuilder modelBuilder) From c4a36cac9ebece876998f81b2cc5db91a5bcee6c Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 28 Dec 2020 16:11:37 +0800 Subject: [PATCH 007/119] Fix the unit tests. --- .../Repositories/EntityFrameworkCore/EfCoreRepository.cs | 4 ++-- .../Volo/Abp/EntityFrameworkCore/AbpDbContext.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index 2e1d79f2f9..013f2d4c7e 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -1,4 +1,4 @@ -using JetBrains.Annotations; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -33,7 +33,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public virtual IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - public IEfCoreBulkOperationProvider BulkOperationProvider => LazyServiceProvider.LazyGetRequiredService(); + public IEfCoreBulkOperationProvider BulkOperationProvider => LazyServiceProvider.LazyGetService(); public EfCoreRepository(IDbContextProvider dbContextProvider) { diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index 24ba939e90..43a17ddf33 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -562,7 +562,7 @@ namespace Volo.Abp.EntityFrameworkCore !typeof(TEntity).IsDefined(typeof(OwnedAttribute), true) && !mutableEntityType.IsOwned()) { - if (Clock == null || !Clock.SupportsMultipleTimezone) + if (LazyServiceProvider == null || Clock == null || !Clock.SupportsMultipleTimezone) { return; } From 2e76df3de72df6b9ef5f04dca8f971267576915a Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 30 Dec 2020 10:23:52 +0800 Subject: [PATCH 008/119] Use LazyServiceProvider in MongoDbRepository & MemoryDbRepository --- .../Abp/Domain/Repositories/RepositoryBase.cs | 2 -- .../MemoryDb/MemoryDbRepository.cs | 14 +++----- .../Repositories/MongoDB/MongoDbRepository.cs | 33 ++++++++----------- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs index db0ec2b11c..1d4e6e6771 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs @@ -6,9 +6,7 @@ using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; -using Volo.Abp.Data; using Volo.Abp.Domain.Entities; -using Volo.Abp.Linq; using Volo.Abp.MultiTenancy; using Volo.Abp.Uow; diff --git a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs index 7c67e254ee..996143069d 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs +++ b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs @@ -28,23 +28,19 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb protected IMemoryDatabaseProvider DatabaseProvider { get; } - public ILocalEventBus LocalEventBus { get; set; } + public ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetService(NullLocalEventBus.Instance); - public IDistributedEventBus DistributedEventBus { get; set; } + public IDistributedEventBus DistributedEventBus => LazyServiceProvider.LazyGetService(NullDistributedEventBus.Instance); - public IEntityChangeEventHelper EntityChangeEventHelper { get; set; } + public IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService(NullEntityChangeEventHelper.Instance); - public IAuditPropertySetter AuditPropertySetter { get; set; } + public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - public IGuidGenerator GuidGenerator { get; set; } + public IAuditPropertySetter AuditPropertySetter => LazyServiceProvider.LazyGetRequiredService(); public MemoryDbRepository(IMemoryDatabaseProvider databaseProvider) { DatabaseProvider = databaseProvider; - - LocalEventBus = NullLocalEventBus.Instance; - DistributedEventBus = NullDistributedEventBus.Instance; - EntityChangeEventHelper = NullEntityChangeEventHelper.Instance; } protected override IQueryable GetQueryable() diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index 109aeac8cd..43fdf4649b 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -37,29 +37,24 @@ namespace Volo.Abp.Domain.Repositories.MongoDB protected IMongoDbContextProvider DbContextProvider { get; } - public ILocalEventBus LocalEventBus { get; set; } + public ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetService(NullLocalEventBus.Instance); - public IDistributedEventBus DistributedEventBus { get; set; } + public IDistributedEventBus DistributedEventBus => LazyServiceProvider.LazyGetService(NullDistributedEventBus.Instance); - public IEntityChangeEventHelper EntityChangeEventHelper { get; set; } + public IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService(NullEntityChangeEventHelper.Instance); - public IGuidGenerator GuidGenerator { get; set; } + public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - public IAuditPropertySetter AuditPropertySetter { get; set; } + public IAuditPropertySetter AuditPropertySetter => LazyServiceProvider.LazyGetRequiredService(); - public IMongoDbBulkOperationProvider BulkOperationProvider { get; set; } + public IMongoDbBulkOperationProvider BulkOperationProvider => LazyServiceProvider.LazyGetService(); public MongoDbRepository(IMongoDbContextProvider dbContextProvider) { DbContextProvider = dbContextProvider; - - LocalEventBus = NullLocalEventBus.Instance; - DistributedEventBus = NullDistributedEventBus.Instance; - EntityChangeEventHelper = NullEntityChangeEventHelper.Instance; - GuidGenerator = SimpleGuidGenerator.Instance; } - public async override Task InsertAsync( + public override async Task InsertAsync( TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) @@ -113,7 +108,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB } } - public async override Task UpdateAsync( + public override async Task UpdateAsync( TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) @@ -216,7 +211,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB } } - public async override Task DeleteAsync( + public override async Task DeleteAsync( TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) @@ -346,17 +341,17 @@ namespace Volo.Abp.Domain.Repositories.MongoDB } } - public async override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) + public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) { return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken)); } - public async override Task GetCountAsync(CancellationToken cancellationToken = default) + public override async Task GetCountAsync(CancellationToken cancellationToken = default) { return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken)); } - public async override Task> GetPagedListAsync( + public override async Task> GetPagedListAsync( int skipCount, int maxResultCount, string sorting, @@ -370,7 +365,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async override Task DeleteAsync( + public override async Task DeleteAsync( Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default) @@ -390,7 +385,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB return GetMongoQueryable(); } - public async override Task FindAsync( + public override async Task FindAsync( Expression> predicate, bool includeDetails = true, CancellationToken cancellationToken = default) From a7739c2ee33dd25c17e103acf86272e91dd9301a Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 30 Dec 2020 11:26:33 +0800 Subject: [PATCH 009/119] Use IAbpLazyServiceProvider instead of LazyGetRequiredService method. --- .../Toolbars/ToolbarConfigurationContext.cs | 25 ++---- .../UI/Bundling/BundleConfigurationContext.cs | 30 ++----- .../Toolbars/ToolbarConfigurationContext.cs | 29 ++---- .../Mvc/UI/RazorPages/AbpPageModel.cs | 87 +++++------------- .../Volo/Abp/AspNetCore/Mvc/AbpController.cs | 86 +++++------------- .../Abp/AspNetCore/Mvc/AbpViewComponent.cs | 47 ++-------- .../Volo/Abp/AspNetCore/SignalR/AbpHub.cs | 87 ++++-------------- .../BackgroundWorkers/BackgroundWorkerBase.cs | 29 ++---- .../Services/ApplicationService.cs | 89 ++++--------------- .../Volo/Abp/Domain/Services/DomainService.cs | 54 ++++------- .../Ui/Navigation/MenuConfigurationContext.cs | 27 ++---- 11 files changed, 130 insertions(+), 460 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/Toolbars/ToolbarConfigurationContext.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/Toolbars/ToolbarConfigurationContext.cs index 7174dbe431..4e30a50206 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/Toolbars/ToolbarConfigurationContext.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/Toolbars/ToolbarConfigurationContext.cs @@ -4,35 +4,19 @@ using JetBrains.Annotations; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; +using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Toolbars { public class ToolbarConfigurationContext : IToolbarConfigurationContext { public IServiceProvider ServiceProvider { get; } - private readonly object _serviceProviderLock = new object(); - private TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (_serviceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } - - return reference; - } + private readonly IAbpLazyServiceProvider _lazyServiceProvider; - public IAuthorizationService AuthorizationService => LazyGetRequiredService(typeof(IAuthorizationService), ref _authorizationService); - private IAuthorizationService _authorizationService; + public IAuthorizationService AuthorizationService => _lazyServiceProvider.LazyGetRequiredService(); - private IStringLocalizerFactory _stringLocalizerFactory; - public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(typeof(IStringLocalizerFactory),ref _stringLocalizerFactory); + public IStringLocalizerFactory StringLocalizerFactory => _lazyServiceProvider.LazyGetRequiredService(); public Toolbar Toolbar { get; } @@ -40,6 +24,7 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Toolbars { Toolbar = toolbar; ServiceProvider = serviceProvider; + _lazyServiceProvider = ServiceProvider.GetRequiredService(); } public Task IsGrantedAsync(string policyName) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationContext.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationContext.cs index 98fe3546c5..00c3762ed9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationContext.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationContext.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; using Volo.Abp.Localization; namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling @@ -13,35 +14,18 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling public IFileProvider FileProvider { get; } + public IServiceProvider ServiceProvider { get; } + + private readonly IAbpLazyServiceProvider _lazyServiceProvider; + public BundleConfigurationContext(IServiceProvider serviceProvider, IFileProvider fileProvider) { Files = new List(); ServiceProvider = serviceProvider; + _lazyServiceProvider = ServiceProvider.GetRequiredService(); FileProvider = fileProvider; } - public IServiceProvider ServiceProvider { get; } - private readonly object _serviceProviderLock = new object(); - - private TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (_serviceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } - - return reference; - } - - private IOptions _abpLocalizationOptions; - - public AbpLocalizationOptions LocalizationOptions => - LazyGetRequiredService(typeof(IOptions), ref _abpLocalizationOptions).Value; + public AbpLocalizationOptions LocalizationOptions => _lazyServiceProvider.LazyGetRequiredService>().Value; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarConfigurationContext.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarConfigurationContext.cs index 37f3308198..7ae40af60f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarConfigurationContext.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarConfigurationContext.cs @@ -5,35 +5,19 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Theming; +using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars { public class ToolbarConfigurationContext : IToolbarConfigurationContext { public IServiceProvider ServiceProvider { get; } - private readonly object _serviceProviderLock = new object(); - private TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (_serviceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } - - return reference; - } + private readonly IAbpLazyServiceProvider _lazyServiceProvider; - public IAuthorizationService AuthorizationService => LazyGetRequiredService(typeof(IAuthorizationService), ref _authorizationService); - private IAuthorizationService _authorizationService; + public IAuthorizationService AuthorizationService => _lazyServiceProvider.LazyGetRequiredService(); - private IStringLocalizerFactory _stringLocalizerFactory; - public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(typeof(IStringLocalizerFactory),ref _stringLocalizerFactory); + public IStringLocalizerFactory StringLocalizerFactory => _lazyServiceProvider.LazyGetRequiredService(); public ITheme Theme { get; } @@ -44,8 +28,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars Theme = currentTheme; Toolbar = toolbar; ServiceProvider = serviceProvider; + _lazyServiceProvider = ServiceProvider.GetRequiredService(); } - + public Task IsGrantedAsync(string policyName) { return AuthorizationService.IsGrantedAsync(policyName); @@ -62,7 +47,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars { return StringLocalizerFactory.Create(); } - + [NotNull] public IStringLocalizer GetLocalizer(Type resourceType) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs index fcbe9af59c..449747d0cc 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs @@ -10,6 +10,7 @@ using System; using System.Threading.Tasks; using Volo.Abp.AspNetCore.Mvc.UI.Alerts; using Volo.Abp.AspNetCore.Mvc.Validation; +using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.Localization; using Volo.Abp.MultiTenancy; @@ -24,67 +25,27 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages { public abstract class AbpPageModel : PageModel { - public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - - protected TService LazyGetRequiredService(ref TService reference) - => LazyGetRequiredService(typeof(TService), ref reference); + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - protected TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } - - return reference; - } + public IServiceProvider ServiceProvider { get; set; } - protected IClock Clock => LazyGetRequiredService(ref _clock); - private IClock _clock; + protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); protected AlertList Alerts => AlertManager.Alerts; - protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); - private IUnitOfWorkManager _unitOfWorkManager; + protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); protected Type ObjectMapperContext { get; set; } - protected IObjectMapper ObjectMapper - { - get - { - if (_objectMapper != null) - { - return _objectMapper; - } - - if (ObjectMapperContext == null) - { - return LazyGetRequiredService(ref _objectMapper); - } - - return LazyGetRequiredService( - typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext), - ref _objectMapper - ); - } - } - private IObjectMapper _objectMapper; + protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(provider => + ObjectMapperContext == null + ? provider.GetRequiredService() + : (IObjectMapper) provider.GetRequiredService(typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext))); - protected IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator); - private IGuidGenerator _guidGenerator; + protected IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); - private ILoggerFactory _loggerFactory; + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); - protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); - private IStringLocalizerFactory _stringLocalizerFactory; + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetRequiredService(); protected IStringLocalizer L { @@ -103,31 +64,23 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages protected Type LocalizationResourceType { get; set; } - protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); - private ICurrentUser _currentUser; + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService(); - protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); - private ICurrentTenant _currentTenant; + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService(); - protected ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider); - private ISettingProvider _settingProvider; + protected ISettingProvider SettingProvider => LazyServiceProvider.LazyGetRequiredService(); - protected IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator); - private IModelStateValidator _modelValidator; + protected IModelStateValidator ModelValidator => LazyServiceProvider.LazyGetRequiredService(); - protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); - private IAuthorizationService _authorizationService; + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetRequiredService(); - protected IAlertManager AlertManager => LazyGetRequiredService(ref _alertManager); - private IAlertManager _alertManager; + protected IAlertManager AlertManager => LazyServiceProvider.LazyGetRequiredService(); protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; - protected ILogger Logger => _lazyLogger.Value; - private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); - protected IAppUrlProvider AppUrlProvider => LazyGetRequiredService(ref _appUrlProvider); - private IAppUrlProvider _appUrlProvider; + protected IAppUrlProvider AppUrlProvider => LazyServiceProvider.LazyGetRequiredService(); protected virtual NoContentResult NoContent() //TODO: Is that true to return empty result like that? { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs index f83353092e..52f1d251cb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Aspects; using Volo.Abp.AspNetCore.Mvc.Validation; +using Volo.Abp.DependencyInjection; using Volo.Abp.Features; using Volo.Abp.Guids; using Volo.Abp.Localization; @@ -22,85 +23,41 @@ namespace Volo.Abp.AspNetCore.Mvc { public abstract class AbpController : Controller, IAvoidDuplicateCrossCuttingConcerns { - public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - - protected TService LazyGetRequiredService(ref TService reference) - => LazyGetRequiredService(typeof(TService), ref reference); - - protected TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - return reference; - } + public IServiceProvider ServiceProvider { get; set; } - protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); - private IUnitOfWorkManager _unitOfWorkManager; + protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); protected Type ObjectMapperContext { get; set; } - protected IObjectMapper ObjectMapper - { - get - { - if (_objectMapper != null) - { - return _objectMapper; - } + protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(provider => + ObjectMapperContext == null + ? provider.GetRequiredService() + : (IObjectMapper) provider.GetRequiredService(typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext))); - if (ObjectMapperContext == null) - { - return LazyGetRequiredService(ref _objectMapper); - } + protected IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - return LazyGetRequiredService( - typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext), - ref _objectMapper - ); - } - } - private IObjectMapper _objectMapper; - - protected IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator); - private IGuidGenerator _guidGenerator; - - protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); - private ILoggerFactory _loggerFactory; + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); - protected ILogger Logger => _lazyLogger.Value; - private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); - protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); - private ICurrentUser _currentUser; + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService(); - protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); - private ICurrentTenant _currentTenant; + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService(); - protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); - private IAuthorizationService _authorizationService; + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetRequiredService(); protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; - protected IClock Clock => LazyGetRequiredService(ref _clock); - private IClock _clock; + protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); - protected IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator); - private IModelStateValidator _modelValidator; + protected IModelStateValidator ModelValidator => LazyServiceProvider.LazyGetRequiredService(); - protected IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker); - private IFeatureChecker _featureChecker; + protected IFeatureChecker FeatureChecker => LazyServiceProvider.LazyGetRequiredService(); - protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); - private IStringLocalizerFactory _stringLocalizerFactory; + protected IAppUrlProvider AppUrlProvider => LazyServiceProvider.LazyGetRequiredService(); + + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetRequiredService(); protected IStringLocalizer L { @@ -116,9 +73,6 @@ namespace Volo.Abp.AspNetCore.Mvc } private IStringLocalizer _localizer; - protected IAppUrlProvider AppUrlProvider => LazyGetRequiredService(ref _appUrlProvider); - private IAppUrlProvider _appUrlProvider; - protected Type LocalizationResource { get => _localizationResource; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs index 2c0e38c13c..2ac02b8ac5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs @@ -1,55 +1,22 @@ using System; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.DependencyInjection; using Volo.Abp.ObjectMapping; namespace Volo.Abp.AspNetCore.Mvc { public abstract class AbpViewComponent : ViewComponent { - public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - - protected TService LazyGetRequiredService(ref TService reference) - => LazyGetRequiredService(typeof(TService), ref reference); - - protected TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - return reference; - } + public IServiceProvider ServiceProvider { get; set; } protected Type ObjectMapperContext { get; set; } - protected IObjectMapper ObjectMapper - { - get - { - if (_objectMapper != null) - { - return _objectMapper; - } - - if (ObjectMapperContext == null) - { - return LazyGetRequiredService(ref _objectMapper); - } - return LazyGetRequiredService( - typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext), - ref _objectMapper - ); - } - } - private IObjectMapper _objectMapper; + protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(provider => + ObjectMapperContext == null + ? provider.GetRequiredService() + : (IObjectMapper) provider.GetRequiredService(typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext))); } } diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs index 4e23a4cb41..a9d9316f41 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.DependencyInjection; using Volo.Abp.Localization; using Volo.Abp.MultiTenancy; using Volo.Abp.Timing; @@ -14,48 +15,23 @@ namespace Volo.Abp.AspNetCore.SignalR { public abstract class AbpHub : Hub { - public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - - protected TService LazyGetRequiredService(ref TService reference) - => LazyGetRequiredService(typeof(TService), ref reference); - - protected TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - return reference; - } + public IServiceProvider ServiceProvider { get; set; } - protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); - private ILoggerFactory _loggerFactory; + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetService(); - protected ILogger Logger => _lazyLogger.Value; - private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); - protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); - private ICurrentUser _currentUser; + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetService(); - protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); - private ICurrentTenant _currentTenant; + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetService(); - protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); - private IAuthorizationService _authorizationService; + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetService(); - protected IClock Clock => LazyGetRequiredService(ref _clock); - private IClock _clock; + protected IClock Clock => LazyServiceProvider.LazyGetService(); - protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); - private IStringLocalizerFactory _stringLocalizerFactory; + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetService(); protected IStringLocalizer L { @@ -102,48 +78,23 @@ namespace Volo.Abp.AspNetCore.SignalR public abstract class AbpHub : Hub where T : class { - public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - - protected TService LazyGetRequiredService(ref TService reference) - => LazyGetRequiredService(typeof(TService), ref reference); - - protected TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - return reference; - } + public IServiceProvider ServiceProvider { get; set; } - protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); - private ILoggerFactory _loggerFactory; + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetService(); - protected ILogger Logger => _lazyLogger.Value; - private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); - protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); - private ICurrentUser _currentUser; + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetService(); - protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); - private ICurrentTenant _currentTenant; + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetService(); - protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); - private IAuthorizationService _authorizationService; + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetService(); - protected IClock Clock => LazyGetRequiredService(ref _clock); - private IClock _clock; + protected IClock Clock => LazyServiceProvider.LazyGetService(); - protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); - private IStringLocalizerFactory _stringLocalizerFactory; + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetService(); protected IStringLocalizer L { diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs index bf654cf6a7..85523d7ee9 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs @@ -1,9 +1,9 @@ using System; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.DependencyInjection; namespace Volo.Abp.BackgroundWorkers { @@ -13,33 +13,14 @@ namespace Volo.Abp.BackgroundWorkers public abstract class BackgroundWorkerBase : IBackgroundWorker { //TODO: Add UOW, Localization and other useful properties..? - public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - protected TService LazyGetRequiredService(ref TService reference) - => LazyGetRequiredService(typeof(TService), ref reference); + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - protected TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } - - return reference; - } + public IServiceProvider ServiceProvider { get; set; } - protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); - private ILoggerFactory _loggerFactory; + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); - protected ILogger Logger => _lazyLogger.Value; - private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); public virtual Task StartAsync(CancellationToken cancellationToken = default) { diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs index 900343800f..232afb4280 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs @@ -33,86 +33,41 @@ namespace Volo.Abp.Application.Services IAuditingEnabled, ITransientDependency { - public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - - protected TService LazyGetRequiredService(ref TService reference) - => LazyGetRequiredService(typeof(TService), ref reference); + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - protected TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } - - return reference; - } + public IServiceProvider ServiceProvider { get; set; } public static string[] CommonPostfixes { get; set; } = { "AppService", "ApplicationService", "Service" }; public List AppliedCrossCuttingConcerns { get; } = new List(); - protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); - private IUnitOfWorkManager _unitOfWorkManager; - - protected IAsyncQueryableExecuter AsyncExecuter => LazyGetRequiredService(ref _asyncExecuter); - private IAsyncQueryableExecuter _asyncExecuter; + protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); - protected Type ObjectMapperContext { get; set; } - protected IObjectMapper ObjectMapper - { - get - { - if (_objectMapper != null) - { - return _objectMapper; - } - - if (ObjectMapperContext == null) - { - return LazyGetRequiredService(ref _objectMapper); - } + protected IAsyncQueryableExecuter AsyncExecuter => LazyServiceProvider.LazyGetRequiredService(); - return LazyGetRequiredService( - typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext), - ref _objectMapper - ); - } - } - private IObjectMapper _objectMapper; + protected Type ObjectMapperContext { get; set; } + protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(provider => + ObjectMapperContext == null + ? provider.GetRequiredService() + : (IObjectMapper) provider.GetRequiredService(typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext))); - public IGuidGenerator GuidGenerator { get; set; } + public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); - protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); - private ILoggerFactory _loggerFactory; + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); - protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); - private ICurrentTenant _currentTenant; + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService(); - protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); - private ICurrentUser _currentUser; + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService(); - protected ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider); - private ISettingProvider _settingProvider; + protected ISettingProvider SettingProvider => LazyServiceProvider.LazyGetRequiredService(); - protected IClock Clock => LazyGetRequiredService(ref _clock); - private IClock _clock; + protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); - protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); - private IAuthorizationService _authorizationService; + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetRequiredService(); - protected IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker); - private IFeatureChecker _featureChecker; + protected IFeatureChecker FeatureChecker => LazyServiceProvider.LazyGetRequiredService(); - protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); - private IStringLocalizerFactory _stringLocalizerFactory; + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetRequiredService(); protected IStringLocalizer L { @@ -141,13 +96,7 @@ namespace Volo.Abp.Application.Services protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; - protected ILogger Logger => _lazyLogger.Value; - private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); - - protected ApplicationService() - { - GuidGenerator = SimpleGuidGenerator.Instance; - } + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); /// /// Checks for given . diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs index 9792cbd0e6..751b938f1d 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs @@ -1,7 +1,7 @@ using System; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.Linq; using Volo.Abp.MultiTenancy; @@ -11,44 +11,20 @@ namespace Volo.Abp.Domain.Services { public abstract class DomainService : IDomainService { + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IServiceProvider ServiceProvider { get; set; } - protected readonly object ServiceProviderLock = new object(); - protected TService LazyGetRequiredService(ref TService reference) - { - if (reference == null) - { - lock (ServiceProviderLock) - { - if (reference == null) - { - reference = ServiceProvider.GetRequiredService(); - } - } - } - - return reference; - } - - protected IClock Clock => LazyGetRequiredService(ref _clock); - private IClock _clock; - - public IGuidGenerator GuidGenerator { get; set; } - - protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); - private ILoggerFactory _loggerFactory; - - protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); - private ICurrentTenant _currentTenant; - - protected IAsyncQueryableExecuter AsyncExecuter => LazyGetRequiredService(ref _asyncExecuter); - private IAsyncQueryableExecuter _asyncExecuter; - - protected ILogger Logger => _lazyLogger.Value; - private Lazy _lazyLogger => new Lazy(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); - - protected DomainService() - { - GuidGenerator = SimpleGuidGenerator.Instance; - } + + protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); + + public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); + + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); + + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService(); + + protected IAsyncQueryableExecuter AsyncExecuter => LazyServiceProvider.LazyGetRequiredService(); + + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); } } diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuConfigurationContext.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuConfigurationContext.cs index e5550d2d09..d5c6ebe468 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuConfigurationContext.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuConfigurationContext.cs @@ -4,35 +4,19 @@ using JetBrains.Annotations; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; +using Volo.Abp.DependencyInjection; namespace Volo.Abp.UI.Navigation { public class MenuConfigurationContext : IMenuConfigurationContext { public IServiceProvider ServiceProvider { get; } - private readonly object _serviceProviderLock = new object(); - private TRef LazyGetRequiredService(Type serviceType, ref TRef reference) - { - if (reference == null) - { - lock (_serviceProviderLock) - { - if (reference == null) - { - reference = (TRef)ServiceProvider.GetRequiredService(serviceType); - } - } - } - - return reference; - } + private readonly IAbpLazyServiceProvider _lazyServiceProvider; - public IAuthorizationService AuthorizationService => LazyGetRequiredService(typeof(IAuthorizationService), ref _authorizationService); - private IAuthorizationService _authorizationService; + public IAuthorizationService AuthorizationService => _lazyServiceProvider.LazyGetRequiredService(); - private IStringLocalizerFactory _stringLocalizerFactory; - public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(typeof(IStringLocalizerFactory),ref _stringLocalizerFactory); + public IStringLocalizerFactory StringLocalizerFactory => _lazyServiceProvider.LazyGetRequiredService(); public ApplicationMenu Menu { get; } @@ -40,6 +24,7 @@ namespace Volo.Abp.UI.Navigation { Menu = menu; ServiceProvider = serviceProvider; + _lazyServiceProvider = ServiceProvider.GetRequiredService(); } public Task IsGrantedAsync(string policyName) @@ -58,7 +43,7 @@ namespace Volo.Abp.UI.Navigation { return StringLocalizerFactory.Create(); } - + [NotNull] public IStringLocalizer GetLocalizer(Type resourceType) { From 07e64331eac66c29323e473db5738d554a4cc545 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 30 Dec 2020 12:06:17 +0800 Subject: [PATCH 010/119] Refactor AbpLazyServiceProvider. --- .../AbpLazyServiceProvider.cs | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs index b085b90722..6c27cd212b 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AbpLazyServiceProvider.cs @@ -6,40 +6,39 @@ namespace Volo.Abp.DependencyInjection { public class AbpLazyServiceProvider : IAbpLazyServiceProvider, ITransientDependency { - protected IDictionary> CachedTypes { get; set; } + protected IDictionary CachedServices { get; set; } protected IServiceProvider ServiceProvider { get; set; } public AbpLazyServiceProvider(IServiceProvider serviceProvider) { ServiceProvider = serviceProvider; - - CachedTypes = new Dictionary>(); + CachedServices = new Dictionary(); } public virtual T LazyGetRequiredService() { - return (T)CachedTypes.GetOrAdd(typeof(T), () => new Lazy(() => (T) ServiceProvider.GetRequiredService(typeof(T)))).Value; + return (T) LazyGetRequiredService(typeof(T)); } public virtual object LazyGetRequiredService(Type serviceType) { - return CachedTypes.GetOrAdd(serviceType, () => new Lazy(() => ServiceProvider.GetRequiredService(serviceType))).Value; + return CachedServices.GetOrAdd(serviceType, () => ServiceProvider.GetRequiredService(serviceType)); } public virtual T LazyGetService() { - return (T)CachedTypes.GetOrAdd(typeof(T), () => new Lazy(() => (T) ServiceProvider.GetService(typeof(T)))).Value; + return (T) LazyGetService(typeof(T)); } public virtual object LazyGetService(Type serviceType) { - return CachedTypes.GetOrAdd(serviceType, () => new Lazy(() => ServiceProvider.GetService(serviceType))).Value; + return CachedServices.GetOrAdd(serviceType, () => ServiceProvider.GetService(serviceType)); } public virtual T LazyGetService(T defaultValue) { - return LazyGetService() ?? defaultValue; + return (T) LazyGetService(typeof(T), defaultValue); } public virtual object LazyGetService(Type serviceType, object defaultValue) @@ -47,14 +46,14 @@ namespace Volo.Abp.DependencyInjection return LazyGetService(serviceType) ?? defaultValue; } - public virtual object LazyGetService(Type serviceType, Func factory) + public virtual T LazyGetService(Func factory) { - return CachedTypes.GetOrAdd(serviceType, () => new Lazy(() => factory(ServiceProvider))).Value; + return (T) LazyGetService(typeof(T), factory); } - public virtual T LazyGetService(Func factory) + public virtual object LazyGetService(Type serviceType, Func factory) { - return (T)CachedTypes.GetOrAdd(typeof(T), () => new Lazy(() => factory(ServiceProvider))).Value; + return CachedServices.GetOrAdd(serviceType, () => factory(ServiceProvider)); } } } From fca49d7948d3faf5a804768f3bbc765f975a4816 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 10:58:20 +0300 Subject: [PATCH 011/119] Added GetList & GetCount methods and cancellationtoken params to PageRepository --- .../Volo/CmsKit/Pages/IPageRepository.cs | 17 +++++-- .../Volo/CmsKit/Pages/EfCorePageRepository.cs | 41 ++++++++++++++--- .../MongoDB/Pages/MongoPageRepository.cs | 46 ++++++++++++++++--- 3 files changed, 89 insertions(+), 15 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs index 95c09474aa..38e38a6f17 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -6,10 +8,19 @@ namespace Volo.CmsKit.Pages { public interface IPageRepository : IBasicRepository { - Task GetByUrlAsync(string url); + Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default); - Task FindByUrlAsync(string url); + Task> GetListAsync( + string filter = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string sorting = null, + CancellationToken cancellationToken = default); + + Task GetByUrlAsync(string url, CancellationToken cancellationToken = default); - Task DoesExistAsync(string url); + Task FindByUrlAsync(string url, CancellationToken cancellationToken = default); + + Task DoesExistAsync(string url, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs index 4502a13b4c..63b9d37ac7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -1,4 +1,8 @@ using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -13,19 +17,44 @@ namespace Volo.CmsKit.Pages { } - public Task GetByUrlAsync(string url) + public virtual Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { - return GetAsync(x => x.Url == url); + return DbSet.WhereIf( + !filter.IsNullOrWhiteSpace(), + x => + x.Title.Contains(filter) + ).CountAsync(GetCancellationToken(cancellationToken)); } - public Task FindByUrlAsync(string url) + public virtual Task> GetListAsync( + string filter = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string sorting = null, + CancellationToken cancellationToken = default) { - return FindAsync(x => x.Url == url); + return DbSet.WhereIf( + !filter.IsNullOrWhiteSpace(), + x => + x.Title.Contains(filter)) + .OrderBy(sorting ?? nameof(Page.Title)) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); } - public Task DoesExistAsync(string url) + public virtual Task GetByUrlAsync(string url, CancellationToken cancellationToken = default) { - return DbSet.AnyAsync(x => x.Url == url); + return GetAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); + } + + public virtual Task FindByUrlAsync(string url, CancellationToken cancellationToken = default) + { + return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); + } + + public virtual Task DoesExistAsync(string url, CancellationToken cancellationToken = default) + { + return DbSet.AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs index e7c6cd32f5..de08724a22 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs @@ -1,5 +1,10 @@ using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; +using MongoDB.Driver; using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; @@ -13,19 +18,48 @@ namespace Volo.CmsKit.MongoDB.Pages { } - public Task GetByUrlAsync(string url) + public virtual Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { - return GetAsync(x => x.Url == url); + return GetMongoQueryable() + .WhereIf>( + !filter.IsNullOrWhiteSpace(), + u => + u.Title.Contains(filter) + ).CountAsync(GetCancellationToken(cancellationToken)); } - public Task FindByUrlAsync(string url) + public virtual Task> GetListAsync( + string filter = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string sorting = null, + CancellationToken cancellationToken = default) { - return FindAsync(x => x.Url == url); + return GetMongoQueryable() + .WhereIf>( + !filter.IsNullOrWhiteSpace(), + u => + u.Title.Contains(filter) + ) + .OrderBy(sorting ?? nameof(Page.Title)) + .As>() + .PageBy>(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual Task GetByUrlAsync(string url, CancellationToken cancellationToken = default) + { + return GetAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); + } + + public virtual Task FindByUrlAsync(string url, CancellationToken cancellationToken = default) + { + return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); } - public Task DoesExistAsync(string url) + public virtual Task DoesExistAsync(string url, CancellationToken cancellationToken = default) { - return GetMongoQueryable().AnyAsync(x => x.Url == url); + return GetMongoQueryable().AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } } } \ No newline at end of file From 5cb176244447545718be6d3dd795a54424a06d19 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 10:58:51 +0300 Subject: [PATCH 012/119] Added Page Admin Permissions --- .../CmsKitAdminPermissionDefinitionProvider.cs | 6 ++++++ .../Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs | 9 +++++++++ .../Volo/CmsKit/Localization/Resources/en.json | 10 +++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs index 2cb6a53b58..f93a73b701 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs @@ -15,6 +15,12 @@ namespace Volo.CmsKit.Permissions .AddChild(CmsKitAdminPermissions.Tags.Create, L("Permission:TagManagement.Create")) .AddChild(CmsKitAdminPermissions.Tags.Update, L("Permission:TagManagement.Update")) .AddChild(CmsKitAdminPermissions.Tags.Delete, L("Permission:TagManagement.Delete")); + + cmsGroup + .AddPermission(CmsKitAdminPermissions.Pages.Default, L("Permission:PageManagement")) + .AddChild(CmsKitAdminPermissions.Pages.Create, L("Permission:PageManagement:Create")) + .AddChild(CmsKitAdminPermissions.Pages.Update, L("Permission:PageManagement:Update")) + .AddChild(CmsKitAdminPermissions.Pages.Delete, L("Permission:PageManagement:Delete")); } private static LocalizableString L(string name) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs index 26daeb0b01..234091188c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs @@ -5,6 +5,7 @@ namespace Volo.CmsKit.Permissions public class CmsKitAdminPermissions { public const string GroupName = "CmsKit"; + public static class Tags { public const string Default = GroupName + ".Tags"; @@ -12,5 +13,13 @@ namespace Volo.CmsKit.Permissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } + + public static class Pages + { + public const string Default = GroupName + ".Pages"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 42d56b8d16..9965b901e7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -11,9 +11,13 @@ "MessageDeletionConfirmationMessage": "This comment will be deleted completely.", "Permission:CmsKit": "CmsKit", "Permission:TagManagement": "Tag Management", - "Permission:TagManagement.Create": "Create Tag", - "Permission:TagManagement.Delete": "Delete Tag", - "Permission:TagManagement.Update": "Update Tag", + "Permission:TagManagement.Create": "Create", + "Permission:TagManagement.Delete": "Delete", + "Permission:TagManagement.Update": "Update", + "Permission:PageManagement": "Page Management", + "Permission:PageManagement:Create": "Create", + "Permission:PageManagement:Delete": "Delete", + "Permission:PageManagement:Update": "Update", "PickYourReaction": "Pick your reaction", "RatingUndoMessage": "Your rating will be undo.", "Reply": "Reply", From 52ebb5f584afee3c87268a73544d7cf20a4691a6 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 11:04:52 +0300 Subject: [PATCH 013/119] Added new tests to PageRepository --- .../Pages/PageRepository_Test.cs | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs index 68b91f72a9..3ece896d32 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Linq; +using System.Threading.Tasks; using Shouldly; using Volo.Abp.Modularity; using Xunit; @@ -17,6 +18,38 @@ namespace Volo.CmsKit.Pages _pageRepository = GetRequiredService(); } + [Fact] + public async Task CountAsync() + { + var totalCount = await _pageRepository.GetCountAsync(); + + totalCount.ShouldBe(2); + + var filteredCount = await _pageRepository.GetCountAsync(_cmsKitTestData.Page_2_Title); + + filteredCount.ShouldBe(1); + } + + [Fact] + public async Task GetListAsync() + { + var list = await _pageRepository.GetListAsync(); + + list.ShouldNotBeNull(); + list.Count.ShouldBe(2); + + var list_page_1 = await _pageRepository.GetListAsync(maxResultCount: 1); + var list_page_2 = await _pageRepository.GetListAsync(maxResultCount: 1, skipCount: 1); + + list_page_1.ShouldNotBeNull(); + list_page_1.Count.ShouldBe(1); + list_page_1.First().Title.ShouldBe(_cmsKitTestData.Page_1_Title); + + list_page_2.ShouldNotBeNull(); + list_page_1.Count.ShouldBe(1); + list_page_2.First().Title.ShouldBe(_cmsKitTestData.Page_2_Title); + } + [Fact] public async Task ShouldGetByUrlAsync() { From 42e128989019efc6c5e905311cd963767a6c0dd9 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 12:16:16 +0300 Subject: [PATCH 014/119] Added new tests to PageAdminAppService --- .../Pages/PageAdminAppService_Tests.cs | 85 ++++++++++--------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs index 59fcc8c8bd..26c917613d 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using Shouldly; using Volo.Abp.Uow; @@ -24,6 +25,33 @@ namespace Volo.CmsKit.Pages _contentRepository = GetRequiredService(); } + [Fact] + public async Task ShouldGetListAsync() + { + var input = new GetPagesInputDto(); + + var pages = await _pageAdminAppService.GetListAsync(input); + + pages.TotalCount.ShouldBe(2); + pages.Items.Count.ShouldBe(2); + + input.MaxResultCount = 1; + + var pages2 = await _pageAdminAppService.GetListAsync(input); + + pages2.TotalCount.ShouldBe(2); + pages2.Items.Count.ShouldBe(1); + pages2.Items.First().Title.ShouldBe(_data.Page_1_Title); + + input.SkipCount = 1; + + var pages3 = await _pageAdminAppService.GetListAsync(input); + + pages3.TotalCount.ShouldBe(2); + pages3.Items.Count.ShouldBe(1); + pages3.Items.First().Title.ShouldBe(_data.Page_2_Title); + } + [Fact] public async Task ShouldGetAsync() { @@ -38,10 +66,11 @@ namespace Volo.CmsKit.Pages var dto = new CreatePageInputDto { Title = "test", - Url = "test-url" + Url = "test-url", + Content = "test-content" }; - await Should.NotThrowAsync(async () => await _pageAdminAppService.CreatePageAsync(dto)); + await Should.NotThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); var page = await _pageRepository.GetByUrlAsync(dto.Url); @@ -54,23 +83,24 @@ namespace Volo.CmsKit.Pages var dto = new CreatePageInputDto { Title = "test", - Url = _data.Page_1_Url + Url = _data.Page_1_Url, + Content = "test-content" }; - await Should.ThrowAsync(async () => await _pageAdminAppService.CreatePageAsync(dto)); + await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); } [Fact] public async Task ShouldCreateWithContentAsync() { - var dto = new CreatePageWithContentInputDto + var dto = new CreatePageInputDto { Title = "test", Url = "test-url", Content = "my-test-content" }; - await Should.NotThrowAsync(async () => await _pageAdminAppService.CreatePageWithContentAsync(dto)); + await Should.NotThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); var page = await _pageRepository.GetByUrlAsync(dto.Url); @@ -82,14 +112,14 @@ namespace Volo.CmsKit.Pages [Fact] public async Task ShouldNotCreateWithContentAsync() { - var dto = new CreatePageWithContentInputDto + var dto = new CreatePageInputDto { Title = "test", Url = _data.Page_1_Url, Content = "my-test-content" }; - await Should.ThrowAsync(async () => await _pageAdminAppService.CreatePageWithContentAsync(dto)); + await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); } [Fact] @@ -99,10 +129,11 @@ namespace Volo.CmsKit.Pages { Title = _data.Page_1_Title + "++", Description = "new description", - Url = _data.Page_1_Url+ "test" + Url = _data.Page_1_Url+ "test", + Content = _data.Page_1_Content + "+" }; - await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdatePageAsync(_data.Page_1_Id, dto)); + await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto)); var updatedPage = await _pageRepository.GetAsync(_data.Page_1_Id); @@ -123,21 +154,17 @@ namespace Volo.CmsKit.Pages { Title = _data.Page_1_Title + "++", Description = "new description", - Url = _data.Page_2_Url + Url = _data.Page_2_Url, + Content = _data.Page_1_Content + "+" }; - await Should.ThrowAsync(async () => await _pageAdminAppService.UpdatePageAsync(_data.Page_1_Id, dto)); + await Should.ThrowAsync(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto)); } [Fact] public async Task ShouldBeExistAsync() { - var dto = new CheckUrlInputDto - { - Url = _data.Page_1_Url - }; - - var doesExist = await _pageAdminAppService.DoesUrlExistAsync(dto); + var doesExist = await _pageAdminAppService.ExistsAsync(_data.Page_1_Url); doesExist.ShouldBeTrue(); } @@ -145,31 +172,11 @@ namespace Volo.CmsKit.Pages [Fact] public async Task ShouldNotBeExistAsync() { - var dto = new CheckUrlInputDto - { - Url = _data.Page_1_Url+ "+" - }; - - var doesExist = await _pageAdminAppService.DoesUrlExistAsync(dto); + var doesExist = await _pageAdminAppService.ExistsAsync(_data.Page_1_Url+ "+"); doesExist.ShouldBeFalse(); } - [Fact] - public async Task ShouldUpdateContentAsync() - { - var dto = new UpdatePageContentInputDto - { - Content = "my-new-content" - }; - - await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdatePageContentAsync(_data.Page_1_Id, dto)); - - var content = await _contentRepository.GetAsync(nameof(Page), _data.Page_1_Id.ToString()); - - content.Value.ShouldBe(dto.Content); - } - [Fact] public async Task ShouldDeleteAsync() { From 15700b45e51478c7f9026bc43e1e9a315666a5e9 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 12:17:03 +0300 Subject: [PATCH 015/119] Rename method of PageRepository --- .../Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs | 2 +- .../Volo/CmsKit/Pages/EfCorePageRepository.cs | 2 +- .../Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs | 2 +- .../test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs index 38e38a6f17..931618f774 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs @@ -21,6 +21,6 @@ namespace Volo.CmsKit.Pages Task FindByUrlAsync(string url, CancellationToken cancellationToken = default); - Task DoesExistAsync(string url, CancellationToken cancellationToken = default); + Task ExistsAsync(string url, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs index 63b9d37ac7..8a7ef2ddab 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -52,7 +52,7 @@ namespace Volo.CmsKit.Pages return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); } - public virtual Task DoesExistAsync(string url, CancellationToken cancellationToken = default) + public virtual Task ExistsAsync(string url, CancellationToken cancellationToken = default) { return DbSet.AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs index de08724a22..0474deb493 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs @@ -57,7 +57,7 @@ namespace Volo.CmsKit.MongoDB.Pages return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); } - public virtual Task DoesExistAsync(string url, CancellationToken cancellationToken = default) + public virtual Task ExistsAsync(string url, CancellationToken cancellationToken = default) { return GetMongoQueryable().AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs index 3ece896d32..67a691c5a8 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs @@ -79,7 +79,7 @@ namespace Volo.CmsKit.Pages [Fact] public async Task ShouldBeExistAsync() { - var page = await _pageRepository.DoesExistAsync(_cmsKitTestData.Page_1_Url); + var page = await _pageRepository.ExistsAsync(_cmsKitTestData.Page_1_Url); page.ShouldBeTrue(); } @@ -87,7 +87,7 @@ namespace Volo.CmsKit.Pages [Fact] public async Task ShouldNotBeExistAsync() { - var page = await _pageRepository.DoesExistAsync("not-exist-lyrics"); + var page = await _pageRepository.ExistsAsync("not-exist-lyrics"); page.ShouldBeFalse(); } From 7929ae01015dbe714948c8fdd4ef0b9675d95422 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 12:52:44 +0300 Subject: [PATCH 016/119] Refactor page app service --- .../CmsKit/Admin/Pages/CheckUrlInputDto.cs | 10 --- .../CmsKit/Admin/Pages/CreatePageInputDto.cs | 3 + .../Pages/CreatePageWithContentInputDto.cs | 18 ----- .../CmsKit/Admin/Pages/GetPagesInputDto.cs | 9 +++ .../Admin/Pages/IPageAdminAppService.cs | 17 +---- .../CmsKit/Admin/Pages/PageWithContentDto.cs | 17 ----- .../Admin/Pages/UpdatePageContentInputDto.cs | 10 --- .../CmsKit/Admin/Pages/UpdatePageInputDto.cs | 3 + .../CmsKit/Admin/Pages/PageAdminAppService.cs | 66 +++++++++-------- .../CmsKit/Admin/Page/PageAdminController.cs | 70 ------------------- .../CmsKit/Admin/Pages/PageAdminController.cs | 70 +++++++++++++++++++ 11 files changed, 126 insertions(+), 167 deletions(-) delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs deleted file mode 100644 index abb1d81c12..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Volo.CmsKit.Admin.Pages -{ - public class CheckUrlInputDto - { - [Required] - public string Url { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs index 50c7a68f32..8956c35bc5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs @@ -11,5 +11,8 @@ namespace Volo.CmsKit.Admin.Pages public string Url { get; set; } public string Description { get; set; } + + [Required] + public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs deleted file mode 100644 index bff09b595b..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Volo.CmsKit.Admin.Pages -{ - public class CreatePageWithContentInputDto - { - [Required] - public string Title { get; set; } - - [Required] - public string Url { get; set; } - - public string Description { get; set; } - - [Required] - public string Content { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs new file mode 100644 index 0000000000..8523eeeffa --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Admin.Pages +{ + public class GetPagesInputDto : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs index 048d2d89c7..f03c4611e0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs @@ -1,22 +1,11 @@ using System; using System.Threading.Tasks; +using Volo.Abp.Application.Services; namespace Volo.CmsKit.Admin.Pages { - public interface IPageAdminAppService + public interface IPageAdminAppService : ICrudAppService { - Task GetAsync(Guid id); - - Task CreatePageAsync(CreatePageInputDto input); - - Task CreatePageWithContentAsync(CreatePageWithContentInputDto input); - - Task UpdatePageAsync(Guid id, UpdatePageInputDto input); - - Task DoesUrlExistAsync(CheckUrlInputDto input); - - Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input); - - Task DeleteAsync(Guid id); + Task ExistsAsync(string url); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs deleted file mode 100644 index 119dedb041..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; -using Volo.CmsKit.Admin.Contents; - -namespace Volo.CmsKit.Admin.Pages -{ - public class PageWithContentDto : EntityDto - { - public string Title { get; set; } - - public string Url { get; set; } - - public string Description { get; set; } - - public ContentDto Content { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs deleted file mode 100644 index f6d46167c8..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Volo.CmsKit.Admin.Pages -{ - public class UpdatePageContentInputDto - { - [Required] - public string Content { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs index eb831fee45..b079ace633 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs @@ -11,5 +11,8 @@ namespace Volo.CmsKit.Admin.Pages public string Url { get; set; } public string Description { get; set; } + + [Required] + public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs index 6778dd7916..f78d1dc55a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs @@ -1,12 +1,20 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.GlobalFeatures; using Volo.CmsKit.Contents; +using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Pages; +using Volo.CmsKit.Permissions; namespace Volo.CmsKit.Admin.Pages { + [RequiresGlobalFeature(typeof(PagesFeature))] + [Authorize(CmsKitAdminPermissions.Pages.Default)] public class PageAdminAppService : CmsKitAdminAppServiceBase, IPageAdminAppService { protected readonly IPageRepository PageRepository; @@ -25,18 +33,28 @@ namespace Volo.CmsKit.Admin.Pages return ObjectMapper.Map(page); } - public virtual async Task CreatePageAsync(CreatePageInputDto input) + public virtual async Task> GetListAsync(GetPagesInputDto input) { - var page = await CreatePageAsync(input.Title, input.Url, input.Description); - - await PageRepository.InsertAsync(page); - - return ObjectMapper.Map(page); + var count = await PageRepository.GetCountAsync(input.Filter); + var pages = await PageRepository.GetListAsync( + input.Filter, + input.MaxResultCount, + input.SkipCount, + input.Sorting + ); + + return new PagedResultDto( + count, + ObjectMapper.Map, List>(pages) + ); } - public virtual async Task CreatePageWithContentAsync(CreatePageWithContentInputDto input) + [Authorize(CmsKitAdminPermissions.Pages.Create)] + public virtual async Task CreateAsync(CreatePageInputDto input) { - var page = await CreatePageAsync(input.Title, input.Url, input.Description); + await CheckPageUrlAsync(input.Url); + + var page = new Page(GuidGenerator.Create(), input.Title, input.Url, input.Description, CurrentTenant?.Id); await PageRepository.InsertAsync(page); @@ -52,7 +70,8 @@ namespace Volo.CmsKit.Admin.Pages return ObjectMapper.Map(page); } - public virtual async Task UpdatePageAsync(Guid id, UpdatePageInputDto input) + [Authorize(CmsKitAdminPermissions.Pages.Update)] + public virtual async Task UpdateAsync(Guid id, UpdatePageInputDto input) { var page = await PageRepository.GetAsync(id); @@ -67,39 +86,30 @@ namespace Volo.CmsKit.Admin.Pages await PageRepository.UpdateAsync(page); - return ObjectMapper.Map(page); - } + var content = await ContentRepository.GetAsync(nameof(Page), page.Id.ToString()); - public virtual Task DoesUrlExistAsync(CheckUrlInputDto input) - { - return PageRepository.DoesExistAsync(input.Url); - } + content.SetValue(input.Content); - public virtual async Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input) - { - var pageContent = await ContentRepository.GetAsync(nameof(Page), id.ToString()); + await ContentRepository.UpdateAsync(content); - pageContent.SetValue(input.Content); + return ObjectMapper.Map(page); + } - await ContentRepository.UpdateAsync(pageContent); + public virtual Task ExistsAsync(string url) + { + return PageRepository.ExistsAsync(url); } + [Authorize(CmsKitAdminPermissions.Pages.Delete)] public virtual async Task DeleteAsync(Guid id) { await ContentRepository.DeleteAsync(nameof(Page), id.ToString(), CurrentTenant?.Id, CancellationToken.None); await PageRepository.DeleteAsync(id, cancellationToken: CancellationToken.None); } - protected virtual async Task CreatePageAsync(string title, string url, string description) - { - await CheckPageUrlAsync(url); - - return new Page(GuidGenerator.Create(), title, url, description, CurrentTenant?.Id); - } - protected virtual async Task CheckPageUrlAsync(string url) { - if (await PageRepository.DoesExistAsync(url)) + if (await PageRepository.ExistsAsync(url)) { throw new UserFriendlyException("Url exist"); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs deleted file mode 100644 index 4e37848e37..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp; -using Volo.CmsKit.Admin.Pages; - -namespace Volo.CmsKit.Admin.Page -{ - [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] - [Area("cms-kit")] - [Route("api/cms-kit-admin/pages")] - public class PageAdminController : CmsKitAdminController, IPageAdminAppService - { - protected readonly IPageAdminAppService PageAdminAppService; - - public PageAdminController(IPageAdminAppService pageAdminAppService) - { - PageAdminAppService = pageAdminAppService; - } - - [HttpGet] - [Route("{id}")] - public virtual Task GetAsync(Guid id) - { - return PageAdminAppService.GetAsync(id); - } - - [HttpPost] - [Route("create")] - public virtual Task CreatePageAsync(CreatePageInputDto input) - { - return PageAdminAppService.CreatePageAsync(input); - } - - [HttpPost] - [Route("create-with-content")] - public virtual Task CreatePageWithContentAsync(CreatePageWithContentInputDto input) - { - return PageAdminAppService.CreatePageWithContentAsync(input); - } - - [HttpPut] - [Route("{id}")] - public virtual Task UpdatePageAsync(Guid id, UpdatePageInputDto input) - { - return PageAdminAppService.UpdatePageAsync(id, input); - } - - [HttpPost] - [Route("does-url-exist")] - public virtual Task DoesUrlExistAsync(CheckUrlInputDto input) - { - return PageAdminAppService.DoesUrlExistAsync(input); - } - - [HttpPut] - [Route("update-content/{id}")] - public virtual Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input) - { - return PageAdminAppService.UpdatePageContentAsync(id, input); - } - - [HttpDelete] - [Route("{id}")] - public virtual Task DeleteAsync(Guid id) - { - return PageAdminAppService.DeleteAsync(id); - } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs new file mode 100644 index 0000000000..94fd8035d0 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs @@ -0,0 +1,70 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Permissions; + +namespace Volo.CmsKit.Admin.Pages +{ + [RequiresGlobalFeature(typeof(PagesFeature))] + [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Area("cms-kit")] + [Authorize(CmsKitAdminPermissions.Pages.Default)] + [Route("api/cms-kit-admin/pages")] + public class PageAdminController : CmsKitAdminController, IPageAdminAppService + { + protected readonly IPageAdminAppService PageAdminAppService; + + public PageAdminController(IPageAdminAppService pageAdminAppService) + { + PageAdminAppService = pageAdminAppService; + } + + [HttpGet] + [Route("{id}")] + public virtual Task GetAsync(Guid id) + { + return PageAdminAppService.GetAsync(id); + } + + [HttpGet] + public virtual Task> GetListAsync(GetPagesInputDto input) + { + return PageAdminAppService.GetListAsync(input); + } + + [HttpPost] + [Authorize(CmsKitAdminPermissions.Pages.Create)] + public virtual Task CreateAsync(CreatePageInputDto input) + { + return PageAdminAppService.CreateAsync(input); + } + + [HttpPost] + [Authorize(CmsKitAdminPermissions.Pages.Update)] + [Route("{id}")] + public virtual Task UpdateAsync(Guid id, UpdatePageInputDto input) + { + return PageAdminAppService.UpdateAsync(id, input); + } + + [HttpDelete] + [Authorize(CmsKitAdminPermissions.Pages.Delete)] + [Route("{id}")] + public virtual Task DeleteAsync(Guid id) + { + return PageAdminAppService.DeleteAsync(id); + } + + [HttpGet] + [Route("exists/{url}")] + public virtual Task ExistsAsync(string url) + { + return PageAdminAppService.ExistsAsync(url); + } + } +} \ No newline at end of file From 65cf9e604f318a4b898164a2d85ec2817ffd8723 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 13:01:36 +0300 Subject: [PATCH 017/119] Update PageAdminController.cs --- .../Volo/CmsKit/Admin/Pages/PageAdminController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs index 94fd8035d0..c925064ee7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs @@ -44,7 +44,7 @@ namespace Volo.CmsKit.Admin.Pages return PageAdminAppService.CreateAsync(input); } - [HttpPost] + [HttpPut] [Authorize(CmsKitAdminPermissions.Pages.Update)] [Route("{id}")] public virtual Task UpdateAsync(Guid id, UpdatePageInputDto input) From 4b53acb32bc1add2c26e8fbb9e22a48ae5791ce4 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 13:14:13 +0300 Subject: [PATCH 018/119] Update CmsKitAdminPermissionDefinitionProvider.cs --- .../CmsKitAdminPermissionDefinitionProvider.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs index f93a73b701..f273f9ac68 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs @@ -1,5 +1,7 @@ using Volo.Abp.Authorization.Permissions; +using Volo.Abp.GlobalFeatures; using Volo.Abp.Localization; +using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Localization; namespace Volo.CmsKit.Permissions @@ -15,12 +17,15 @@ namespace Volo.CmsKit.Permissions .AddChild(CmsKitAdminPermissions.Tags.Create, L("Permission:TagManagement.Create")) .AddChild(CmsKitAdminPermissions.Tags.Update, L("Permission:TagManagement.Update")) .AddChild(CmsKitAdminPermissions.Tags.Delete, L("Permission:TagManagement.Delete")); - - cmsGroup - .AddPermission(CmsKitAdminPermissions.Pages.Default, L("Permission:PageManagement")) - .AddChild(CmsKitAdminPermissions.Pages.Create, L("Permission:PageManagement:Create")) - .AddChild(CmsKitAdminPermissions.Pages.Update, L("Permission:PageManagement:Update")) - .AddChild(CmsKitAdminPermissions.Pages.Delete, L("Permission:PageManagement:Delete")); + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + cmsGroup + .AddPermission(CmsKitAdminPermissions.Pages.Default, L("Permission:PageManagement")) + .AddChild(CmsKitAdminPermissions.Pages.Create, L("Permission:PageManagement:Create")) + .AddChild(CmsKitAdminPermissions.Pages.Update, L("Permission:PageManagement:Update")) + .AddChild(CmsKitAdminPermissions.Pages.Delete, L("Permission:PageManagement:Delete")); + } } private static LocalizableString L(string name) From befabe2336c45b25ed6d6ec3c3b289646e654da5 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 13:22:32 +0300 Subject: [PATCH 019/119] refactoring --- .../CmsKitAdminPermissionDefinitionProvider.cs | 9 ++++----- .../Volo/CmsKit/Public/Pages/PageDto.cs | 2 -- .../Pages/CmsKit/Pages/Index.cshtml | 3 +-- .../CmsKit/Shared/Components/Pages/Default.cshtml | 11 ++++++----- .../Components/Pages/DefaultPageViewComponent.cs | 5 +---- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs index f273f9ac68..c7e3560287 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs @@ -20,11 +20,10 @@ namespace Volo.CmsKit.Permissions if (GlobalFeatureManager.Instance.IsEnabled()) { - cmsGroup - .AddPermission(CmsKitAdminPermissions.Pages.Default, L("Permission:PageManagement")) - .AddChild(CmsKitAdminPermissions.Pages.Create, L("Permission:PageManagement:Create")) - .AddChild(CmsKitAdminPermissions.Pages.Update, L("Permission:PageManagement:Update")) - .AddChild(CmsKitAdminPermissions.Pages.Delete, L("Permission:PageManagement:Delete")); + var pageManagement = cmsGroup.AddPermission(CmsKitAdminPermissions.Pages.Default, L("Permission:PageManagement")); + pageManagement.AddChild(CmsKitAdminPermissions.Pages.Create, L("Permission:PageManagement:Create")); + pageManagement.AddChild(CmsKitAdminPermissions.Pages.Update, L("Permission:PageManagement:Update")); + pageManagement.AddChild(CmsKitAdminPermissions.Pages.Delete, L("Permission:PageManagement:Delete")); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs index 49798d5202..ab8ee9ee80 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs @@ -8,7 +8,5 @@ namespace Volo.CmsKit.Public.Pages public string Title { get; set; } public string Url { get; set; } - - public string Description { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml index 47e73b8b19..c31edaaba8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml @@ -9,6 +9,5 @@ new { pageId = Model.Page.Id, - title = Model.Page.Title, - description = Model.Page.Description + title = Model.Page.Title }) \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml index 1f90458ee7..28af196e39 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml @@ -12,10 +12,11 @@ -

- @Model.Description -

- - @await Component.InvokeAsync(typeof(ContentViewComponent), new { entityType = nameof(Page), entityId = Model.Id.ToString() }) + @await Component.InvokeAsync(typeof(ContentViewComponent), + new + { + entityType = nameof(Page), + entityId = Model.Id.ToString() + })
diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs index 450b7ad97e..c3e02b1f90 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs @@ -21,8 +21,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages var model = new PageViewModel { Id = pageId, - Title = title, - Description = description + Title = title }; return View("~/Pages/CmsKit/Shared/Components/Pages/Default.cshtml", model); @@ -34,7 +33,5 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages public Guid Id { get; set; } public string Title { get; set; } - - public string Description { get; set; } } } \ No newline at end of file From caff23d12813be85341931ade7336cc10181ce78 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 13:31:59 +0300 Subject: [PATCH 020/119] Added dynamic dto validations --- .../Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs | 7 +++++++ .../Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs | 7 +++++++ .../Volo/CmsKit/Contents/ContentConsts.cs | 2 +- .../Volo/CmsKit/Pages/PageConsts.cs | 8 ++++---- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs index 8956c35bc5..7538a9d57e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs @@ -1,18 +1,25 @@ using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Pages { public class CreatePageInputDto { [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] public string Description { get; set; } [Required] + [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs index b079ace633..0920aec112 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs @@ -1,18 +1,25 @@ using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Pages { public class UpdatePageInputDto { [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] public string Description { get; set; } [Required] + [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs index 758a29e81f..4b772b091b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs @@ -10,6 +10,6 @@ namespace Volo.CmsKit.Contents public static int MaxEntityIdLength { get; set; } = CmsEntityConsts.MaxEntityIdLength; // TODO: consider - public static int MaxValueLength = int.MaxValue; + public static int MaxValueLength { get; set; } = int.MaxValue; } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs index 105566c2bd..54deac75e6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs @@ -2,10 +2,10 @@ { public class PageConsts { - public static int MaxTitleLength = 256; + public static int MaxTitleLength { get; set; } = 256; + + public static int MaxUrlLength { get; set; } = 256; - public static int MaxUrlLength = 256; - - public static int MaxDescriptionLength = 515; + public static int MaxDescriptionLength { get; set; } = 515; } } \ No newline at end of file From 57359400cc480f7c74b7440148624aa91cfafe29 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 13:32:32 +0300 Subject: [PATCH 021/119] Update PageConsts.cs --- .../Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs index 54deac75e6..dcafb6a466 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs @@ -6,6 +6,6 @@ public static int MaxUrlLength { get; set; } = 256; - public static int MaxDescriptionLength { get; set; } = 515; + public static int MaxDescriptionLength { get; set; } = 512; } } \ No newline at end of file From c5bd5a9878c4f9bd7ba4a11c5f06e0d893e326e7 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 14:15:16 +0300 Subject: [PATCH 022/119] Added blob-storing --- .../Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs | 4 +++- .../CmsKitHttpApiHostMigrationsDbContext.cs | 2 ++ .../Volo.CmsKit.HttpApi.Host.csproj | 1 + .../host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs | 6 ++++-- .../EntityFrameworkCore/UnifiedDbContext.cs | 2 ++ .../Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj | 1 + .../src/Volo.CmsKit.Domain/Volo.CmsKit.Domain.csproj | 1 + .../Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs | 6 ++++-- 8 files changed, 18 insertions(+), 5 deletions(-) diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs index 57b49409fc..d34f42aa6f 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs @@ -22,6 +22,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.Autofac; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.EntityFrameworkCore; @@ -47,7 +48,8 @@ namespace Volo.CmsKit typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpAspNetCoreSerilogModule) + typeof(AbpAspNetCoreSerilogModule), + typeof(BlobStoringDatabaseEntityFrameworkCoreModule) )] public class CmsKitHttpApiHostModule : AbpModule { diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs index c31c977ebe..d833e84caa 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; namespace Volo.CmsKit.EntityFrameworkCore @@ -16,6 +17,7 @@ namespace Volo.CmsKit.EntityFrameworkCore base.OnModelCreating(modelBuilder); modelBuilder.ConfigureCmsKit(); + modelBuilder.ConfigureBlobStoring(); } } } diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj index 688c47bc87..2fc36d2f4b 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj @@ -24,6 +24,7 @@ + diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs index 2055266d20..b9f562bf98 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs @@ -15,6 +15,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.Autofac; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.SqlServer; @@ -63,8 +64,9 @@ namespace Volo.CmsKit typeof(AbpTenantManagementApplicationModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), - typeof(AbpAspNetCoreSerilogModule) - )] + typeof(AbpAspNetCoreSerilogModule), + typeof(BlobStoringDatabaseEntityFrameworkCoreModule) + )] public class CmsKitWebUnifiedModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs index d1b31e0ae7..fe6c11b300 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore; @@ -28,6 +29,7 @@ namespace Volo.CmsKit.EntityFrameworkCore modelBuilder.ConfigureTenantManagement(); modelBuilder.ConfigureFeatureManagement(); modelBuilder.ConfigureCmsKit(); + modelBuilder.ConfigureBlobStoring(); } } } diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj index 152d740864..1dbafb4ad6 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj @@ -32,6 +32,7 @@ + diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo.CmsKit.Domain.csproj b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo.CmsKit.Domain.csproj index ee064cbedc..fb8c08f39e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo.CmsKit.Domain.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo.CmsKit.Domain.csproj @@ -10,6 +10,7 @@ + diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs index b1937dd6e0..c16734c377 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.Domain; +using Volo.Abp.BlobStoring; +using Volo.Abp.Domain; using Volo.Abp.Modularity; using Volo.Abp.Users; using Volo.CmsKit.Reactions; @@ -8,7 +9,8 @@ namespace Volo.CmsKit [DependsOn( typeof(CmsKitDomainSharedModule), typeof(AbpUsersDomainModule), - typeof(AbpDddDomainModule) + typeof(AbpDddDomainModule), + typeof(AbpBlobStoringModule) )] public class CmsKitDomainModule : AbpModule { From 44fa6c369bd197e9386112d2fa1fd247673d0092 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 31 Dec 2020 15:04:53 +0300 Subject: [PATCH 023/119] added blob storing migration to test apps --- .../20201231111745_Initial.Designer.cs | 531 +++++ .../Migrations/20201231111745_Initial.cs | 309 +++ ...ApiHostMigrationsDbContextModelSnapshot.cs | 529 +++++ ...01231111657_Added_Blob_Storing.Designer.cs | 1725 +++++++++++++++++ .../20201231111657_Added_Blob_Storing.cs | 95 + .../UnifiedDbContextModelSnapshot.cs | 86 +- 6 files changed, 3273 insertions(+), 2 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs new file mode 100644 index 0000000000..28e6976776 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs @@ -0,0 +1,531 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))] + [Migration("20201231111745_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs new file mode 100644 index 0000000000..55f1ed7245 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs @@ -0,0 +1,309 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpBlobContainers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobContainers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsComments", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Text = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: false), + RepliedCommentId = table.Column(type: "uniqueidentifier", nullable: true), + CreatorId = table.Column(type: "uniqueidentifier", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsComments", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsContents", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Value = table.Column(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsContents", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsEntityTags", + columns: table => new + { + TagId = table.Column(type: "uniqueidentifier", nullable: false), + EntityId = table.Column(type: "nvarchar(450)", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId }); + }); + + migrationBuilder.CreateTable( + name: "CmsPages", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Title = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Description = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsPages", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsRatings", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + StarCount = table.Column(type: "smallint", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsRatings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsTags", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsTags", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsUserReactions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ReactionName = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsUserReactions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsUsers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Surname = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + EmailConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + PhoneNumber = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpBlobs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContainerId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Content = table.Column(type: "varbinary(max)", maxLength: 2147483647, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobs", x => x.Id); + table.ForeignKey( + name: "FK_AbpBlobs_AbpBlobContainers_ContainerId", + column: x => x.ContainerId, + principalTable: "AbpBlobContainers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobContainers_TenantId_Name", + table: "AbpBlobContainers", + columns: new[] { "TenantId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_ContainerId", + table: "AbpBlobs", + column: "ContainerId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_TenantId_ContainerId_Name", + table: "AbpBlobs", + columns: new[] { "TenantId", "ContainerId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsComments_TenantId_EntityType_EntityId", + table: "CmsComments", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsComments_TenantId_RepliedCommentId", + table: "CmsComments", + columns: new[] { "TenantId", "RepliedCommentId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsContents_TenantId_EntityType_EntityId", + table: "CmsContents", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsEntityTags_TenantId_EntityId_TagId", + table: "CmsEntityTags", + columns: new[] { "TenantId", "EntityId", "TagId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsPages_TenantId_Url", + table: "CmsPages", + columns: new[] { "TenantId", "Url" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId", + table: "CmsRatings", + columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsTags_TenantId_Name", + table: "CmsTags", + columns: new[] { "TenantId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName", + table: "CmsUserReactions", + columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUserReactions_TenantId_EntityType_EntityId_ReactionName", + table: "CmsUserReactions", + columns: new[] { "TenantId", "EntityType", "EntityId", "ReactionName" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUsers_TenantId_Email", + table: "CmsUsers", + columns: new[] { "TenantId", "Email" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUsers_TenantId_UserName", + table: "CmsUsers", + columns: new[] { "TenantId", "UserName" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpBlobs"); + + migrationBuilder.DropTable( + name: "CmsComments"); + + migrationBuilder.DropTable( + name: "CmsContents"); + + migrationBuilder.DropTable( + name: "CmsEntityTags"); + + migrationBuilder.DropTable( + name: "CmsPages"); + + migrationBuilder.DropTable( + name: "CmsRatings"); + + migrationBuilder.DropTable( + name: "CmsTags"); + + migrationBuilder.DropTable( + name: "CmsUserReactions"); + + migrationBuilder.DropTable( + name: "CmsUsers"); + + migrationBuilder.DropTable( + name: "AbpBlobContainers"); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs new file mode 100644 index 0000000000..cd29086668 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -0,0 +1,529 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))] + partial class CmsKitHttpApiHostMigrationsDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs new file mode 100644 index 0000000000..15e01fa673 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs @@ -0,0 +1,1725 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20201231111657_Added_Blob_Storing")] + partial class Added_Blob_Storing + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs new file mode 100644 index 0000000000..11cf1901fa --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs @@ -0,0 +1,95 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_Blob_Storing : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Description", + table: "CmsPages", + type: "nvarchar(512)", + maxLength: 512, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(515)", + oldMaxLength: 515, + oldNullable: true); + + migrationBuilder.CreateTable( + name: "AbpBlobContainers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobContainers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpBlobs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContainerId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Content = table.Column(type: "varbinary(max)", maxLength: 2147483647, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobs", x => x.Id); + table.ForeignKey( + name: "FK_AbpBlobs_AbpBlobContainers_ContainerId", + column: x => x.ContainerId, + principalTable: "AbpBlobContainers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobContainers_TenantId_Name", + table: "AbpBlobContainers", + columns: new[] { "TenantId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_ContainerId", + table: "AbpBlobs", + column: "ContainerId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_TenantId_ContainerId_Name", + table: "AbpBlobs", + columns: new[] { "TenantId", "ContainerId", "Name" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpBlobs"); + + migrationBuilder.DropTable( + name: "AbpBlobContainers"); + + migrationBuilder.AlterColumn( + name: "Description", + table: "CmsPages", + type: "nvarchar(515)", + maxLength: 515, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(512)", + oldMaxLength: 512, + oldNullable: true); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index 37622217c5..074d655f16 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -273,6 +273,79 @@ namespace Volo.CmsKit.Migrations b.ToTable("AbpEntityPropertyChanges"); }); + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => { b.Property("Id") @@ -1197,8 +1270,8 @@ namespace Volo.CmsKit.Migrations .HasColumnName("DeletionTime"); b.Property("Description") - .HasMaxLength(515) - .HasColumnType("nvarchar(515)"); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") @@ -1499,6 +1572,15 @@ namespace Volo.CmsKit.Migrations .IsRequired(); }); + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.HasOne("Volo.Abp.Identity.IdentityRole", null) From 79ca12d963effcb9bd74ab8169c4573d270d9c47 Mon Sep 17 00:00:00 2001 From: maliming Date: Sun, 3 Jan 2021 20:05:47 +0800 Subject: [PATCH 024/119] Fix merge conflicts. --- .../src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs index c0db5cf517..028fa9a15a 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs @@ -52,7 +52,7 @@ namespace Volo.Abp.Uow { var defaultOptions = _serviceProvider.GetRequiredService>().Value; options.IsTransactional = defaultOptions.CalculateIsTransactional( - autoValue: _transactionBehaviourProvider.IsTransactional + autoValue: _serviceProvider.GetRequiredService().IsTransactional ?? !invocation.Method.Name.StartsWith("Get", StringComparison.InvariantCultureIgnoreCase) ); } From e2feaef57d0ecdf77c8992e88c3ea17704aad6c8 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 4 Jan 2021 10:33:51 +0800 Subject: [PATCH 025/119] Use IServiceScopeFactory in some interceptors. --- .../Volo/Abp/Auditing/AuditingInterceptor.cs | 45 ++++++++++--------- .../Authorization/AuthorizationInterceptor.cs | 2 +- .../Volo/Abp/Features/FeatureInterceptor.cs | 19 ++++---- .../Volo/Abp/Uow/UnitOfWorkInterceptor.cs | 40 +++++++++-------- 4 files changed, 58 insertions(+), 48 deletions(-) diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs index 681dc0eb0d..9142db5617 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs @@ -10,11 +10,11 @@ namespace Volo.Abp.Auditing { public class AuditingInterceptor : AbpInterceptor, ITransientDependency { - private readonly IServiceProvider _serviceProvider; + private readonly IServiceScopeFactory _serviceScopeFactory; - public AuditingInterceptor(IServiceProvider serviceProvider) + public AuditingInterceptor(IServiceScopeFactory serviceScopeFactory) { - _serviceProvider = serviceProvider; + _serviceScopeFactory = serviceScopeFactory; } public override async Task InterceptAsync(IAbpMethodInvocation invocation) @@ -57,28 +57,31 @@ namespace Volo.Abp.Auditing return false; } - var auditingManager = _serviceProvider.GetRequiredService(); - var auditLogScope = auditingManager.Current; - if (auditLogScope == null) + using (var scope = _serviceScopeFactory.CreateScope()) { - return false; - } + var auditingManager = scope.ServiceProvider.GetRequiredService(); + var auditLogScope = auditingManager.Current; + if (auditLogScope == null) + { + return false; + } - var auditingHelper = _serviceProvider.GetRequiredService(); - if (!auditingHelper.ShouldSaveAudit(invocation.Method)) - { - return false; - } + var auditingHelper = scope.ServiceProvider.GetRequiredService(); + if (!auditingHelper.ShouldSaveAudit(invocation.Method)) + { + return false; + } - auditLog = auditLogScope.Log; - auditLogAction = auditingHelper.CreateAuditLogAction( - auditLog, - invocation.TargetObject.GetType(), - invocation.Method, - invocation.Arguments - ); + auditLog = auditLogScope.Log; + auditLogAction = auditingHelper.CreateAuditLogAction( + auditLog, + invocation.TargetObject.GetType(), + invocation.Method, + invocation.Arguments + ); - return true; + return true; + } } } } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs index 82f4adeabe..44466884dd 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.Authorization _methodInvocationAuthorizationService = methodInvocationAuthorizationService; } - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { await AuthorizeAsync(invocation); await invocation.ProceedAsync(); diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs index aff34d358f..8c0936bede 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs @@ -9,11 +9,11 @@ namespace Volo.Abp.Features { public class FeatureInterceptor : AbpInterceptor, ITransientDependency { - private readonly IServiceProvider _serviceProvider; + private readonly IServiceScopeFactory _serviceScopeFactory; - public FeatureInterceptor(IServiceProvider serviceProvider) + public FeatureInterceptor(IServiceScopeFactory serviceScopeFactory) { - _serviceProvider = serviceProvider; + _serviceScopeFactory = serviceScopeFactory; } public override async Task InterceptAsync(IAbpMethodInvocation invocation) @@ -30,11 +30,14 @@ namespace Volo.Abp.Features protected virtual async Task CheckFeaturesAsync(IAbpMethodInvocation invocation) { - await _serviceProvider.GetRequiredService().CheckAsync( - new MethodInvocationFeatureCheckerContext( - invocation.Method - ) - ); + using (var scope = _serviceScopeFactory.CreateScope()) + { + await scope.ServiceProvider.GetRequiredService().CheckAsync( + new MethodInvocationFeatureCheckerContext( + invocation.Method + ) + ); + } } } } diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs index 028fa9a15a..3d8654adb0 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs @@ -10,11 +10,11 @@ namespace Volo.Abp.Uow { public class UnitOfWorkInterceptor : AbpInterceptor, ITransientDependency { - private readonly IServiceProvider _serviceProvider; + private readonly IServiceScopeFactory _serviceScopeFactory; - public UnitOfWorkInterceptor(IServiceProvider serviceProvider) + public UnitOfWorkInterceptor(IServiceScopeFactory serviceScopeFactory) { - _serviceProvider = serviceProvider; + _serviceScopeFactory = serviceScopeFactory; } public override async Task InterceptAsync(IAbpMethodInvocation invocation) @@ -25,24 +25,28 @@ namespace Volo.Abp.Uow return; } - var options = CreateOptions(invocation, unitOfWorkAttribute); - var unitOfWorkManager = _serviceProvider.GetRequiredService(); - - //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware - if (unitOfWorkManager.TryBeginReserved(UnitOfWork.UnitOfWorkReservationName, options)) + using (var scope = _serviceScopeFactory.CreateScope()) { - await invocation.ProceedAsync(); - return; - } + var options = CreateOptions(scope.ServiceProvider, invocation, unitOfWorkAttribute); - using (var uow = unitOfWorkManager.Begin(options)) - { - await invocation.ProceedAsync(); - await uow.CompleteAsync(); + var unitOfWorkManager = scope.ServiceProvider.GetRequiredService(); + + //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware + if (unitOfWorkManager.TryBeginReserved(UnitOfWork.UnitOfWorkReservationName, options)) + { + await invocation.ProceedAsync(); + return; + } + + using (var uow = unitOfWorkManager.Begin(options)) + { + await invocation.ProceedAsync(); + await uow.CompleteAsync(); + } } } - private AbpUnitOfWorkOptions CreateOptions(IAbpMethodInvocation invocation, [CanBeNull] UnitOfWorkAttribute unitOfWorkAttribute) + private AbpUnitOfWorkOptions CreateOptions(IServiceProvider serviceProvider, IAbpMethodInvocation invocation, [CanBeNull] UnitOfWorkAttribute unitOfWorkAttribute) { var options = new AbpUnitOfWorkOptions(); @@ -50,9 +54,9 @@ namespace Volo.Abp.Uow if (unitOfWorkAttribute?.IsTransactional == null) { - var defaultOptions = _serviceProvider.GetRequiredService>().Value; + var defaultOptions = serviceProvider.GetRequiredService>().Value; options.IsTransactional = defaultOptions.CalculateIsTransactional( - autoValue: _serviceProvider.GetRequiredService().IsTransactional + autoValue: serviceProvider.GetRequiredService().IsTransactional ?? !invocation.Method.Name.StartsWith("Get", StringComparison.InvariantCultureIgnoreCase) ); } From b4e9b7aac22320797169f465118aa78658b61d58 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 4 Jan 2021 13:34:40 +0800 Subject: [PATCH 026/119] Make FeatureManagementProvider's NormalizeProviderKey method async. --- .../EditionFeatureManagementProvider.cs | 13 +++++++------ .../FeatureManagement/FeatureManagementProvider.cs | 10 +++++----- .../TenantFeatureManagementProvider.cs | 11 ++++++----- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/EditionFeatureManagementProvider.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/EditionFeatureManagementProvider.cs index d904ef124a..0106e56af2 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/EditionFeatureManagementProvider.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/EditionFeatureManagementProvider.cs @@ -1,4 +1,5 @@ using System.Security.Principal; +using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Features; using Volo.Abp.Security.Claims; @@ -12,21 +13,21 @@ namespace Volo.Abp.FeatureManagement protected ICurrentPrincipalAccessor PrincipalAccessor { get; } public EditionFeatureManagementProvider( - IFeatureManagementStore store, - ICurrentPrincipalAccessor principalAccessor) + IFeatureManagementStore store, + ICurrentPrincipalAccessor principalAccessor) : base(store) { PrincipalAccessor = principalAccessor; } - protected override string NormalizeProviderKey(string providerKey) + protected override Task NormalizeProviderKeyAsync(string providerKey) { if (providerKey != null) { - return providerKey; + return Task.FromResult(providerKey); } - return PrincipalAccessor.Principal?.FindEditionId()?.ToString("N"); + return Task.FromResult(PrincipalAccessor.Principal?.FindEditionId()?.ToString("N")); } } -} \ No newline at end of file +} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs index 45e5f65b4c..42b275c01b 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs @@ -21,22 +21,22 @@ namespace Volo.Abp.FeatureManagement public virtual async Task GetOrNullAsync(FeatureDefinition feature, string providerKey) { - return await Store.GetOrNullAsync(feature.Name, Name, NormalizeProviderKey(providerKey)); + return await Store.GetOrNullAsync(feature.Name, Name, await NormalizeProviderKeyAsync(providerKey)); } public virtual async Task SetAsync(FeatureDefinition feature, string value, string providerKey) { - await Store.SetAsync(feature.Name, value, Name, NormalizeProviderKey(providerKey)); + await Store.SetAsync(feature.Name, value, Name, await NormalizeProviderKeyAsync(providerKey)); } public virtual async Task ClearAsync(FeatureDefinition feature, string providerKey) { - await Store.DeleteAsync(feature.Name, Name, NormalizeProviderKey(providerKey)); + await Store.DeleteAsync(feature.Name, Name, await NormalizeProviderKeyAsync(providerKey)); } - protected virtual string NormalizeProviderKey(string providerKey) + protected virtual Task NormalizeProviderKeyAsync(string providerKey) { - return providerKey; + return Task.FromResult(providerKey); } } } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/TenantFeatureManagementProvider.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/TenantFeatureManagementProvider.cs index 91302580d2..4e822fd7e0 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/TenantFeatureManagementProvider.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/TenantFeatureManagementProvider.cs @@ -1,4 +1,5 @@ -using Volo.Abp.DependencyInjection; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; using Volo.Abp.Features; using Volo.Abp.MultiTenancy; @@ -18,14 +19,14 @@ namespace Volo.Abp.FeatureManagement CurrentTenant = currentTenant; } - protected override string NormalizeProviderKey(string providerKey) + protected override Task NormalizeProviderKeyAsync(string providerKey) { if (providerKey != null) { - return providerKey; + return Task.FromResult(providerKey); } - return CurrentTenant.Id?.ToString(); + return Task.FromResult(CurrentTenant.Id?.ToString()); } } -} \ No newline at end of file +} From e1c75a8da9dc94ec284dd447d56ba964df6444a1 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 4 Jan 2021 10:54:25 +0300 Subject: [PATCH 027/119] Don't show confirmation on document cache clear --- .../Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js index 29c55502d9..cf9efef8a7 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js @@ -51,9 +51,6 @@ visible: abp.auth.isGranted( 'Docs.Admin.Documents' ), - confirmMessage: function (data) { - return l('RemoveFromCacheConfirmation'); - }, action: function (data) { service .removeFromCache(data.record.id) From 65a0ca8e75111205e2520ec6a6f38599097e31c8 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 4 Jan 2021 10:57:01 +0300 Subject: [PATCH 028/119] Update index.js --- .../src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js index cf9efef8a7..9216480c95 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js @@ -55,7 +55,6 @@ service .removeFromCache(data.record.id) .then(function () { - abp.message.success(l('RemovedFromCache')); dataTable.ajax.reload(); }); }, From c5fa1bd08829e54a8e88ea379458dd7a01e221e9 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 4 Jan 2021 10:57:44 +0300 Subject: [PATCH 029/119] added image methods --- .../Admin/Pages/IPageAdminAppService.cs | 5 +++ .../Volo.CmsKit.Admin.Application.csproj | 1 + .../Admin/CmsKitAdminApplicationModule.cs | 2 ++ .../CmsKit/Admin/Pages/PageAdminAppService.cs | 26 +++++++++++++- .../CmsKit/Admin/Pages/PageAdminController.cs | 19 +++++++++++ .../Volo/CmsKit/Pages/PageImageContainer.cs | 10 ++++++ .../CmsKitTestBaseModule.cs | 13 +++++++ .../Volo.CmsKit.TestBase/FakeBlobProvider.cs | 34 +++++++++++++++++++ .../Volo.CmsKit.TestBase.csproj | 1 + 9 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageImageContainer.cs create mode 100644 modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs index f03c4611e0..395ce263a3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs @@ -1,11 +1,16 @@ using System; using System.Threading.Tasks; using Volo.Abp.Application.Services; +using Volo.Abp.Content; namespace Volo.CmsKit.Admin.Pages { public interface IPageAdminAppService : ICrudAppService { Task ExistsAsync(string url); + + Task SetImageAsync(Guid id, RemoteStreamContent content); + + Task GetImageAsync(Guid id); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo.CmsKit.Admin.Application.csproj b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo.CmsKit.Admin.Application.csproj index bf1ff4f610..e9c2bffeb5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo.CmsKit.Admin.Application.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo.CmsKit.Admin.Application.csproj @@ -11,6 +11,7 @@ + diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs index b34e918058..21782a663b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AutoMapper; +using Volo.Abp.BlobStoring; using Volo.Abp.Modularity; namespace Volo.CmsKit.Admin @@ -7,6 +8,7 @@ namespace Volo.CmsKit.Admin [DependsOn( typeof(CmsKitAdminApplicationContractsModule), typeof(AbpAutoMapperModule), + typeof(AbpBlobStoringModule), typeof(CmsKitCommonApplicationModule) )] public class CmsKitAdminApplicationModule : AbpModule diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs index f78d1dc55a..cbe8310ca5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs @@ -5,6 +5,8 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.BlobStoring; +using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.Contents; using Volo.CmsKit.GlobalFeatures; @@ -20,10 +22,16 @@ namespace Volo.CmsKit.Admin.Pages protected readonly IPageRepository PageRepository; protected readonly IContentRepository ContentRepository; - public PageAdminAppService(IPageRepository pageRepository, IContentRepository contentRepository) + protected readonly IBlobContainer BlobContainer; + + public PageAdminAppService( + IPageRepository pageRepository, + IContentRepository contentRepository, + IBlobContainer blobContainer) { PageRepository = pageRepository; ContentRepository = contentRepository; + BlobContainer = blobContainer; } public virtual async Task GetAsync(Guid id) @@ -36,6 +44,7 @@ namespace Volo.CmsKit.Admin.Pages public virtual async Task> GetListAsync(GetPagesInputDto input) { var count = await PageRepository.GetCountAsync(input.Filter); + var pages = await PageRepository.GetListAsync( input.Filter, input.MaxResultCount, @@ -100,6 +109,21 @@ namespace Volo.CmsKit.Admin.Pages return PageRepository.ExistsAsync(url); } + [Authorize(CmsKitAdminPermissions.Pages.Update)] + public virtual async Task SetImageAsync(Guid id, RemoteStreamContent content) + { + var page = await PageRepository.GetAsync(id); + + await BlobContainer.SaveAsync(page.Id.ToString(), content.GetStream()); + } + + public virtual async Task GetImageAsync(Guid id) + { + var blobStream = await BlobContainer.GetAsync(id.ToString()); + + return new RemoteStreamContent(blobStream); + } + [Authorize(CmsKitAdminPermissions.Pages.Delete)] public virtual async Task DeleteAsync(Guid id) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs index c925064ee7..de1aafbe35 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Permissions; @@ -66,5 +67,23 @@ namespace Volo.CmsKit.Admin.Pages { return PageAdminAppService.ExistsAsync(url); } + + [HttpPost] + [Route("set-image/{id}")] + public virtual Task SetImageAsync(Guid id, [FromBody]RemoteStreamContent content) + { + return PageAdminAppService.SetImageAsync(id, content); + } + + [HttpGet] + [Route("image/{id}")] + public virtual Task GetImageAsync(Guid id) + { + Response.Headers.Add("Content-Disposition", "inline;"); + Response.Headers.Add("Accept-Ranges", "bytes"); + Response.ContentType = "image/xyz"; + + return PageAdminAppService.GetImageAsync(id); + } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageImageContainer.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageImageContainer.cs new file mode 100644 index 0000000000..1c48d58688 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageImageContainer.cs @@ -0,0 +1,10 @@ +using Volo.Abp.BlobStoring; + +namespace Volo.CmsKit.Pages +{ + [BlobContainerName("cms-kit-page-image")] + public class PageImageContainer + { + + } +} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs index 8e5049f55e..e12f3d31e8 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs @@ -1,11 +1,14 @@ using Microsoft.Extensions.DependencyInjection; +using NSubstitute; using Volo.Abp; using Volo.Abp.Authorization; using Volo.Abp.Autofac; +using Volo.Abp.BlobStoring; using Volo.Abp.Data; using Volo.Abp.GlobalFeatures; using Volo.Abp.Modularity; using Volo.Abp.Threading; +using Volo.FileManagement; namespace Volo.CmsKit { @@ -26,6 +29,16 @@ namespace Volo.CmsKit GlobalFeatureManager.Instance.Modules.CmsKit().EnableAll(); }); + context.Services.AddSingleton(Substitute.For()); + + Configure(options => + { + options.Containers.ConfigureAll((containerName, containerConfiguration) => + { + containerConfiguration.ProviderType = typeof(FakeBlobProvider); + }); + }); + context.Services.AddAlwaysAllowAuthorization(); } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs new file mode 100644 index 0000000000..1f3db06e6e --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs @@ -0,0 +1,34 @@ +using System.IO; +using System.Threading.Tasks; +using Volo.Abp.BlobStoring; + +namespace Volo.FileManagement +{ + public class FakeBlobProvider : IBlobProvider + { + public virtual Task SaveAsync(BlobProviderSaveArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task DeleteAsync(BlobProviderDeleteArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task ExistsAsync(BlobProviderExistsArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task GetAsync(BlobProviderGetArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task GetOrNullAsync(BlobProviderGetArgs args) + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj b/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj index 35c8c151ea..66c009b9a9 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj @@ -15,6 +15,7 @@ + From eaaa8b4acef83e2d0d1927a030b1ec6cf2d39a57 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 4 Jan 2021 17:01:19 +0800 Subject: [PATCH 030/119] Always use Repository.GetQueryableAsync() in the method of RepositoryAsyncExtensions class --- .../Repositories/RepositoryAsyncExtensions.cs | 215 +++++++++++------- 1 file changed, 129 insertions(+), 86 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs index acc1c3a1bd..87f119016d 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs @@ -26,415 +26,458 @@ namespace Volo.Abp.Domain.Repositories #region Any/All - public static Task AnyAsync( + public static async Task AnyAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AnyAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AnyAsync(queryable, predicate, cancellationToken); } - public static Task AllAsync( + public static async Task AllAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AllAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AllAsync(queryable, predicate, cancellationToken); } #endregion #region Count/LongCount - public static Task CountAsync( + public static async Task CountAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.CountAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.CountAsync(queryable, cancellationToken); } - public static Task CountAsync( + public static async Task CountAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.CountAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.CountAsync(queryable, predicate, cancellationToken); } - public static Task LongCountAsync( + public static async Task LongCountAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.LongCountAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.LongCountAsync(queryable, cancellationToken); } - public static Task LongCountAsync( + public static async Task LongCountAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.LongCountAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.LongCountAsync(queryable, predicate, cancellationToken); } #endregion #region First/FirstOrDefault - public static Task FirstAsync( + public static async Task FirstAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.FirstAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.FirstAsync(queryable, cancellationToken); } - public static Task FirstAsync( + public static async Task FirstAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.FirstAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.FirstAsync(queryable, predicate, cancellationToken); } - public static Task FirstOrDefaultAsync( + public static async Task FirstOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.FirstOrDefaultAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.FirstOrDefaultAsync(queryable, cancellationToken); } - public static Task FirstOrDefaultAsync( + public static async Task FirstOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.FirstOrDefaultAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.FirstOrDefaultAsync(queryable, predicate, cancellationToken); } #endregion #region Last/LastOrDefault - public static Task LastAsync( + public static async Task LastAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.LastAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.LastAsync(queryable, cancellationToken); } - public static Task LastAsync( + public static async Task LastAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.LastAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.LastAsync(queryable, predicate, cancellationToken); } - public static Task LastOrDefaultAsync( + public static async Task LastOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.LastOrDefaultAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.LastOrDefaultAsync(queryable, cancellationToken); } - public static Task LastOrDefaultAsync( + public static async Task LastOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.LastOrDefaultAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.LastOrDefaultAsync(queryable, predicate, cancellationToken); } #endregion #region Single/SingleOrDefault - public static Task SingleAsync( + public static async Task SingleAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SingleAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SingleAsync(queryable, cancellationToken); } - public static Task SingleAsync( + public static async Task SingleAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SingleAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SingleAsync(queryable, predicate, cancellationToken); } - public static Task SingleOrDefaultAsync( + public static async Task SingleOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SingleOrDefaultAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SingleOrDefaultAsync(queryable, cancellationToken); } - public static Task SingleOrDefaultAsync( + public static async Task SingleOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SingleOrDefaultAsync(repository, predicate, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SingleOrDefaultAsync(queryable, predicate, cancellationToken); } #endregion #region Min - public static Task MinAsync( + public static async Task MinAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.MinAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.MinAsync(queryable, cancellationToken); } - public static Task MinAsync( + public static async Task MinAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.MinAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.MinAsync(queryable, selector, cancellationToken); } #endregion #region Max - public static Task MaxAsync( + public static async Task MaxAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.MaxAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.MaxAsync(queryable, cancellationToken); } - public static Task MaxAsync( + public static async Task MaxAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.MaxAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.MaxAsync(queryable, selector, cancellationToken); } #endregion #region Sum - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } - public static Task SumAsync( + public static async Task SumAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.SumAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.SumAsync(queryable, selector, cancellationToken); } #endregion #region Average - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } - public static Task AverageAsync( + public static async Task AverageAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> selector, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.AverageAsync(repository, selector, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.AverageAsync(queryable, selector, cancellationToken); } #endregion #region ToList/Array - public static Task> ToListAsync( + public static async Task> ToListAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.ToListAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.ToListAsync(queryable, cancellationToken); } - public static Task ToArrayAsync( + public static async Task ToArrayAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity { - return repository.AsyncExecuter.ToArrayAsync(repository, cancellationToken); + var queryable = await repository.GetQueryableAsync(); + return await repository.AsyncExecuter.ToArrayAsync(queryable, cancellationToken); } #endregion From d012f8e70a80816d671cde0e3337406294cd31a5 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 4 Jan 2021 14:08:42 +0300 Subject: [PATCH 031/119] Update PageAdminController.cs --- .../CmsKit/Admin/Pages/PageAdminController.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs index de1aafbe35..60a5d86584 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; @@ -69,12 +70,28 @@ namespace Volo.CmsKit.Admin.Pages } [HttpPost] - [Route("set-image/{id}")] - public virtual Task SetImageAsync(Guid id, [FromBody]RemoteStreamContent content) + [Authorize(CmsKitAdminPermissions.Pages.Update)] + [Route("image/{id}")] + public virtual Task SetImageAsync(Guid id, RemoteStreamContent content) { return PageAdminAppService.SetImageAsync(id, content); } + [HttpPost] + [Authorize(CmsKitAdminPermissions.Pages.Update)] + [Route("upload-image/{id}")] + public virtual async Task UploadImageAsync(Guid id, IFormFile file) + { + if (file == null || file.Length == 0) + { + return BadRequest(); + } + + await PageAdminAppService.SetImageAsync(id, new RemoteStreamContent(file.OpenReadStream())); + + return StatusCode(201); + } + [HttpGet] [Route("image/{id}")] public virtual Task GetImageAsync(Guid id) From ba94b4df37c8d1f42205f0e27a4ae0f03a0f1a6d Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 4 Jan 2021 14:14:08 +0300 Subject: [PATCH 032/119] Update EfCorePageRepository.cs --- .../Volo/CmsKit/Pages/EfCorePageRepository.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs index 0fbfa1d568..794281fa01 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -56,10 +56,5 @@ namespace Volo.CmsKit.Pages { return (await GetDbSetAsync()).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } - - public async Task DoesExistAsync(string url) - { - return await (await GetDbSetAsync()).AnyAsync(x => x.Url == url); - } } } From dd2585b4027b2f7be6fd3a40d19d33b059a6e6ac Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 4 Jan 2021 14:19:36 +0300 Subject: [PATCH 033/119] Fix async dbset --- .../Volo/CmsKit/Pages/EfCorePageRepository.cs | 12 ++++++------ .../Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs index 794281fa01..2fc6d92c52 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -17,23 +17,23 @@ namespace Volo.CmsKit.Pages { } - public virtual Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { - return (await GetDbSetAsync()).WhereIf( + return await (await GetDbSetAsync()).WhereIf( !filter.IsNullOrWhiteSpace(), x => x.Title.Contains(filter) ).CountAsync(GetCancellationToken(cancellationToken)); } - public virtual Task> GetListAsync( + public virtual async Task> GetListAsync( string filter = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, CancellationToken cancellationToken = default) { - return (await GetDbSetAsync()).WhereIf( + return await (await GetDbSetAsync()).WhereIf( !filter.IsNullOrWhiteSpace(), x => x.Title.Contains(filter)) @@ -52,9 +52,9 @@ namespace Volo.CmsKit.Pages return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); } - public virtual Task ExistsAsync(string url, CancellationToken cancellationToken = default) + public virtual async Task ExistsAsync(string url, CancellationToken cancellationToken = default) { - return (await GetDbSetAsync()).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); + return await (await GetDbSetAsync()).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs index 00700bd091..1aecf4bf97 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs @@ -18,9 +18,9 @@ namespace Volo.CmsKit.MongoDB.Pages { } - public virtual Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { - return (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) .WhereIf>( !filter.IsNullOrWhiteSpace(), u => @@ -28,14 +28,14 @@ namespace Volo.CmsKit.MongoDB.Pages ).CountAsync(GetCancellationToken(cancellationToken)); } - public virtual Task> GetListAsync( + public virtual async Task> GetListAsync( string filter = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, CancellationToken cancellationToken = default) { - return (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) .WhereIf>( !filter.IsNullOrWhiteSpace(), u => @@ -57,9 +57,9 @@ namespace Volo.CmsKit.MongoDB.Pages return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); } - public virtual Task ExistsAsync(string url, CancellationToken cancellationToken = default) + public virtual async Task ExistsAsync(string url, CancellationToken cancellationToken = default) { - return (await GetMongoQueryableAsync()).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); + return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } } } From 28d1690b14385b7408e962b5758e886de788bccc Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 5 Jan 2021 13:30:56 +0800 Subject: [PATCH 034/119] Add hard delete by predicate for IRepository. Resolve #6925 --- .../Repositories/RepositoryExtensions.cs | 67 ++++++++++++++++++- .../Abp/TestApp/Testing/HardDelete_Tests.cs | 58 +++++++++++++++- 2 files changed, 120 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs index ef44d6830d..168fe2b0c0 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Data; using Volo.Abp.Domain.Entities; using Volo.Abp.DynamicProxy; using Volo.Abp.Uow; @@ -43,6 +46,65 @@ namespace Volo.Abp.Domain.Repositories } } + public static async Task HardDeleteAsync( + this IRepository repository, + Expression> predicate, + bool autoSave = false, + CancellationToken cancellationToken = default + ) + where TEntity : class, IEntity, ISoftDelete + { + if (!(ProxyHelper.UnProxy(repository) is IUnitOfWorkManagerAccessor unitOfWorkManagerAccessor)) + { + throw new AbpException($"The given repository (of type {repository.GetType().AssemblyQualifiedName}) should implement the {typeof(IUnitOfWorkManagerAccessor).AssemblyQualifiedName} interface in order to invoke the {nameof(HardDeleteAsync)} method!"); + } + + var uowManager = unitOfWorkManagerAccessor.UnitOfWorkManager; + if (uowManager == null) + { + throw new AbpException($"{nameof(unitOfWorkManagerAccessor.UnitOfWorkManager)} property of the given {nameof(repository)} object is null!"); + } + + if (uowManager.Current == null) + { + using (var uow = uowManager.Begin()) + { + await HardDeleteWithUnitOfWorkAsync(repository, predicate, autoSave, cancellationToken, uowManager.Current); + await uow.CompleteAsync(cancellationToken); + } + } + else + { + await HardDeleteWithUnitOfWorkAsync(repository, predicate, autoSave, cancellationToken, uowManager.Current); + } + } + + private static async Task HardDeleteWithUnitOfWorkAsync( + IRepository repository, + Expression> predicate, + bool autoSave, + CancellationToken cancellationToken, IUnitOfWork currentUow + ) + where TEntity : class, IEntity, ISoftDelete + { + var hardDeleteEntities = (HashSet) currentUow.Items.GetOrAdd( + UnitOfWorkItemNames.HardDeletedEntities, + () => new HashSet() + ); + + List entities; + using (currentUow.ServiceProvider.GetRequiredService>().Disable()) + { + entities = await repository.AsyncExecuter.ToListAsync((await repository.GetQueryableAsync()).Where(predicate), cancellationToken); + } + + foreach (var entity in entities) + { + hardDeleteEntities.Add(entity); + await repository.DeleteAsync(entity, autoSave, cancellationToken); + } + } + public static async Task HardDeleteAsync( this IBasicRepository repository, TEntity entity, @@ -77,8 +139,8 @@ namespace Volo.Abp.Domain.Repositories } private static async Task HardDeleteWithUnitOfWorkAsync( - IBasicRepository repository, - TEntity entity, + IBasicRepository repository, + TEntity entity, bool autoSave, CancellationToken cancellationToken, IUnitOfWork currentUow ) @@ -90,7 +152,6 @@ namespace Volo.Abp.Domain.Repositories ); hardDeleteEntities.Add(entity); - await repository.DeleteAsync(entity, autoSave, cancellationToken); } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs index 1eac79fd7c..3d9b324da8 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs @@ -30,8 +30,26 @@ namespace Volo.Abp.TestApp.Testing var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); await PersonRepository.HardDeleteAsync(douglas); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); - douglas.ShouldBeNull(); + using (DataFilter.Disable()) + { + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + } + } + + [Fact] + public async Task Should_HardDelete_Entities_With_Predicate() + { + await PersonRepository.HardDeleteAsync(x => x.Id == TestDataBuilder.UserDouglasId || x.Id == TestDataBuilder.UserJohnDeletedId); + + using (DataFilter.Disable()) + { + var douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + + var john = await PersonRepository.FindAsync(TestDataBuilder.UserJohnDeletedId); + john.ShouldBeNull(); + } } [Fact] @@ -62,8 +80,44 @@ namespace Volo.Abp.TestApp.Testing await uow.CompleteAsync(); } + using (DataFilter.Disable()) + { + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + } + } + + [Fact] + public async Task Should_HardDelete_Soft_Deleted_Entities_With_Predicate() + { + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + await PersonRepository.DeleteAsync(douglas); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldBeNull(); + + using (DataFilter.Disable()) + { + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldNotBeNull(); + douglas.IsDeleted.ShouldBeTrue(); + douglas.DeletionTime.ShouldNotBeNull(); + } + + using (var uow = UnitOfWorkManager.Begin()) + { + await PersonRepository.HardDeleteAsync(x => x.Id == TestDataBuilder.UserDouglasId || x.Id == TestDataBuilder.UserJohnDeletedId); + await uow.CompleteAsync(); + } + + using (DataFilter.Disable()) + { + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + + var john = await PersonRepository.FindAsync(TestDataBuilder.UserJohnDeletedId); + john.ShouldBeNull(); + } } } } From ae0304da1c25eb5895fc26c28e3a5db8435dc337 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 6 Jan 2021 12:16:10 +0300 Subject: [PATCH 035/119] Update PageAdminAppService_Tests.cs --- .../Pages/PageAdminAppService_Tests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs index 26c917613d..64b46ae998 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs @@ -78,7 +78,7 @@ namespace Volo.CmsKit.Pages } [Fact] - public async Task ShouldNotCreateAsync() + public async Task ShouldNotCreateExistUrlAsync() { var dto = new CreatePageInputDto { @@ -110,7 +110,7 @@ namespace Volo.CmsKit.Pages } [Fact] - public async Task ShouldNotCreateWithContentAsync() + public async Task ShouldNotCreateExistUrlWithContentAsync() { var dto = new CreatePageInputDto { @@ -148,7 +148,7 @@ namespace Volo.CmsKit.Pages } [Fact] - public async Task ShouldNotUpdatePageAsync() + public async Task ShouldNotUpdateWithExistUrlAsync() { var dto = new UpdatePageInputDto { From 80b7eea884d7f30c9eef3f7dc32d109742bb93e0 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 7 Jan 2021 13:39:40 +0800 Subject: [PATCH 036/119] Update [How to fix the Chrome login issue for the IdentityServer4] --- .../POST.md | 140 ++++-------------- 1 file changed, 27 insertions(+), 113 deletions(-) diff --git a/docs/en/Community-Articles/2020-08-12-Patch-Chrome-Login-Issue-For-IdentityServer4/POST.md b/docs/en/Community-Articles/2020-08-12-Patch-Chrome-Login-Issue-For-IdentityServer4/POST.md index 718a949f3a..d0d2b1ccee 100644 --- a/docs/en/Community-Articles/2020-08-12-Patch-Chrome-Login-Issue-For-IdentityServer4/POST.md +++ b/docs/en/Community-Articles/2020-08-12-Patch-Chrome-Login-Issue-For-IdentityServer4/POST.md @@ -11,157 +11,75 @@ When you use HTTP on your Identity Server 4 enabled website, users may not login Create the below extension in your ***.Web** project. ```csharp -using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; namespace Microsoft.Extensions.DependencyInjection { public static class SameSiteCookiesServiceCollectionExtensions { - /// - /// -1 defines the unspecified value, which tells ASPNET Core to NOT - /// send the SameSite attribute. With ASPNET Core 3.1 the - /// enum will have a definition for - /// Unspecified. - /// - private const SameSiteMode Unspecified = (SameSiteMode)(-1); - - /// - /// Configures a cookie policy to properly set the SameSite attribute - /// for Browsers that handle unknown values as Strict. Ensure that you - /// add the - /// into the pipeline before sending any cookies! - /// - /// - /// Minimum ASPNET Core Version required for this code: - /// - 2.1.14 - /// - 2.2.8 - /// - 3.0.1 - /// - 3.1.0-preview1 - /// Starting with version 80 of Chrome (to be released in February 2020) - /// cookies with NO SameSite attribute are treated as SameSite=Lax. - /// In order to always get the cookies send they need to be set to - /// SameSite=None. But since the current standard only defines Lax and - /// Strict as valid values there are some browsers that treat invalid - /// values as SameSite=Strict. We therefore need to check the browser - /// and either send SameSite=None or prevent the sending of SameSite=None. - /// Relevant links: - /// - https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1 - /// - https://tools.ietf.org/html/draft-west-cookie-incrementalism-00 - /// - https://www.chromium.org/updates/same-site - /// - https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/ - /// - https://bugs.webkit.org/show_bug.cgi?id=198181 - /// - /// The service collection to register into. - /// The modified . - public static IServiceCollection ConfigureNonBreakingSameSiteCookies(this IServiceCollection services) + public static IServiceCollection AddSameSiteCookiePolicy(this IServiceCollection services) { services.Configure(options => { - options.MinimumSameSitePolicy = Unspecified; - options.OnAppendCookie = cookieContext => - CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); - options.OnDeleteCookie = cookieContext => - CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); + options.MinimumSameSitePolicy = SameSiteMode.Unspecified; + options.OnAppendCookie = cookieContext => + CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); + options.OnDeleteCookie = cookieContext => + CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); }); return services; } - + private static void CheckSameSite(HttpContext httpContext, CookieOptions options) { if (options.SameSite == SameSiteMode.None) { var userAgent = httpContext.Request.Headers["User-Agent"].ToString(); - - if (DisallowsSameSiteNone(userAgent)) + if (!httpContext.Request.IsHttps || DisallowsSameSiteNone(userAgent)) { - options.SameSite = Unspecified; + // For .NET Core < 3.1 set SameSite = (SameSiteMode)(-1) + options.SameSite = SameSiteMode.Unspecified; } } } - /// - /// Checks if the UserAgent is known to interpret an unknown value as Strict. - /// For those the property should be - /// set to . - /// - /// - /// This code is taken from Microsoft: - /// https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/ - /// - /// The user agent string to check. - /// Whether the specified user agent (browser) accepts SameSite=None or not. private static bool DisallowsSameSiteNone(string userAgent) { // Cover all iOS based browsers here. This includes: - // - Safari on iOS 12 for iPhone, iPod Touch, iPad - // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad - // - Chrome on iOS 12 for iPhone, iPod Touch, iPad - // All of which are broken by SameSite=None, because they use the - // iOS networking stack. - // Notes from Thinktecture: - // Regarding https://caniuse.com/#search=samesite iOS versions lower - // than 12 are not supporting SameSite at all. Starting with version 13 - // unknown values are NOT treated as strict anymore. Therefore we only - // need to check version 12. - if (userAgent.Contains("CPU iPhone OS 12") - || userAgent.Contains("iPad; CPU OS 12")) + // - Safari on iOS 12 for iPhone, iPod Touch, iPad + // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad + // - Chrome on iOS 12 for iPhone, iPod Touch, iPad + // All of which are broken by SameSite=None, because they use the iOS networking stack + if (userAgent.Contains("CPU iPhone OS 12") || userAgent.Contains("iPad; CPU OS 12")) { return true; } - // Cover Mac OS X based browsers that use the Mac OS networking stack. - // This includes: - // - Safari on Mac OS X. + // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes: + // - Safari on Mac OS X. // This does not include: - // - Chrome on Mac OS X - // because they do not use the Mac OS networking stack. - // Notes from Thinktecture: - // Regarding https://caniuse.com/#search=samesite MacOS X versions lower - // than 10.14 are not supporting SameSite at all. Starting with version - // 10.15 unknown values are NOT treated as strict anymore. Therefore we - // only need to check version 10.14. - if (userAgent.Contains("Safari") - && userAgent.Contains("Macintosh; Intel Mac OS X 10_14") - && userAgent.Contains("Version/")) + // - Chrome on Mac OS X + // Because they do not use the Mac OS networking stack. + if (userAgent.Contains("Macintosh; Intel Mac OS X 10_14") && + userAgent.Contains("Version/") && userAgent.Contains("Safari")) { return true; } - // Cover Chrome 50-69, because some versions are broken by SameSite=None + // Cover Chrome 50-69, because some versions are broken by SameSite=None, // and none in this range require it. - // Note: this covers some pre-Chromium Edge versions, + // Note: this covers some pre-Chromium Edge versions, // but pre-Chromium Edge does not require SameSite=None. - // Notes from Thinktecture: - // We can not validate this assumption, but we trust Microsofts - // evaluation. And overall not sending a SameSite value equals to the same - // behavior as SameSite=None for these old versions anyways. if (userAgent.Contains("Chrome/5") || userAgent.Contains("Chrome/6")) { return true; } - - if (GetChromeVersion(userAgent) >= 80) - { - return true; - } return false; } - - private static int GetChromeVersion(string userAgent) - { - try - { - return Convert.ToInt32(userAgent.Split("Chrome/")[1].Split('.')[0]); - } - catch (Exception) - { - return 0; - } - } } } ``` @@ -173,7 +91,7 @@ Assume that your project name is *Acme.BookStore*. Then open `AcmeBookStoreWebMo Add the following line to `ConfigureServices()` method. ```csharp - context.Services.ConfigureNonBreakingSameSiteCookies(); + context.Services.AddSameSiteCookiePolicy(); // cookie policy to deal with temporary browser incompatibilities ``` ### Step-3 @@ -195,18 +113,14 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHsts(); } - app.UseCookiePolicy(); //<--- added this ---> + app.UseCookiePolicy(); // added this, Before UseAuthentication or anything else that writes cookies. //.... } ``` - - It's all! You are ready to go! - - --- -Referenced from https://www.thinktecture.com/en/identity/samesite/prepare-your-identityserver/ +Referenced from https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/ From d49e39d588eeb295544df47ab984e6fbbdf1b327 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 7 Jan 2021 10:30:59 +0300 Subject: [PATCH 037/119] Update index.js --- .../src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js index 9216480c95..d3671e3758 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js @@ -55,6 +55,7 @@ service .removeFromCache(data.record.id) .then(function () { + abp.notify.success(l('RemovedFromCache')); dataTable.ajax.reload(); }); }, From 35940db969a88ced5659afd37319134b51de5511 Mon Sep 17 00:00:00 2001 From: EngincanV Date: Thu, 7 Jan 2021 11:15:25 +0300 Subject: [PATCH 038/119] Add missing community localizations --- .../Admin/Localization/Resources/en.json | 3 ++- .../Community/Localization/Resources/en.json | 20 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 32d3c16a01..f425e66079 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -197,6 +197,7 @@ "RemoveCache": "Remove Cache", "Language": "Language", "Optional": "Optional", - "CreateArticleLanguageInfo": "The language in which the article is written" + "CreateArticleLanguageInfo": "The language in which the article is written", + "Enum:ContentSource:2": "Video Post" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json index a92c20a991..8b5fa2014e 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json @@ -25,17 +25,16 @@ "MostRead": "Most Read", "Latest": "Latest", "ContributeAbpCommunity": "Contribute to the ABP Community", - "SubmitYourArticle": "Submit Your Article", + "SubmitYourArticle": "Submit Your Post", "ContributionGuide": "Contribution Guide", "BugReport": "Bug Report", - "SeeAllArticles": "See All Articles", + "SeeAllArticles": "See All Posts", "WelcomeToABPCommunity!": "Welcome to the ABP Community!", "MyProfile": "My profile", "MyOrganizations": "My organizations", "EmailNotValid": "Please enter a valid email address.", "FeatureRequest": "Feature Request", "CreateArticleTitleInfo": "Title of the article to be shown on the article list.", - "CreateArticleUrlInfo": "Original GitHub/External URL of the article.", "CreateArticleSummaryInfo": "A short summary of the article to be shown on the article list.", "CreateArticleCoverInfo": "For creating an effective article, add a cover photo. Upload 16:9 aspect ratio pictures for the best view. Maximum file size: 1MB.", "ThisExtensionIsNotAllowed": "This extension is not allowed.", @@ -87,7 +86,7 @@ "PlannedReleaseDate": "Planned release date", "CommunityArticleRequestErrorMessage": "Could not get the latest article request from Github.", "ArticleRequestFromGithubIssue": "There are not any article requests now.", - "LatestArticles": "Latest Articles", + "LatestArticles": "Latest Posts", "ArticleRequests": "Article Requests", "AllArticleRequests": "See All Article Requests", "SubscribeToTheNewsletter": "Subscribe to the Newsletter", @@ -101,6 +100,17 @@ "ArticleRequestMessageTitle": "Open an issue on the GitHub to request an article/tutorial you want to see on this web site.", "ArticleRequestMessageBody": "Here, the list of the requested articles by the community. Do you want to write a requested article? Please click to the request and join to the discussion.", "Language": "Language", - "CreateArticleLanguageInfo": "The language in which the article is written" + "CreateArticleLanguageInfo": "The language in which the article is written", + "VideoPost": "Video Post", + "Article": "Article", + "Read": "Read", + "CreateGithubArticleUrlInfo": "Original GitHub URL of the article.", + "CreateVideoContentUrlInfo": "Original Youtube URL of the article.", + "CreateExternalArticleUrlInfo": "Original External Url of the article.", + "VideoContentForm": "Video Content Form", + "GithubPostForm": "Github Post Form", + "ExternalPostForm": "External Post Form", + "PostSourceTypeChooses": "We accept three source types for the posts;", + "Posts": "Posts" } } From 71e3b1ac4f7ca161cb27b4579288dba388a66c4f Mon Sep 17 00:00:00 2001 From: Engincan VESKE <43685404+EngincanV@users.noreply.github.com> Date: Thu, 7 Jan 2021 11:58:46 +0300 Subject: [PATCH 039/119] Update en.json --- .../AbpIoLocalization/Admin/Localization/Resources/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index f425e66079..c190a91470 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -197,7 +197,7 @@ "RemoveCache": "Remove Cache", "Language": "Language", "Optional": "Optional", - "CreateArticleLanguageInfo": "The language in which the article is written", + "CreateArticleLanguageInfo": "The language in which the post is written", "Enum:ContentSource:2": "Video Post" } -} \ No newline at end of file +} From ede633eb4ba885971d165675f27765036f52acf6 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 7 Jan 2021 12:27:58 +0300 Subject: [PATCH 040/119] refactoring --- .../Admin/Pages/IPageAdminAppService.cs | 2 -- .../CmsKit/Admin/Pages/PageAdminAppService.cs | 7 +----- .../CmsKit/Admin/Pages/PageAdminController.cs | 7 ------ .../Volo/CmsKit/CmsKitErrorCodes.cs | 5 ++++ .../CmsKit/Localization/Resources/en.json | 3 ++- .../CmsKit/Localization/Resources/tr.json | 3 ++- .../Pages/PageUrlAlreadyExistException.cs | 24 +++++++++++++++++++ .../Pages/PageAdminAppService_Tests.cs | 22 ++++------------- 8 files changed, 38 insertions(+), 35 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs index 395ce263a3..41f5b57a59 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs @@ -7,8 +7,6 @@ namespace Volo.CmsKit.Admin.Pages { public interface IPageAdminAppService : ICrudAppService { - Task ExistsAsync(string url); - Task SetImageAsync(Guid id, RemoteStreamContent content); Task GetImageAsync(Guid id); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs index cbe8310ca5..f46678044f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs @@ -104,11 +104,6 @@ namespace Volo.CmsKit.Admin.Pages return ObjectMapper.Map(page); } - public virtual Task ExistsAsync(string url) - { - return PageRepository.ExistsAsync(url); - } - [Authorize(CmsKitAdminPermissions.Pages.Update)] public virtual async Task SetImageAsync(Guid id, RemoteStreamContent content) { @@ -135,7 +130,7 @@ namespace Volo.CmsKit.Admin.Pages { if (await PageRepository.ExistsAsync(url)) { - throw new UserFriendlyException("Url exist"); + throw new PageUrlAlreadyExistException(url); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs index 60a5d86584..7cc77c74d8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs @@ -62,13 +62,6 @@ namespace Volo.CmsKit.Admin.Pages return PageAdminAppService.DeleteAsync(id); } - [HttpGet] - [Route("exists/{url}")] - public virtual Task ExistsAsync(string url) - { - return PageAdminAppService.ExistsAsync(url); - } - [HttpPost] [Authorize(CmsKitAdminPermissions.Pages.Update)] [Route("image/{id}")] diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs index 76ba39c3f2..aad26ab948 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs @@ -3,5 +3,10 @@ public static class CmsKitErrorCodes { public const string TagAlreadyExist = "CmsKit:0001"; + + public static class Pages + { + public const string UrlAlreadyExist = "CmsKit:Page:0001"; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 9965b901e7..1c2c9a1bfa 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -28,6 +28,7 @@ "Undo": "Undo", "Update": "Update", "YourComment": "Your comment", - "YourReply": "Your reply" + "YourReply": "Your reply", + "CmsKit:Page:0001": "The given url ({0}) is already exist." } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index ac8bd98a9f..a9d512e522 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -24,6 +24,7 @@ "Undo": "Geri al", "Update": "Güncelle", "YourComment": "Yorumunuz", - "YourReply": "Cevabınız" + "YourReply": "Cevabınız", + "CmsKit:Page:0001": "Girilen url ({0}) kullanımdadır." } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs new file mode 100644 index 0000000000..683ae535d6 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs @@ -0,0 +1,24 @@ +using System; +using System.Runtime.Serialization; +using JetBrains.Annotations; +using Volo.Abp; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Pages +{ + [Serializable] + public class PageUrlAlreadyExistException : BusinessException + { + public PageUrlAlreadyExistException([NotNull] string url) + { + Code = CmsKitErrorCodes.Pages.UrlAlreadyExist; + WithData(nameof(Page.Url), url); + } + + public PageUrlAlreadyExistException(SerializationInfo serializationInfo, StreamingContext context) + : base(serializationInfo, context) + { + + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs index 64b46ae998..36381ad461 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs @@ -87,7 +87,9 @@ namespace Volo.CmsKit.Pages Content = "test-content" }; - await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); + var exception = await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); + + exception.Code.ShouldBe(CmsKitErrorCodes.Pages.UrlAlreadyExist); } [Fact] @@ -119,7 +121,7 @@ namespace Volo.CmsKit.Pages Content = "my-test-content" }; - await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); + await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); } [Fact] @@ -161,22 +163,6 @@ namespace Volo.CmsKit.Pages await Should.ThrowAsync(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto)); } - [Fact] - public async Task ShouldBeExistAsync() - { - var doesExist = await _pageAdminAppService.ExistsAsync(_data.Page_1_Url); - - doesExist.ShouldBeTrue(); - } - - [Fact] - public async Task ShouldNotBeExistAsync() - { - var doesExist = await _pageAdminAppService.ExistsAsync(_data.Page_1_Url+ "+"); - - doesExist.ShouldBeFalse(); - } - [Fact] public async Task ShouldDeleteAsync() { From 706585df59bf3dd9f6cc040d45e6d14d5fd5d974 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 7 Jan 2021 12:33:09 +0300 Subject: [PATCH 041/119] refactor --- .../Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs | 1 - .../Pages/PageAdminAppService_Tests.cs | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs index 683ae535d6..142d03c441 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs @@ -2,7 +2,6 @@ using System.Runtime.Serialization; using JetBrains.Annotations; using Volo.Abp; -using Volo.CmsKit.Tags; namespace Volo.CmsKit.Pages { diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs index 36381ad461..34cf18fec2 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs @@ -121,7 +121,9 @@ namespace Volo.CmsKit.Pages Content = "my-test-content" }; - await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); + var exception = await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); + + exception.Code.ShouldBe(CmsKitErrorCodes.Pages.UrlAlreadyExist); } [Fact] From 478ceb738ecf813ca88dc0535ed0b67d18ee6cc9 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 7 Jan 2021 16:55:45 +0800 Subject: [PATCH 042/119] Set DispatchConsumersAsync to true --- .../Volo/Abp/RabbitMQ/ConnectionPool.cs | 5 ++-- .../Volo/Abp/RabbitMQ/RabbitMqConnections.cs | 6 ++--- .../Abp/RabbitMQ/RabbitMqMessageConsumer.cs | 23 ++++++++----------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs index 08d9d48036..5856f7bb16 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs @@ -22,8 +22,7 @@ namespace Volo.Abp.RabbitMQ public virtual IConnection Get(string connectionName = null) { - connectionName = connectionName - ?? RabbitMqConnections.DefaultConnectionName; + connectionName ??= RabbitMqConnections.DefaultConnectionName; return Connections.GetOrAdd( connectionName, @@ -58,4 +57,4 @@ namespace Volo.Abp.RabbitMQ Connections.Clear(); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs index a30db4c96a..f2b5168d82 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.RabbitMQ public class RabbitMqConnections : Dictionary { public const string DefaultConnectionName = "Default"; - + [NotNull] public ConnectionFactory Default { @@ -19,7 +19,7 @@ namespace Volo.Abp.RabbitMQ public RabbitMqConnections() { - Default = new ConnectionFactory(); + Default = new ConnectionFactory() { DispatchConsumersAsync = true }; } public ConnectionFactory GetOrDefault(string connectionName) @@ -32,4 +32,4 @@ namespace Volo.Abp.RabbitMQ return Default; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index fb1b0c7fe2..b94663d886 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -143,10 +143,10 @@ namespace Volo.Abp.RabbitMQ try { - var channel = ConnectionPool + Channel = ConnectionPool .Get(ConnectionName) .CreateModel(); - channel.ExchangeDeclare( + Channel.ExchangeDeclare( exchange: Exchange.ExchangeName, type: Exchange.Type, durable: Exchange.Durable, @@ -154,7 +154,7 @@ namespace Volo.Abp.RabbitMQ arguments: Exchange.Arguments ); - channel.QueueDeclare( + Channel.QueueDeclare( queue: Queue.QueueName, durable: Queue.Durable, exclusive: Queue.Exclusive, @@ -162,19 +162,14 @@ namespace Volo.Abp.RabbitMQ arguments: Queue.Arguments ); - var consumer = new EventingBasicConsumer(channel); - consumer.Received += async (model, basicDeliverEventArgs) => - { - await HandleIncomingMessageAsync(channel, basicDeliverEventArgs); - }; + var consumer = new AsyncEventingBasicConsumer(Channel); + consumer.Received += HandleIncomingMessageAsync; - channel.BasicConsume( + Channel.BasicConsume( queue: Queue.QueueName, autoAck: false, consumer: consumer ); - - Channel = channel; } catch (Exception ex) { @@ -183,16 +178,16 @@ namespace Volo.Abp.RabbitMQ } } - protected virtual async Task HandleIncomingMessageAsync(IModel channel, BasicDeliverEventArgs basicDeliverEventArgs) + protected virtual async Task HandleIncomingMessageAsync(object sender, BasicDeliverEventArgs basicDeliverEventArgs) { try { foreach (var callback in Callbacks) { - await callback(channel, basicDeliverEventArgs); + await callback(Channel, basicDeliverEventArgs); } - channel.BasicAck(basicDeliverEventArgs.DeliveryTag, multiple: false); + Channel.BasicAck(basicDeliverEventArgs.DeliveryTag, multiple: false); } catch (Exception ex) { From daadc2a5690a1e8b7e3435c4294e50aa6eea01b0 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 7 Jan 2021 16:53:31 +0300 Subject: [PATCH 043/119] CLI public web site option --- .../Volo/Abp/Cli/Commands/NewCommand.cs | 12 ++++ .../Services/SourceCodeDownloadService.cs | 1 + .../Steps/ChangeDbMigratorPublicPortStep.cs | 15 +++++ .../Steps/ChangePublicAuthPortStep.cs | 15 +++++ .../Building/Steps/RemoveCmsKitStep.cs | 24 +++++++ .../RemoveEfCoreDependencyFromPublicStep.cs | 14 ++++ .../Steps/RemoveGlobalFeaturesPackageStep.cs | 14 ++++ .../Building/Steps/RemovePublicRedisStep.cs | 17 +++++ .../Building/Steps/TemplateCodeDeleteStep.cs | 4 +- .../TemplateProjectBuildPipelineBuilder.cs | 7 +- .../Files/FileEntryExtensions.cs | 6 +- .../Cli/ProjectBuilding/ProjectBuildArgs.cs | 4 ++ .../Templates/App/AppTemplateBase.cs | 64 +++++++++++++++++++ .../Templates/RemoveUnnecessaryPortsStep.cs | 34 +++++++++- 14 files changed, 220 insertions(+), 11 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeDbMigratorPublicPortStep.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangePublicAuthPortStep.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index c4942d04ab..d9621e5f91 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -107,6 +107,12 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("UI Framework: " + uiFramework); } + var publicWebSite = uiFramework != UiFramework.None && commandLineArgs.Options.ContainsKey(Options.PublicWebSite.Long); + if (publicWebSite) + { + Logger.LogInformation("Public Web Site: yes"); + } + var mobileApp = GetMobilePreference(commandLineArgs); if (mobileApp != MobileApp.None) { @@ -168,6 +174,7 @@ namespace Volo.Abp.Cli.Commands databaseManagementSystem, uiFramework, mobileApp, + publicWebSite, gitHubAbpLocalRepositoryPath, gitHubVoloLocalRepositoryPath, templateSource, @@ -489,6 +496,11 @@ namespace Volo.Abp.Cli.Commands public const string Long = "mobile"; } + public static class PublicWebSite + { + public const string Long = "with-public-website"; + } + public static class TemplateSource { public const string Short = "ts"; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs index 28f41e55d8..6306619e56 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs @@ -40,6 +40,7 @@ namespace Volo.Abp.Cli.Commands.Services DatabaseManagementSystem.NotSpecified, UiFramework.NotSpecified, null, + false, gitHubAbpLocalRepositoryPath, gitHubVoloLocalRepositoryPath, null, diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeDbMigratorPublicPortStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeDbMigratorPublicPortStep.cs new file mode 100644 index 0000000000..72e05b74b0 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeDbMigratorPublicPortStep.cs @@ -0,0 +1,15 @@ +using System.Linq; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class ChangeDbMigratorPublicPortStep: ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + var dbMigratorAppSettings = context.Files + .FirstOrDefault(f => f.Name.Contains("MyCompanyName.MyProjectName.DbMigrator") && f.Name.EndsWith("appsettings.json")); + + dbMigratorAppSettings?.SetContent(dbMigratorAppSettings.Content.Replace("localhost:44304","localhost:44306")); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangePublicAuthPortStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangePublicAuthPortStep.cs new file mode 100644 index 0000000000..0d33b16309 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangePublicAuthPortStep.cs @@ -0,0 +1,15 @@ +using System.Linq; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class ChangePublicAuthPortStep: ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + var publicAppSettings = context.Files + .FirstOrDefault(f => f.Name.Contains("MyCompanyName.MyProjectName.Web.Public") && f.Name.EndsWith("appsettings.json")); + + publicAppSettings?.SetContent(publicAppSettings.Content.Replace("localhost:44303","localhost:44305")); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs new file mode 100644 index 0000000000..4f63d377ea --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs @@ -0,0 +1,24 @@ +using System.Linq; +using Volo.Abp.Cli.ProjectBuilding.Files; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class RemoveCmsKitStep : ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + var commonFiles = context.Files.Where(f => + f.Name.EndsWith(".csproj") || + f.Name.EndsWith("Module.cs") || + f.Name.EndsWith("MyProjectNameMigrationsDbContext.cs") || + f.Name.EndsWith("MyProjectNameGlobalFeatureConfigurator.cs") || + (f.Name.EndsWith(".cshtml") && f.Name.Contains("MyCompanyName.MyProjectName.Web.Public")) + ); + + foreach (var file in commonFiles) + { + file.RemoveTemplateCodeIfNot("CMS-KIT"); + } + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs new file mode 100644 index 0000000000..f9e906c902 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs @@ -0,0 +1,14 @@ +using System.Linq; +using Volo.Abp.Cli.ProjectBuilding.Files; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class RemoveEfCoreDependencyFromPublicStep : ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Web.Public.csproj"))?.RemoveTemplateCodeIfNot("EFCORE"); + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameWebPublicModule.cs"))?.RemoveTemplateCodeIfNot("EFCORE"); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs new file mode 100644 index 0000000000..06fd565353 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs @@ -0,0 +1,14 @@ +using System.Linq; +using Volo.Abp.Cli.ProjectBuilding.Files; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class RemoveGlobalFeaturesPackageStep : ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Domain.Shared.csproj"))?.RemoveTemplateCodeIf("CMS-KIT"); + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameDomainSharedModule.cs"))?.RemoveTemplateCodeIf("CMS-KIT"); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs new file mode 100644 index 0000000000..94056cbf5a --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Volo.Abp.Cli.ProjectBuilding.Files; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class RemovePublicRedisStep : ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Web.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameWebModule.cs"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.Host.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameHttpApiHostModule.cs"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs index e673446d9f..8942103873 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { foreach (var file in context.Files) { - if (file.Name.EndsWith(".cs")) //TODO: Why only cs! + if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".csproj") || file.Name.EndsWith(".cshtml")) { file.RemoveTemplateCode(); file.RemoveTemplateCodeMarkers(); @@ -16,4 +16,4 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs index 513c2b4198..31c8f216b4 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs @@ -1,5 +1,4 @@ -using System; -using Volo.Abp.Cli.ProjectBuilding.Building.Steps; +using Volo.Abp.Cli.ProjectBuilding.Building.Steps; using Volo.Abp.Cli.ProjectBuilding.Templates.App; using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule; @@ -28,13 +27,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building if (context.Template.Name == AppProTemplate.TemplateName || context.Template.Name == ModuleProTemplate.TemplateName) { - pipeline.Steps.Add(new LicenseCodeReplaceStep()); + pipeline.Steps.Add(new LicenseCodeReplaceStep()); // todo: move to custom steps? } if (context.Template.Name == AppTemplate.TemplateName || context.Template.Name == AppProTemplate.TemplateName) { - pipeline.Steps.Add(new DatabaseManagementSystemChangeStep()); + pipeline.Steps.Add(new DatabaseManagementSystemChangeStep()); // todo: move to custom steps? } if ((context.BuildArgs.UiFramework == UiFramework.Mvc || context.BuildArgs.UiFramework == UiFramework.Blazor) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs index 900948ce9c..91180206bf 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files { RemoveMarkedTemplateCode(file, ""); } - + public static void RemoveTemplateCodeIf(this FileEntry file, string condition) { RemoveByCondition(file, "IF", condition); @@ -68,7 +68,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files { if (lines[i].Contains(beginMark)) { - while (!lines[i].Contains("") && i < lines.Length) + while (i < lines.Length && !lines[i].Contains("")) { ++i; } @@ -85,4 +85,4 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files file.SetLines(newLines); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs index 1022f5f10e..71ccf96f7a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs @@ -23,6 +23,8 @@ namespace Volo.Abp.Cli.ProjectBuilding public MobileApp? MobileApp { get; set; } + public bool PublicWebSite { get; set; } + [CanBeNull] public string AbpGitHubLocalRepositoryPath { get; set; } @@ -46,6 +48,7 @@ namespace Volo.Abp.Cli.ProjectBuilding DatabaseManagementSystem databaseManagementSystem = DatabaseManagementSystem.NotSpecified, UiFramework uiFramework = UiFramework.NotSpecified, MobileApp? mobileApp = null, + bool publicWebSite = false, [CanBeNull] string abpGitHubLocalRepositoryPath = null, [CanBeNull] string voloGitHubLocalRepositoryPath = null, [CanBeNull] string templateSource = null, @@ -59,6 +62,7 @@ namespace Volo.Abp.Cli.ProjectBuilding DatabaseManagementSystem = databaseManagementSystem; UiFramework = uiFramework; MobileApp = mobileApp; + PublicWebSite = publicWebSite; AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath; VoloGitHubLocalRepositoryPath = voloGitHubLocalRepositoryPath; TemplateSource = templateSource; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs index b5976b403f..27cfa0468b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Volo.Abp.Cli.Commands; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Building.Steps; @@ -24,11 +25,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App SwitchDatabaseProvider(context, steps); DeleteUnrelatedProjects(context, steps); + ConfigurePublicWebSite(context, steps); RemoveUnnecessaryPorts(context, steps); RandomizeSslPorts(context, steps); RandomizeStringEncryption(context, steps); UpdateNuGetConfig(context, steps); CleanupFolderHierarchy(context, steps); + RemoveMigrations(context, steps); return steps; } @@ -92,6 +95,62 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App { steps.Add(new RemoveFolderStep(MobileApp.ReactNative.GetFolderName().EnsureStartsWith('/'))); } + + if (!context.BuildArgs.PublicWebSite) + { + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public.Host")); + } + else + { + if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.Tiered.Long) || context.BuildArgs.ExtraProperties.ContainsKey("separate-identity-server")) + { + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public")); + } + else + { + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public.Host")); + } + } + } + + private void ConfigurePublicWebSite(ProjectBuildContext context, List steps) + { + if (!context.BuildArgs.PublicWebSite) + { + if (!context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.Tiered.Long) && + !context.BuildArgs.ExtraProperties.ContainsKey("separate-identity-server")) + { + steps.Add(new RemovePublicRedisStep()); + } + + steps.Add(new RemoveCmsKitStep()); + return; + } + + if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.Tiered.Long) || context.BuildArgs.ExtraProperties.ContainsKey("separate-identity-server")) + { + steps.Add(new AppTemplateProjectRenameStep("MyCompanyName.MyProjectName.Web.Public.Host","MyCompanyName.MyProjectName.Web.Public")); + steps.Add(new ChangeDbMigratorPublicPortStep()); + } + else if (context.BuildArgs.UiFramework != UiFramework.NotSpecified && context.BuildArgs.UiFramework != UiFramework.Mvc) + { + steps.Add(new ChangePublicAuthPortStep()); + } + + if (context.BuildArgs.DatabaseProvider != DatabaseProvider.NotSpecified || context.BuildArgs.DatabaseProvider != DatabaseProvider.EntityFrameworkCore) + { + steps.Add(new RemoveEfCoreDependencyFromPublicStep()); + } + + if (context.BuildArgs.ExtraProperties.ContainsKey("without-cms-kit")) + { + steps.Add(new RemoveCmsKitStep()); + } + else + { + steps.Add(new RemoveGlobalFeaturesPackageStep()); + } } private static void ConfigureWithoutUi(ProjectBuildContext context, List steps) @@ -216,6 +275,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App steps.Add(new UpdateNuGetConfigStep("/aspnet-core/NuGet.Config")); } + private static void RemoveMigrations(ProjectBuildContext context, List steps) + { + steps.Add(new RemoveFolderStep("/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations")); + } + private static void CleanupFolderHierarchy(ProjectBuildContext context, List steps) { if (context.BuildArgs.UiFramework == UiFramework.Mvc && context.BuildArgs.MobileApp == MobileApp.None) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs index 4d44cf0b05..620fc5219e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs @@ -4,12 +4,19 @@ using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.Cli.ProjectBuilding.Files; namespace Volo.Abp.Cli.ProjectBuilding.Templates { public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep { public override void Execute(ProjectBuildContext context) + { + RemoveUnnecessaryDbMigratorClients(context); + RemoveUnnecessaryHttpApiHostPorts(context); + } + + private static void RemoveUnnecessaryHttpApiHostPorts(ProjectBuildContext context) { var httpApiHostAppSettings = context.Files.FirstOrDefault(f => f.Name.EndsWith(".HttpApi.Host/appsettings.json")); @@ -28,6 +35,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates appJson.Property("ClientUrl")?.Remove(); portsToRemoveFromCors.Add("4200"); } + if (context.BuildArgs.UiFramework != UiFramework.Blazor) { portsToRemoveFromCors.Add("44307"); @@ -36,11 +44,33 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates if (appJson["CorsOrigins"] != null) { appJson["CorsOrigins"] = string.Join(",", - appJson["CorsOrigins"].ToString().Split(",").Where(u=> !portsToRemoveFromCors.Any(u.EndsWith)) - ); + appJson["CorsOrigins"].ToString().Split(",").Where(u => !portsToRemoveFromCors.Any(u.EndsWith)) + ); } httpApiHostAppSettings.SetContent(JsonConvert.SerializeObject(appSettingsJson, Formatting.Indented)); } + + private static void RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context) + { + var dbMigratorAppSettings = context.Files + .FirstOrDefault(f => + f.Name.Contains("MyCompanyName.MyProjectName.DbMigrator") && f.Name.EndsWith("appsettings.json")); + + var appSettingsJsonObject = JObject.Parse(dbMigratorAppSettings.Content); + var identityServerJsonObject = (JObject) appSettingsJsonObject["IdentityServer"]; + var clientsJsonObject = (JObject) identityServerJsonObject["Clients"]; + + if (context.BuildArgs.UiFramework != UiFramework.Blazor) + { + clientsJsonObject.Remove("MyProjectName_Blazor"); + } + if (!context.BuildArgs.PublicWebSite) + { + clientsJsonObject.Remove("MyProjectName_Web_Public"); + } + + dbMigratorAppSettings.SetContent(appSettingsJsonObject.ToString(Formatting.Indented)); + } } } From 82befb9248b6fb7200dd879181e54ed395d0cd12 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 7 Jan 2021 17:26:08 +0300 Subject: [PATCH 044/119] provide VALIDATION_INVALID_CLASSES in ThemeBasicTestingModule --- .../testing/src/lib/theme-basic-testing.module.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/theme-basic/testing/src/lib/theme-basic-testing.module.ts b/npm/ng-packs/packages/theme-basic/testing/src/lib/theme-basic-testing.module.ts index 0bcab2ed08..282e5a2da7 100644 --- a/npm/ng-packs/packages/theme-basic/testing/src/lib/theme-basic-testing.module.ts +++ b/npm/ng-packs/packages/theme-basic/testing/src/lib/theme-basic-testing.module.ts @@ -5,7 +5,11 @@ import { ValidationErrorComponent, } from '@abp/ng.theme.basic'; import { ModuleWithProviders, NgModule } from '@angular/core'; -import { VALIDATION_ERROR_TEMPLATE, VALIDATION_TARGET_SELECTOR } from '@ngx-validate/core'; +import { + VALIDATION_ERROR_TEMPLATE, + VALIDATION_INVALID_CLASSES, + VALIDATION_TARGET_SELECTOR, +} from '@ngx-validate/core'; @NgModule({ exports: [BaseThemeBasicModule], @@ -26,6 +30,10 @@ export class ThemeBasicTestingModule { provide: VALIDATION_TARGET_SELECTOR, useValue: '.form-group', }, + { + provide: VALIDATION_INVALID_CLASSES, + useValue: 'is-invalid', + }, ], }; } From 48c761994bd8e48c6d990a58af105a08e941a68c Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 7 Jan 2021 18:06:19 +0300 Subject: [PATCH 045/119] Fix Cli Thanks Page Redirection --- .../Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index b76d4de5b5..5be62abb35 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -59,6 +59,10 @@ namespace Volo.Abp.Cli.Commands { Logger.LogInformation("Template: " + template); } + else + { + template = (await TemplateInfoProvider.GetDefaultAsync()).Name; + } var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); if (version != null) @@ -198,7 +202,8 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation($"'{projectName}' has been successfully created to '{outputFolder}'"); - if (AppTemplateBase.IsAppTemplate(template ?? (await TemplateInfoProvider.GetDefaultAsync()).Name)) + + if (AppTemplateBase.IsAppTemplate(template)) { var isCommercial = template == AppProTemplate.TemplateName; OpenThanksPage(uiFramework, databaseProvider, isTiered || commandLineArgs.Options.ContainsKey("separate-identity-server"), isCommercial); From 89069d954052249f1b6b1dc19f20bedc06ccf8a0 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 7 Jan 2021 18:42:00 +0300 Subject: [PATCH 046/119] explain how Angular UI unit tests work --- docs/en/UI/Angular/Testing.md | 375 +++++++++++++++++++++++++++++++++- 1 file changed, 373 insertions(+), 2 deletions(-) diff --git a/docs/en/UI/Angular/Testing.md b/docs/en/UI/Angular/Testing.md index f24ae62982..e26e1b4a51 100644 --- a/docs/en/UI/Angular/Testing.md +++ b/docs/en/UI/Angular/Testing.md @@ -1,3 +1,374 @@ -# Angular UI: Testing +# Unit Testing Angular UI -TODO \ No newline at end of file +ABP Angular UI is tested like any other Angular application. So, [the guide here](https://angular.io/guide/testing) applies to ABP too. That said, we would like to point out some **unit testing topics specific to ABP Angular applications**. + +## Setup + +In Angular, unit tests use [Karma](https://karma-runner.github.io/) and [Jasmine](https://jasmine.github.io) by default. Although we like Jest more, we chose not to deviate from these defaults, so **the application template you download will have Karma and Jasmine preconfigured**. You can find the Karma configuration inside the _karma.conf.js_ file in the root folder. You don't have to do anything. Adding a spec file and running `npm test` will work. + +You would need a different configuration for your CI environment. To set up a new configuration for your unit tests, find the test project in _angular.json_ file and add one as seen below: + +```json +// angular.json + +"test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { /* several options here */ }, + "configurations": { + "production": { + "karmaConfig": "karma.conf.prod.js" + } + } +} +``` + +Now you can copy the _karma.conf.js_ as _karma.conf.prod.js_ and use any configuration you like in it. Please check [Karma configuration file document](http://karma-runner.github.io/5.2/config/configuration-file.html) for config options. + +Finally, don't forget to run your CI tests with the following command: + +```sh +npm test -- --prod +``` + +## Basics + +An over-simplified spec file looks like this: + +```ts +import { CoreTestingModule } from "@abp/ng.core/testing"; +import { ThemeBasicTestingModule } from "@abp/ng.theme.basic/testing"; +import { ThemeSharedTestingModule } from "@abp/ng.theme.shared/testing"; +import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; +import { NgxValidateCoreModule } from "@ngx-validate/core"; +import { MyComponent } from "./my.component"; + +describe("MyComponent", () => { + let fixture: ComponentFixture; + + beforeEach( + waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [MyComponent], + imports: [ + CoreTestingModule.withConfig(), + ThemeSharedTestingModule.withConfig(), + ThemeBasicTestingModule.withConfig(), + NgxValidateCoreModule, + ], + providers: [ + /* mock providers here */ + ], + }).compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(MyComponent); + fixture.detectChanges(); + }); + + it("should be initiated", () => { + expect(fixture.componentInstance).toBeTruthy(); + }); +}); +``` + +If you take a look at the imports, you will notice that we have prepared some testing modules to replace built-in ABP modules. This is necessary for providing mocks for some features which otherwise would break your tests. Please remember to **use testing modules** and **call their `withConfig` static method**. + +## Tips + +### Angular Testing Library + +Although you can test your code with Angular TestBed, you may find [Angular Testing Library](https://testing-library.com/docs/angular-testing-library/intro) a good alternative. + +The simple example above can be written with Angular Testing Library as follows: + +```ts +import { CoreTestingModule } from "@abp/ng.core/testing"; +import { ThemeBasicTestingModule } from "@abp/ng.theme.basic/testing"; +import { ThemeSharedTestingModule } from "@abp/ng.theme.shared/testing"; +import { ComponentFixture } from "@angular/core/testing"; +import { NgxValidateCoreModule } from "@ngx-validate/core"; +import { render } from "@testing-library/angular"; +import { MyComponent } from "./my.component"; + +describe("MyComponent", () => { + let fixture: ComponentFixture; + + beforeEach(async () => { + const result = await render(MyComponent, { + imports: [ + CoreTestingModule.withConfig(), + ThemeSharedTestingModule.withConfig(), + ThemeBasicTestingModule.withConfig(), + NgxValidateCoreModule, + ], + providers: [ + /* mock providers here */ + ], + }); + + fixture = result.fixture; + }); + + it("should be initiated", () => { + expect(fixture.componentInstance).toBeTruthy(); + }); +}); +``` + +Very similar, as you can see. The real difference kicks in when we use queries and fire events. + +```ts +// other imports +import { getByLabelText, screen } from "@testing-library/angular"; +import userEvent from "@testing-library/user-event"; + +describe("MyComponent", () => { + beforeEach(/* removed for sake of brevity */); + + it("should display advanced filters", () => { + const filters = screen.getByTestId("author-filters"); + const nameInput = getByLabelText(filters, /name/i) as HTMLInputElement; + expect(nameInput.offsetWidth).toBe(0); + + const advancedFiltersBtn = screen.getByRole("link", { name: /advanced/i }); + userEvent.click(advancedFiltersBtn); + + expect(nameInput.offsetWidth).toBeGreaterThan(0); + + userEvent.type(nameInput, "fooo{backspace}"); + expect(nameInput.value).toBe("foo"); + }); +}); +``` + +The **queries in Angular Testing Library follow practices for maintainable tests**, the user event package provides a **human-like interaction** with the DOM, and the library in general has **a clear API** that simplifies component testing. Please find some useful links below: + +- [Queries](https://testing-library.com/docs/dom-testing-library/api-queries) +- [User Event](https://testing-library.com/docs/ecosystem-user-event) +- [Examples](https://github.com/testing-library/angular-testing-library/tree/master/apps/example-app/app/examples) + +### Clearing DOM After Each Spec + +One thing to remember is that Karma runs tests in real browser instances. That means, you will be able to see the result of your test code, but also have problems with components attached to the document body which may not get cleared after each test, even when you configure Karma to do so. + +We have prepared a simple function with which you can clear any leftover DOM elements after each test. + +```ts +// other imports +import { clearPage } from "@abp/ng.core/testing"; + +describe("MyComponent", () => { + let fixture: ComponentFixture; + + afterEach(() => clearPage(fixture)); + + beforeEach(async () => { + const result = await render(MyComponent, { + /* removed for sake of brevity */ + }); + fixture = result.fixture; + }); + + // specs here +}); +``` + +Please make sure you use it because Karma will fail to remove dialogs otherwise and you will have multiple copies of modals, confirmation boxes, and alike. + +### Waiting + +Some components, modals, in particular, work off-detection-cycle. In other words, you cannot reach DOM elements inserted by these components immediately after opening them. Similarly, inserted elements are not immediately destroyed upon closing them. + +For this purpose, we have prepared a `wait` function. + +```ts +// other imports +import { wait } from "@abp/ng.core/testing"; + +describe("MyComponent", () => { + beforeEach(/* removed for sake of brevity */); + + it("should open a modal", async () => { + const openModalBtn = screen.getByRole("button", { name: "Open Modal" }); + userEvent.click(openModalBtn); + + await wait(fixture); + + const modal = screen.getByRole("dialog"); + + expect(modal).toBeTruthy(); + + /* wait again after closing the modal */ + }); +}); +``` + +The `wait` function takes a second parameter, i.e. timeout (default: `0`). Try not to use it though. Using a timeout bigger than `0` is usually a signal that something is not quite right. + +## Testing Example + +Here is an example test suite. It doesn't cover all, but gives quite a good idea about what the testing experience will be like. + +```ts +import { clearPage, CoreTestingModule, wait } from "@abp/ng.core/testing"; +import { ThemeBasicTestingModule } from "@abp/ng.theme.basic/testing"; +import { ThemeSharedTestingModule } from "@abp/ng.theme.shared/testing"; +import { ComponentFixture } from "@angular/core/testing"; +import { + NgbCollapseModule, + NgbDatepickerModule, + NgbDropdownModule, +} from "@ng-bootstrap/ng-bootstrap"; +import { NgxValidateCoreModule } from "@ngx-validate/core"; +import { CountryService } from "@proxy/countries"; +import { + findByText, + getByLabelText, + getByRole, + getByText, + queryByRole, + render, + screen, +} from "@testing-library/angular"; +import userEvent from "@testing-library/user-event"; +import { BehaviorSubject, of } from "rxjs"; +import { CountryComponent } from "./country.component"; + +const list$ = new BehaviorSubject({ + items: [{ id: "ID_US", name: "United States of America" }], + totalCount: 1, +}); + +describe("Country", () => { + let fixture: ComponentFixture; + + afterEach(() => clearPage(fixture)); + + beforeEach(async () => { + const result = await render(CountryComponent, { + imports: [ + CoreTestingModule.withConfig(), + ThemeSharedTestingModule.withConfig(), + ThemeBasicTestingModule.withConfig(), + NgxValidateCoreModule, + NgbCollapseModule, + NgbDatepickerModule, + NgbDropdownModule, + ], + providers: [ + { + provide: CountryService, + useValue: { + getList: () => list$, + }, + }, + ], + }); + + fixture = result.fixture; + }); + + it("should display advanced filters", () => { + const filters = screen.getByTestId("country-filters"); + const nameInput = getByLabelText(filters, /name/i) as HTMLInputElement; + expect(nameInput.offsetWidth).toBe(0); + + const advancedFiltersBtn = screen.getByRole("link", { name: /advanced/i }); + userEvent.click(advancedFiltersBtn); + + expect(nameInput.offsetWidth).toBeGreaterThan(0); + + userEvent.type(nameInput, "fooo{backspace}"); + expect(nameInput.value).toBe("foo"); + + userEvent.click(advancedFiltersBtn); + expect(nameInput.offsetWidth).toBe(0); + }); + + it("should have a heading", () => { + const heading = screen.getByRole("heading", { name: "Countries" }); + expect(heading).toBeTruthy(); + }); + + it("should render list in table", async () => { + const table = await screen.findByTestId("country-table"); + + const name = getByText(table, "United States of America"); + expect(name).toBeTruthy(); + }); + + it("should display edit modal", async () => { + const actionsBtn = screen.queryByRole("button", { name: /actions/i }); + userEvent.click(actionsBtn); + + const editBtn = screen.getByRole("button", { name: /edit/i }); + userEvent.click(editBtn); + + await wait(fixture); + + const modal = screen.getByRole("dialog"); + const modalHeading = queryByRole(modal, "heading", { name: /edit/i }); + expect(modalHeading).toBeTruthy(); + + const closeBtn = getByText(modal, "×"); + userEvent.click(closeBtn); + + await wait(fixture); + + expect(screen.queryByRole("dialog")).toBeFalsy(); + }); + + it("should display create modal", async () => { + const newBtn = screen.getByRole("button", { name: /new/i }); + userEvent.click(newBtn); + + await wait(fixture); + + const modal = screen.getByRole("dialog"); + const modalHeading = queryByRole(modal, "heading", { name: /new/i }); + + expect(modalHeading).toBeTruthy(); + }); + + it("should validate required name field", async () => { + const newBtn = screen.getByRole("button", { name: /new/i }); + userEvent.click(newBtn); + + await wait(fixture); + + const modal = screen.getByRole("dialog"); + const nameInput = getByRole(modal, "textbox", { + name: /^name/i, + }) as HTMLInputElement; + + userEvent.type(nameInput, "x"); + userEvent.type(nameInput, "{backspace}"); + + const nameError = await findByText(modal, /required/i); + expect(nameError).toBeTruthy(); + }); + + it("should delete a country", () => { + const getSpy = spyOn(fixture.componentInstance.list, "get"); + const deleteSpy = jasmine.createSpy().and.returnValue(of(null)); + fixture.componentInstance.service.delete = deleteSpy; + + const actionsBtn = screen.queryByRole("button", { name: /actions/i }); + userEvent.click(actionsBtn); + + const deleteBtn = screen.getByRole("button", { name: /delete/i }); + userEvent.click(deleteBtn); + + const confirmText = screen.getByText("AreYouSure"); + expect(confirmText).toBeTruthy(); + + const confirmBtn = screen.getByRole("button", { name: "Yes" }); + userEvent.click(confirmBtn); + + expect(deleteSpy).toHaveBeenCalledWith(list$.value.items[0].id); + expect(getSpy).toHaveBeenCalledTimes(1); + }); +}); +``` From 8134299ae9dd66a1ba5bcf0a7788001e6e17290b Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 7 Jan 2021 18:56:52 +0300 Subject: [PATCH 047/119] rename file --- docs/en/UI/Angular/{Testing.md => Unit-Testing.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/en/UI/Angular/{Testing.md => Unit-Testing.md} (100%) diff --git a/docs/en/UI/Angular/Testing.md b/docs/en/UI/Angular/Unit-Testing.md similarity index 100% rename from docs/en/UI/Angular/Testing.md rename to docs/en/UI/Angular/Unit-Testing.md From ae03f8fc7f2da95c7d314845c1d72105403bc617 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 7 Jan 2021 18:47:27 +0300 Subject: [PATCH 048/119] add unit testing to navigation --- docs/en/docs-nav.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index c7a7554fdc..d9c7d2acf8 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -740,6 +740,10 @@ { "text": "PWA Configuration", "path": "UI/Angular/PWA-Configuration.md" + }, + { + "text": "Unit Testing", + "path": "UI/Angular/Unit-Testing.md" } ] }, From e4c278fe9d02c903cdba7982c4b2b2c20fa42290 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 7 Jan 2021 17:39:06 +0300 Subject: [PATCH 049/119] set skipGetAppConfiguration as true in CoreTestingModule when not given --- .../packages/core/testing/src/lib/core-testing.module.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/core/testing/src/lib/core-testing.module.ts b/npm/ng-packs/packages/core/testing/src/lib/core-testing.module.ts index 1718946cab..1f07423779 100644 --- a/npm/ng-packs/packages/core/testing/src/lib/core-testing.module.ts +++ b/npm/ng-packs/packages/core/testing/src/lib/core-testing.module.ts @@ -1,8 +1,8 @@ import { ABP, BaseCoreModule, - CORE_OPTIONS, coreOptionsFactory, + CORE_OPTIONS, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, PermissionService, @@ -34,7 +34,10 @@ export class CoreTestingModule { { provide: APP_BASE_HREF, useValue: baseHref }, { provide: 'CORE_OPTIONS', - useValue: options, + useValue: { + skipGetAppConfiguration: true, + ...options, + }, }, { provide: CORE_OPTIONS, From 931dd858a5f2e8a734a40c4f15ec5e6051ce79cf Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 7 Jan 2021 19:16:27 +0300 Subject: [PATCH 050/119] rename Unit-Testing.md as Testing.md --- docs/en/UI/Angular/{Unit-Testing.md => Testing.md} | 0 docs/en/docs-nav.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename docs/en/UI/Angular/{Unit-Testing.md => Testing.md} (100%) diff --git a/docs/en/UI/Angular/Unit-Testing.md b/docs/en/UI/Angular/Testing.md similarity index 100% rename from docs/en/UI/Angular/Unit-Testing.md rename to docs/en/UI/Angular/Testing.md diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index d9c7d2acf8..250fed91f0 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -743,7 +743,7 @@ }, { "text": "Unit Testing", - "path": "UI/Angular/Unit-Testing.md" + "path": "UI/Angular/Testing.md" } ] }, From 3c8d1c4cdc90fee729dd7ae7c10b68300c2f3b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 7 Jan 2021 22:08:18 +0300 Subject: [PATCH 051/119] Remove debug log message --- .../Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs index 143a5659cc..006ad1f954 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs @@ -142,8 +142,6 @@ namespace Volo.Abp.Uow.EntityFrameworkCore private async Task CreateDbContextAsync(IUnitOfWork unitOfWork) { - Logger.LogDebug($"Creating a new DbContext of type {typeof(TDbContext).FullName}"); - return unitOfWork.Options.IsTransactional ? await CreateDbContextWithTransactionAsync(unitOfWork) : unitOfWork.ServiceProvider.GetRequiredService(); From 23b63272ceace8678b19221c7db74ab2245d7575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 7 Jan 2021 22:19:18 +0300 Subject: [PATCH 052/119] Add scopes. --- templates/app/angular/src/environments/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/app/angular/src/environments/environment.ts b/templates/app/angular/src/environments/environment.ts index 8ec05407c6..abbb289b19 100644 --- a/templates/app/angular/src/environments/environment.ts +++ b/templates/app/angular/src/environments/environment.ts @@ -14,7 +14,7 @@ export const environment = { redirectUri: baseUrl, clientId: 'MyProjectName_App', responseType: 'code', - scope: 'offline_access MyProjectName', + scope: 'offline_access openid profile role email phone MyProjectName', }, apis: { default: { From 913a2a33b69a7b9f3f41bd45bbb8911e56f21a43 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 8 Jan 2021 20:14:16 +0800 Subject: [PATCH 053/119] Move _ViewImports to Pages folder. --- .../Pages/{MyProjectName => }/_ViewImports.cshtml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/{MyProjectName => }/_ViewImports.cshtml (100%) diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/_ViewImports.cshtml b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/_ViewImports.cshtml similarity index 100% rename from templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/_ViewImports.cshtml rename to templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/_ViewImports.cshtml From 6992d5c60fe0549cb966be395f78cd2a4aa7df0e Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Fri, 8 Jan 2021 15:48:22 +0300 Subject: [PATCH 054/119] move CI testing configuration to bottom --- docs/en/UI/Angular/Testing.md | 50 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/docs/en/UI/Angular/Testing.md b/docs/en/UI/Angular/Testing.md index e26e1b4a51..7b93d48585 100644 --- a/docs/en/UI/Angular/Testing.md +++ b/docs/en/UI/Angular/Testing.md @@ -6,30 +6,6 @@ ABP Angular UI is tested like any other Angular application. So, [the guide here In Angular, unit tests use [Karma](https://karma-runner.github.io/) and [Jasmine](https://jasmine.github.io) by default. Although we like Jest more, we chose not to deviate from these defaults, so **the application template you download will have Karma and Jasmine preconfigured**. You can find the Karma configuration inside the _karma.conf.js_ file in the root folder. You don't have to do anything. Adding a spec file and running `npm test` will work. -You would need a different configuration for your CI environment. To set up a new configuration for your unit tests, find the test project in _angular.json_ file and add one as seen below: - -```json -// angular.json - -"test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { /* several options here */ }, - "configurations": { - "production": { - "karmaConfig": "karma.conf.prod.js" - } - } -} -``` - -Now you can copy the _karma.conf.js_ as _karma.conf.prod.js_ and use any configuration you like in it. Please check [Karma configuration file document](http://karma-runner.github.io/5.2/config/configuration-file.html) for config options. - -Finally, don't forget to run your CI tests with the following command: - -```sh -npm test -- --prod -``` - ## Basics An over-simplified spec file looks like this: @@ -372,3 +348,29 @@ describe("Country", () => { }); }); ``` + +## CI Configuration + +You would need a different configuration for your CI environment. To set up a new configuration for your unit tests, find the test project in _angular.json_ file and add one as seen below: + +```json +// angular.json + +"test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { /* several options here */ }, + "configurations": { + "production": { + "karmaConfig": "karma.conf.prod.js" + } + } +} +``` + +Now you can copy the _karma.conf.js_ as _karma.conf.prod.js_ and use any configuration you like in it. Please check [Karma configuration file document](http://karma-runner.github.io/5.2/config/configuration-file.html) for config options. + +Finally, don't forget to run your CI tests with the following command: + +```sh +npm test -- --prod +``` From 0df01129f0a7ec0d4dd960d91049bbdaca81c279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 8 Jan 2021 18:10:08 +0300 Subject: [PATCH 055/119] Fixed #7104: Setting RabbitMQ connection in appsettings.json causes consumers to not consume messages --- .../Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs | 7 +++++++ .../Volo/Abp/RabbitMQ/RabbitMqConnections.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs index a96309a1a8..feeb3a0431 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs @@ -15,6 +15,13 @@ namespace Volo.Abp.RabbitMQ { var configuration = context.Services.GetConfiguration(); Configure(configuration.GetSection("RabbitMQ")); + Configure(options => + { + foreach (var connectionFactory in options.Connections.Values) + { + connectionFactory.DispatchConsumersAsync = true; + } + }); } public override void OnApplicationShutdown(ApplicationShutdownContext context) diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs index f2b5168d82..a725291df8 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConnections.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.RabbitMQ public RabbitMqConnections() { - Default = new ConnectionFactory() { DispatchConsumersAsync = true }; + Default = new ConnectionFactory(); } public ConnectionFactory GetOrDefault(string connectionName) From f5bd8f768131fd197a3166190120fb850f1c0994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 16:03:10 +0300 Subject: [PATCH 056/119] Added DisableObsoleteDbContextCreationWarning to disable warning. --- .../UnitOfWorkDbContextProvider.cs | 15 +++++++++------ .../UnitOfWorkMongoDbContextProvider.cs | 15 +++++++++------ .../AsyncLocalSimpleScopeExtensions.cs | 18 ++++++++++++++++++ .../Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs | 3 +++ 4 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 framework/src/Volo.Abp.Threading/Volo/Abp/Threading/AsyncLocalSimpleScopeExtensions.cs diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs index 006ad1f954..364a29fb07 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs @@ -39,12 +39,15 @@ namespace Volo.Abp.Uow.EntityFrameworkCore [Obsolete("Use GetDbContextAsync method.")] public TDbContext GetDbContext() { - Logger.LogWarning( - "UnitOfWorkDbContextProvider.GetDbContext is deprecated. Use GetDbContextAsync instead! " + - "You are probably using LINQ (LINQ extensions) directly on a repository. In this case, use repository.GetQueryableAsync() method " + - "to obtain an IQueryable instance and use LINQ (LINQ extensions) on this object. " - ); - Logger.LogWarning(Environment.StackTrace.Truncate(2048)); + if (!UnitOfWork.DisableObsoleteDbContextCreationWarning.Value) + { + Logger.LogWarning( + "UnitOfWorkDbContextProvider.GetDbContext is deprecated. Use GetDbContextAsync instead! " + + "You are probably using LINQ (LINQ extensions) directly on a repository. In this case, use repository.GetQueryableAsync() method " + + "to obtain an IQueryable instance and use LINQ (LINQ extensions) on this object. " + ); + Logger.LogWarning(Environment.StackTrace.Truncate(2048)); + } var unitOfWork = _unitOfWorkManager.Current; if (unitOfWork == null) diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs index 724e7673fc..6db6aec6b5 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs @@ -36,12 +36,15 @@ namespace Volo.Abp.Uow.MongoDB [Obsolete("Use CreateDbContextAsync")] public TMongoDbContext GetDbContext() { - Logger.LogWarning( - "UnitOfWorkDbContextProvider.GetDbContext is deprecated. Use GetDbContextAsync instead! " + - "You are probably using LINQ (LINQ extensions) directly on a repository. In this case, use repository.GetQueryableAsync() method " + - "to obtain an IQueryable instance and use LINQ (LINQ extensions) on this object. " - ); - Logger.LogWarning(Environment.StackTrace.Truncate(2048)); + if (!UnitOfWork.DisableObsoleteDbContextCreationWarning.Value) + { + Logger.LogWarning( + "UnitOfWorkDbContextProvider.GetDbContext is deprecated. Use GetDbContextAsync instead! " + + "You are probably using LINQ (LINQ extensions) directly on a repository. In this case, use repository.GetQueryableAsync() method " + + "to obtain an IQueryable instance and use LINQ (LINQ extensions) on this object. " + ); + Logger.LogWarning(Environment.StackTrace.Truncate(2048)); + } var unitOfWork = _unitOfWorkManager.Current; if (unitOfWork == null) diff --git a/framework/src/Volo.Abp.Threading/Volo/Abp/Threading/AsyncLocalSimpleScopeExtensions.cs b/framework/src/Volo.Abp.Threading/Volo/Abp/Threading/AsyncLocalSimpleScopeExtensions.cs new file mode 100644 index 0000000000..cb58ea26f9 --- /dev/null +++ b/framework/src/Volo.Abp.Threading/Volo/Abp/Threading/AsyncLocalSimpleScopeExtensions.cs @@ -0,0 +1,18 @@ +using System; +using System.Threading; + +namespace Volo.Abp.Threading +{ + public static class AsyncLocalSimpleScopeExtensions + { + public static IDisposable SetScoped(this AsyncLocal asyncLocal, T value) + { + var previousValue = asyncLocal.Value; + asyncLocal.Value = value; + return new DisposeAction(() => + { + asyncLocal.Value = previousValue; + }); + } + } +} diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs index d53acc8f66..2e4b40877f 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs @@ -11,6 +11,9 @@ namespace Volo.Abp.Uow { public class UnitOfWork : IUnitOfWork, ITransientDependency { + [Obsolete("This will be removed in next versions.")] + public static AsyncLocal DisableObsoleteDbContextCreationWarning { get; } = new AsyncLocal(); + public const string UnitOfWorkReservationName = "_AbpActionUnitOfWork"; public Guid Id { get; } = Guid.NewGuid(); From 24e889c842cc00b29776389180fa24ade826c445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 16:40:27 +0300 Subject: [PATCH 057/119] Volo.Abp.AspNetCore.Mvc.Contracts should not depend on Volo.Abp.Ddd.Application --- .../Volo.Abp.AspNetCore.Mvc.Client.Common.csproj | 2 ++ .../Mvc/Client/AbpAspNetCoreMvcClientCommonModule.cs | 6 +++++- .../Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs | 2 +- .../Volo.Abp.AspNetCore.Mvc.Contracts.csproj | 2 +- .../Abp/AspNetCore/Mvc/AbpAspNetCoreMvcContractsModule.cs | 2 +- .../Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj | 1 + .../Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 4 +++- 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj index dc672d842f..b509a5df59 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj @@ -16,7 +16,9 @@ + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientCommonModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientCommonModule.cs index de5e80ff64..b37c9d57fd 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientCommonModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientCommonModule.cs @@ -1,5 +1,7 @@ using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Authorization; using Volo.Abp.Caching; +using Volo.Abp.Features; using Volo.Abp.Http.Client; using Volo.Abp.Localization; using Volo.Abp.Modularity; @@ -10,7 +12,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Client typeof(AbpHttpClientModule), typeof(AbpAspNetCoreMvcContractsModule), typeof(AbpCachingModule), - typeof(AbpLocalizationModule) + typeof(AbpLocalizationModule), + typeof(AbpAuthorizationModule), + typeof(AbpFeaturesModule) )] public class AbpAspNetCoreMvcClientCommonModule : AbpModule { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs index 4cba01bea2..f769f512a5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client ConfigurationClient = configurationClient; } - public async override Task GetOrNullAsync(string name) + public override async Task GetOrNullAsync(string name) { var configuration = await ConfigurationClient.GetAsync(); return configuration.Features.Values.GetOrDefault(name); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj index 04b2e7ec59..7a5da3dca7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj @@ -15,7 +15,7 @@ - + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcContractsModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcContractsModule.cs index 54a7589dd4..3bf299437c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcContractsModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcContractsModule.cs @@ -4,7 +4,7 @@ using Volo.Abp.Modularity; namespace Volo.Abp.AspNetCore.Mvc { [DependsOn( - typeof(AbpDddApplicationModule) + typeof(AbpDddApplicationContractsModule) )] public class AbpAspNetCoreMvcContractsModule : AbpModule { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj index d0806d929d..81c4a3e7e6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj @@ -21,6 +21,7 @@ + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs index e5edd9662d..0c2e9345e6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs @@ -22,6 +22,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Localization; using Volo.Abp.ApiVersioning; +using Volo.Abp.Application; using Volo.Abp.AspNetCore.Mvc.AntiForgery; using Volo.Abp.AspNetCore.Mvc.ApiExploring; using Volo.Abp.AspNetCore.Mvc.Conventions; @@ -49,7 +50,8 @@ namespace Volo.Abp.AspNetCore.Mvc typeof(AbpApiVersioningAbstractionsModule), typeof(AbpAspNetCoreMvcContractsModule), typeof(AbpUiNavigationModule), - typeof(AbpGlobalFeaturesModule) + typeof(AbpGlobalFeaturesModule), + typeof(AbpDddApplicationModule) )] public class AbpAspNetCoreMvcModule : AbpModule { From 6c0760680d3d200b84fcdb274089adabd3e51d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 18:47:38 +0300 Subject: [PATCH 058/119] Fix AbpTimingModule dependencies. --- framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj | 1 - .../src/Volo.Abp.Timing/Volo/Abp/Timing/AbpTimingModule.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj b/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj index c0a9f0b271..20a4521445 100644 --- a/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj +++ b/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj @@ -20,7 +20,6 @@ - diff --git a/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/AbpTimingModule.cs b/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/AbpTimingModule.cs index 3db42c2e55..670eef0fe6 100644 --- a/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/AbpTimingModule.cs +++ b/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/AbpTimingModule.cs @@ -8,7 +8,7 @@ using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.Timing { [DependsOn( - typeof(AbpVirtualFileSystemModule), + typeof(AbpLocalizationModule), typeof(AbpSettingsModule) )] public class AbpTimingModule : AbpModule From ea0bf50d131169d784a4fbf0a2368c8f1c611488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 18:48:12 +0300 Subject: [PATCH 059/119] Introduce a way to reset MVC client cache. --- .../Volo.Abp.AspNetCore.Mvc.Client.csproj | 1 + .../Client/AbpAspNetCoreMvcClientModule.cs | 6 ++-- ...MvcCachedApplicationConfigurationClient.cs | 4 +-- ...hedApplicationConfigurationClientHelper.cs | 13 +++++++ ...tionConfigurationCacheResetEventHandler.cs | 34 +++++++++++++++++++ ...icationConfigurationCacheResetEventData.cs | 10 ++++++ 6 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCurrentApplicationConfigurationCacheResetEventHandler.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentApplicationConfigurationCacheResetEventData.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj index 3657e27fef..aae260d7e8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj @@ -18,6 +18,7 @@ + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs index 1186b48ae7..48e2461167 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs @@ -1,9 +1,11 @@ -using Volo.Abp.Modularity; +using Volo.Abp.EventBus; +using Volo.Abp.Modularity; namespace Volo.Abp.AspNetCore.Mvc.Client { [DependsOn( - typeof(AbpAspNetCoreMvcClientCommonModule) + typeof(AbpAspNetCoreMvcClientCommonModule), + typeof(AbpEventBusModule) )] public class AbpAspNetCoreMvcClientModule : AbpModule { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs index a6a4d33668..4f5b7c84b0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs @@ -56,7 +56,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client async () => await Proxy.Service.GetAsync(), () => new DistributedCacheEntryOptions { - AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(120) //TODO: Should be configurable. Default value should be higher (5 mins would be good). + AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300) //TODO: Should be configurable. } ); @@ -83,7 +83,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client protected virtual string CreateCacheKey() { - return $"ApplicationConfiguration_{CurrentUser.Id?.ToString("N") ?? "Anonymous"}_{CultureInfo.CurrentUICulture.Name}"; + return MvcCachedApplicationConfigurationClientHelper.CreateCacheKey(CurrentUser); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs new file mode 100644 index 0000000000..4b4a0e6301 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs @@ -0,0 +1,13 @@ +using System.Globalization; +using Volo.Abp.Users; + +namespace Volo.Abp.AspNetCore.Mvc.Client +{ + internal static class MvcCachedApplicationConfigurationClientHelper + { + public static string CreateCacheKey(ICurrentUser currentUser) + { + return $"ApplicationConfiguration_{currentUser.Id?.ToString("N") ?? "Anonymous"}_{CultureInfo.CurrentUICulture.Name}"; + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCurrentApplicationConfigurationCacheResetEventHandler.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCurrentApplicationConfigurationCacheResetEventHandler.cs new file mode 100644 index 0000000000..e8f5b201da --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCurrentApplicationConfigurationCacheResetEventHandler.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus; +using Volo.Abp.Users; + +namespace Volo.Abp.AspNetCore.Mvc.Client +{ + public class MvcCurrentApplicationConfigurationCacheResetEventHandler : + ILocalEventHandler, + ITransientDependency + { + protected ICurrentUser CurrentUser { get; } + protected IDistributedCache Cache { get; } + + public MvcCurrentApplicationConfigurationCacheResetEventHandler(ICurrentUser currentUser, + IDistributedCache cache) + { + CurrentUser = currentUser; + Cache = cache; + } + + public virtual async Task HandleEventAsync(CurrentApplicationConfigurationCacheResetEventData eventData) + { + await Cache.RemoveAsync(CreateCacheKey()); + } + + protected virtual string CreateCacheKey() + { + return MvcCachedApplicationConfigurationClientHelper.CreateCacheKey(CurrentUser); + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentApplicationConfigurationCacheResetEventData.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentApplicationConfigurationCacheResetEventData.cs new file mode 100644 index 0000000000..e84e96d9dd --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentApplicationConfigurationCacheResetEventData.cs @@ -0,0 +1,10 @@ +namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations +{ + /// + /// This event is used to invalidate current user's cached configuration. + /// + public class CurrentApplicationConfigurationCacheResetEventData + { + + } +} From 515a26c1574c7e485353a3df68ca337d7595eabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 18:48:33 +0300 Subject: [PATCH 060/119] Reset MVC client cache on permission changes. --- .../PermissionManagementModal.cshtml.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs index 041121b8cb..a990437464 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs @@ -3,7 +3,9 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.EventBus.Local; using Volo.Abp.PermissionManagement.Web.Utils; namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement @@ -31,11 +33,16 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement protected IPermissionAppService PermissionAppService { get; } - public PermissionManagementModal(IPermissionAppService permissionAppService) + protected ILocalEventBus LocalEventBus { get; } + + public PermissionManagementModal( + IPermissionAppService permissionAppService, + ILocalEventBus localEventBus) { ObjectMapperContext = typeof(AbpPermissionManagementWebModule); PermissionAppService = permissionAppService; + LocalEventBus = localEventBus; } public virtual async Task OnGetAsync() @@ -88,6 +95,10 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement } ); + await LocalEventBus.PublishAsync( + new CurrentApplicationConfigurationCacheResetEventData() + ); + return NoContent(); } @@ -155,4 +166,4 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement public string ProviderKey { get; set; } } } -} \ No newline at end of file +} From 590ae4d30069adf9432d72b132b15e66c068629a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 18:57:44 +0300 Subject: [PATCH 061/119] Invalidate current user client cache on feature changes. --- .../FeatureManagement/FeatureManagementModal.cshtml.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index 367268019c..3572e65d3b 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -3,7 +3,9 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.EventBus.Local; using Volo.Abp.Features; using Volo.Abp.Validation.StringValues; @@ -27,6 +29,8 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement protected IFeatureAppService FeatureAppService { get; } + protected ILocalEventBus LocalEventBus { get; } + public FeatureManagementModal(IFeatureAppService featureAppService) { ObjectMapperContext = typeof(AbpFeatureManagementWebModule); @@ -56,6 +60,10 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement await FeatureAppService.UpdateAsync(ProviderName, ProviderKey, features); + await LocalEventBus.PublishAsync( + new CurrentApplicationConfigurationCacheResetEventData() + ); + return NoContent(); } From 9da2acc087819bdb83e0c3533e6be2ed73a8469a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 19:33:46 +0300 Subject: [PATCH 062/119] Refresh configuration on setting changes. --- .../Pages/SettingManagement/Index.cshtml.cs | 21 ++++++++++++++++--- .../Pages/SettingManagement/Index.js | 4 ++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs index 7f9c332e13..87eb2e5bf4 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs @@ -2,7 +2,9 @@ using System; using System.Threading.Tasks; using Microsoft.Extensions.Options; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.EventBus.Local; namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement { @@ -10,10 +12,14 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement { public SettingPageCreationContext SettingPageCreationContext { get; private set; } + protected ILocalEventBus LocalEventBus { get; } protected SettingManagementPageOptions Options { get; } - public IndexModel(IOptions options) + public IndexModel( + IOptions options, + ILocalEventBus localEventBus) { + LocalEventBus = localEventBus; Options = options.Value; } @@ -25,7 +31,7 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement { await contributor.ConfigureAsync(SettingPageCreationContext); } - + return Page(); } @@ -33,5 +39,14 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement { return Task.FromResult(Page()); } + + public virtual async Task OnPostRefreshConfigurationAsync() + { + await LocalEventBus.PublishAsync( + new CurrentApplicationConfigurationCacheResetEventData() + ); + + return NoContent(); + } } -} \ No newline at end of file +} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.js b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.js index 32ea1a27cc..fdd63bd4fd 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.js +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.js @@ -3,5 +3,9 @@ $(document).on('AbpSettingSaved', function () { abp.notify.success(l('SuccessfullySaved')); + + abp.ajax({ + url: abp.appPath + 'SettingManagement?handler=RefreshConfiguration' + }); }); })(jQuery); From 1684e910dc16cb649eb7f83fb8d003275e777f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 19:42:35 +0300 Subject: [PATCH 063/119] Fix FeatureManagementModal --- .../Pages/FeatureManagement/FeatureManagementModal.cshtml.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index 3572e65d3b..d2ccc5a44d 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -31,11 +31,14 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement protected ILocalEventBus LocalEventBus { get; } - public FeatureManagementModal(IFeatureAppService featureAppService) + public FeatureManagementModal( + IFeatureAppService featureAppService, + ILocalEventBus localEventBus) { ObjectMapperContext = typeof(AbpFeatureManagementWebModule); FeatureAppService = featureAppService; + LocalEventBus = localEventBus; } public virtual async Task OnGetAsync() From 7d049361d716c3e720ea1e801e3cce1113fb0b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 20:43:11 +0300 Subject: [PATCH 064/119] MethodInvocationAuthorizationService should constructor-inject instead of resolving. --- .../MethodInvocationAuthorizationService.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs index 7a34598a66..eec672e718 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs @@ -11,11 +11,15 @@ namespace Volo.Abp.Authorization { public class MethodInvocationAuthorizationService : IMethodInvocationAuthorizationService, ITransientDependency { - private readonly IServiceProvider _serviceProvider; + private readonly IAbpAuthorizationPolicyProvider _abpAuthorizationPolicyProvider; + private readonly IAbpAuthorizationService _abpAuthorizationService; - public MethodInvocationAuthorizationService(IServiceProvider serviceProvider) + public MethodInvocationAuthorizationService( + IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider, + IAbpAuthorizationService abpAuthorizationService) { - _serviceProvider = serviceProvider; + _abpAuthorizationPolicyProvider = abpAuthorizationPolicyProvider; + _abpAuthorizationService = abpAuthorizationService; } public async Task CheckAsync(MethodInvocationAuthorizationContext context) @@ -26,7 +30,7 @@ namespace Volo.Abp.Authorization } var authorizationPolicy = await AuthorizationPolicy.CombineAsync( - _serviceProvider.GetRequiredService(), + _abpAuthorizationPolicyProvider, GetAuthorizationDataAttributes(context.Method) ); @@ -35,7 +39,7 @@ namespace Volo.Abp.Authorization return; } - await _serviceProvider.GetRequiredService().CheckAsync(authorizationPolicy); + await _abpAuthorizationService.CheckAsync(authorizationPolicy); } protected virtual bool AllowAnonymous(MethodInvocationAuthorizationContext context) From f791763c4438c388b8f291f7b01ba80d0bd3fb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 21:02:04 +0300 Subject: [PATCH 065/119] Grammar improvements --- docs/en/Modules/Index.md | 2 +- docs/en/Modules/Setting-Management.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/Modules/Index.md b/docs/en/Modules/Index.md index 9d0199f4c3..8851f8b554 100644 --- a/docs/en/Modules/Index.md +++ b/docs/en/Modules/Index.md @@ -2,7 +2,7 @@ ABP is a **modular application framework** which consists of dozens of **NuGet & NPM packages**. It also provides a complete infrastructure to build your own application modules which may have entities, services, database integration, APIs, UI components and so on. -There are **two types of modules.** They don't have any structural difference but categorized by functionality and purpose: +There are **two types of modules.** They don't have any structural difference but are categorized by functionality and purpose: * [**Framework modules**](https://github.com/abpframework/abp/tree/master/framework/src): These are **core modules of the framework** like caching, emailing, theming, security, serialization, validation, EF Core integration, MongoDB integration... etc. They do not have application/business functionalities but makes your daily development easier by providing common infrastructure, integration and abstractions. * [**Application modules**](https://github.com/abpframework/abp/tree/master/modules): These modules implement specific application/business functionalities like blogging, document management, identity management, tenant management... etc. They generally have their own entities, services, APIs and UI components. diff --git a/docs/en/Modules/Setting-Management.md b/docs/en/Modules/Setting-Management.md index 134e24aed2..dff8da3f8e 100644 --- a/docs/en/Modules/Setting-Management.md +++ b/docs/en/Modules/Setting-Management.md @@ -75,7 +75,7 @@ Setting values are cached using the [distributed cache](../Caching.md) system. A ## Setting Management Providers -Setting Management module is extensible, just like the [setting system](../Settings.md). You can extend it by defining setting management providers. There are 5 pre-built setting management providers registered by the order below: +Setting Management module is extensible, just like the [setting system](../Settings.md). You can extend it by defining setting management providers. There are 5 pre-built setting management providers registered it the following order: * `DefaultValueSettingManagementProvider`: Gets the value from the default value of the setting definition. It can not set the default value since default values are hard-coded on the setting definition. * `ConfigurationSettingManagementProvider`: Gets the value from the [IConfiguration service](../Configuration.md). It can not set the configuration value because it is not possible to change the configuration values on runtime. From 6c1abd6146ea613ac6862abecb353ce8360f3da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 9 Jan 2021 21:02:29 +0300 Subject: [PATCH 066/119] Remove unused namespaces. --- .../Abp/Authorization/MethodInvocationAuthorizationService.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs index eec672e718..c00c652500 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs @@ -1,10 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; namespace Volo.Abp.Authorization From 05cc671f4745ae62bf47e8f951052767aa935abc Mon Sep 17 00:00:00 2001 From: Nicolas <36539498+hnicolus@users.noreply.github.com> Date: Sun, 10 Jan 2021 02:03:35 +0200 Subject: [PATCH 067/119] Update Blob-Storing.md --- docs/en/Blob-Storing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Blob-Storing.md b/docs/en/Blob-Storing.md index 63281a5ee6..b7bd31dade 100644 --- a/docs/en/Blob-Storing.md +++ b/docs/en/Blob-Storing.md @@ -14,7 +14,7 @@ ABP BLOB Storage system is also compatible to other ABP Framework features like ## BLOB Storage Providers -The ABP Framework has already the following storage provider implementations; +The ABP Framework has already the following storage provider implementations: * [File System](Blob-Storing-File-System.md): Stores BLOBs in a folder of the local file system, as standard files. * [Database](Blob-Storing-Database.md): Stores BLOBs in a database. From 68602fd65f45a2b7feb53bee5533445d43c975c3 Mon Sep 17 00:00:00 2001 From: Kamal Alseisy Date: Sun, 10 Jan 2021 10:59:20 +0200 Subject: [PATCH 068/119] fix totalCount in IdentityRole GetList in case of using filter --- .../Volo/Abp/Identity/IdentityRoleAppService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index 9eecb1058e..070f55901e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.Identity public virtual async Task> GetListAsync(GetIdentityRolesInput input) { var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); - var totalCount = await RoleRepository.GetCountAsync(); + var totalCount = await RoleRepository.GetCountAsync(input.Filter); return new PagedResultDto( totalCount, From 1cb9a6e9d01eb27500c522f2b1ab9eba37c43941 Mon Sep 17 00:00:00 2001 From: Oliver Cooper Date: Sun, 10 Jan 2021 12:12:26 +0000 Subject: [PATCH 069/119] Make AccountEmailer.NormalizeReturnUrl method protected --- .../Volo/Abp/Account/Emailing/AccountEmailer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs index baa762c840..6852b85b30 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs @@ -72,7 +72,7 @@ namespace Volo.Abp.Account.Emailing ); } - private string NormalizeReturnUrl(string returnUrl) + protected string NormalizeReturnUrl(string returnUrl) { if (returnUrl.IsNullOrEmpty()) { From a8c94b896416299121570d7a12a153511dda4212 Mon Sep 17 00:00:00 2001 From: olicooper Date: Sun, 10 Jan 2021 13:53:37 +0000 Subject: [PATCH 070/119] docs: Fix incorrect text templating instructions "" doesn't exist in the project file schema: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-project-file-schema-reference?view=vs-2019 --- docs/en/Text-Templating.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Text-Templating.md b/docs/en/Text-Templating.md index b080087ba8..bdea7cd00b 100644 --- a/docs/en/Text-Templating.md +++ b/docs/en/Text-Templating.md @@ -423,7 +423,7 @@ This example simply adds a header and footer to the template and renders the con **3)** Configure the embedded resources in the `.csproj` file * Add [Microsoft.Extensions.FileProviders.Embedded](https://www.nuget.org/packages/Microsoft.Extensions.FileProviders.Embedded) NuGet package to the project. -* Add `true` into the `...` section of your `.csproj` file. +* Add `true` into the `...` section of your `.csproj` file. * Add the following code into your `.csproj` file: ````xml From 1647b729e57d0fc42c8983b44fa4396d2ee188b3 Mon Sep 17 00:00:00 2001 From: Oliver Cooper Date: Sun, 10 Jan 2021 20:21:37 +0000 Subject: [PATCH 071/119] Make AccountEmailer.NormalizeReturnUrl method protected virtual --- .../Volo/Abp/Account/Emailing/AccountEmailer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs index 6852b85b30..1d7379bd04 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Emailing/AccountEmailer.cs @@ -72,7 +72,7 @@ namespace Volo.Abp.Account.Emailing ); } - protected string NormalizeReturnUrl(string returnUrl) + protected virtual string NormalizeReturnUrl(string returnUrl) { if (returnUrl.IsNullOrEmpty()) { From 5318451927f95a0a312f0189bc4e09fccebc64cf Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 11 Jan 2021 00:17:00 +0300 Subject: [PATCH 072/119] Sorting all modifiers --- .../Themes/Basic/LanguageSwitch.razor | 2 +- .../Themes/Basic/LoginDisplay.razor.cs | 2 +- .../Themes/Basic/NavMenu.razor.cs | 2 +- .../Themes/Basic/NavToolbar.razor.cs | 2 +- .../MultiTenancy/FormTenantResolveContributor.cs | 2 +- .../MultiTenancy/HttpTenantResolveContributerBase.cs | 2 +- .../Breadcrumb/AbpBreadcrumbTagHelperService.cs | 2 +- .../TagHelpers/Carousel/AbpCarouselTagHelperService.cs | 2 +- .../Collapse/AbpAccordionItemTagHelperService.cs | 2 +- .../TagHelpers/Collapse/AbpAccordionTagHelperService.cs | 2 +- .../Collapse/AbpCollapseBodyTagHelperService.cs | 2 +- .../Dropdown/AbpDropdownButtonTagHelperService.cs | 2 +- .../TagHelpers/Form/AbpDynamicformTagHelperService.cs | 2 +- .../TagHelpers/Form/AbpInputTagHelperService.cs | 2 +- .../TagHelpers/Form/AbpSelectTagHelperService.cs | 2 +- .../TagHelpers/Modal/AbpModalTagHelperService.cs | 2 +- .../Pagination/AbpPaginationTagHelperService.cs | 2 +- .../TagHelpers/Tab/AbpTabDropdownTagHelperService.cs | 2 +- .../TagHelpers/Tab/AbpTabTagHelperService.cs | 2 +- .../TagHelpers/Tab/AbpTabsTagHelperService.cs | 2 +- .../Bundling/TagHelpers/AbpBundleItemTagHelperService.cs | 2 +- .../UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs | 2 +- .../UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs | 2 +- .../UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs | 2 +- .../Shared/TagHelpers/AbpComponentDemoSectionTagHelper.cs | 2 +- .../Mvc/Content/RemoteStreamContentOutputFormatter.cs | 2 +- .../SecurityLog/AspNetCoreSecurityLogManager.cs | 2 +- .../Abp/Authorization/AbpAuthorizationPolicyProvider.cs | 2 +- .../Abp/Authorization/PermissionRequirementHandler.cs | 2 +- .../Permissions/ClientPermissionValueProvider.cs | 4 ++-- .../Permissions/RolePermissionValueProvider.cs | 4 ++-- .../Permissions/UserPermissionValueProvider.cs | 4 ++-- .../Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs | 2 +- .../AsyncPeriodicBackgroundWorkerBase.cs | 4 ++-- .../Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs | 4 ++-- .../Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs | 2 +- .../Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs | 2 +- .../Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs | 8 ++++---- .../Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs | 8 ++++---- .../Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs | 4 ++-- .../Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs | 8 ++++---- .../DynamicProxy/CastleAbpMethodInvocationAdapter.cs | 2 +- .../CastleAbpMethodInvocationAdapterWithReturnValue.cs | 2 +- .../DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs | 4 ++-- .../Volo/Abp/Emailing/BackgroundEmailSendingJob.cs | 2 +- .../Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs | 2 +- .../Volo/Abp/EntityFrameworkCore/AbpDbContext.cs | 2 +- .../Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs | 2 +- .../Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs | 2 +- .../Volo/Abp/EventBus/Local/LocalEventBus.cs | 2 +- .../Volo/Abp/Features/EditionFeatureValueProvider.cs | 2 +- .../Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs | 2 +- .../Volo/Abp/Features/TenantFeatureValueProvider.cs | 2 +- ...xtIdentityModelRemoteServiceHttpClientAuthenticator.cs | 2 +- ...erIdentityModelRemoteServiceHttpClientAuthenticator.cs | 2 +- .../Client/DynamicProxying/DynamicHttpProxyInterceptor.cs | 2 +- .../Volo/Abp/MailKit/MailKitSmtpEmailSender.cs | 2 +- .../Volo/Abp/Settings/TenantSettingValueProvider.cs | 4 ++-- .../Volo/Abp/Settings/UserSettingValueProvider.cs | 4 ++-- .../BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs | 2 +- .../Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs | 2 +- .../Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs | 2 +- .../Abp/MongoDB/Repositories/Repository_Basic_Tests.cs | 2 +- .../Volo/Abp/TestApp/Application/DistrictAppService.cs | 4 ++-- 64 files changed, 83 insertions(+), 83 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor index 6b93618f44..bfc970c436 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor @@ -21,7 +21,7 @@ private IReadOnlyList _otherLanguages; private LanguageInfo _currentLanguage; - protected async override Task OnInitializedAsync() + protected override async Task OnInitializedAsync() { var selectedLanguageName = await JsRuntime.InvokeAsync( "localStorage.getItem", diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs index 494eca34ab..3238483cfb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic protected ApplicationMenu Menu { get; set; } - protected async override Task OnInitializedAsync() + protected override async Task OnInitializedAsync() { Menu = await MenuManager.GetAsync(StandardMenus.User); diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavMenu.razor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavMenu.razor.cs index 1779d73d28..416efeffad 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavMenu.razor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavMenu.razor.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic protected ApplicationMenu Menu { get; set; } - protected async override Task OnInitializedAsync() + protected override async Task OnInitializedAsync() { Menu = await MenuManager.GetAsync(StandardMenus.Main); } diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavToolbar.razor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavToolbar.razor.cs index 33044282f9..6fddf263b3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavToolbar.razor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/NavToolbar.razor.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic private List ToolbarItemRenders { get; set; } = new List(); - protected async override Task OnInitializedAsync() + protected override async Task OnInitializedAsync() { var toolbar = await ToolbarManager.GetAsync(StandardToolbars.Main); diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/FormTenantResolveContributor.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/FormTenantResolveContributor.cs index 868ef78519..77c12bef7b 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/FormTenantResolveContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/FormTenantResolveContributor.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy public override string Name => ContributorName; - protected async override Task GetTenantIdOrNameFromHttpContextOrNullAsync(ITenantResolveContext context, HttpContext httpContext) + protected override async Task GetTenantIdOrNameFromHttpContextOrNullAsync(ITenantResolveContext context, HttpContext httpContext) { if (!httpContext.Request.HasFormContentType) { diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/HttpTenantResolveContributerBase.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/HttpTenantResolveContributerBase.cs index 18f76ee711..3b454b5ef9 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/HttpTenantResolveContributerBase.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/HttpTenantResolveContributerBase.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { public abstract class HttpTenantResolveContributorBase : TenantResolveContributorBase { - public async override Task ResolveAsync(ITenantResolveContext context) + public override async Task ResolveAsync(ITenantResolveContext context) { var httpContext = context.GetHttpContext(); if (httpContext == null) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs index e1b4469f8c..4b433ac495 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Breadcrumb { public class AbpBreadcrumbTagHelperService : AbpTagHelperService { - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { output.TagName = "nav"; output.Attributes.Add("aria-label", "breadcrumb"); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs index e4a277ba66..c3672db7f5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Carousel L = localizer; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { output.TagName = "div"; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs index f9e019391f..6afb918704 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse { public class AbpAccordionItemTagHelperService : AbpTagHelperService { - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { SetRandomIdIfNotProvided(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs index 7651309e1a..d55bb04d21 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse HtmlGenerator = htmlGenerator; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { SetRandomIdIfNotProvided(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs index 198c5b91e6..3c429b32ef 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs @@ -6,7 +6,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse { public class AbpCollapseBodyTagHelperService : AbpTagHelperService { - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { output.TagName = "div"; output.Attributes.AddClass("collapse"); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs index 52ea6ace85..c6a0307d2d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown _serviceProvider = serviceProvider; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var content = await output.GetChildContentAsync(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs index da622b968b..7d2f0804b7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form _localizer = localizer; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var list = InitilizeFormGroupContentsContext(context, output); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs index 246c611533..48abbd93e9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form _tagHelperLocalizer = tagHelperLocalizer; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var (innerHtml, isCheckBox) = await GetFormInputGroupAsHtmlAsync(context, output); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs index dde58ed3e4..6050fb91d6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form _stringLocalizerFactory = stringLocalizerFactory; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var innerHtml = await GetFormInputGroupAsHtmlAsync(context, output); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalTagHelperService.cs index aa83265e94..5bc2330bf1 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalTagHelperService.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal { public class AbpModalTagHelperService : AbpTagHelperService { - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { output.TagName = null; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs index 148f196aad..cb1e395f40 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination _stringLocalizerFactory = stringLocalizerFactory; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { if (TagHelper.Model.ShownItemsCount <= 0) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs index 02810e9666..726a947be2 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab { public class AbpTabDropdownTagHelperService : AbpTagHelperService { - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { if (string.IsNullOrWhiteSpace(TagHelper.Name)) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs index db05c5c686..a9a134ceba 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab { public class AbpTabTagHelperService : AbpTagHelperService { - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { SetPlaceholderForNameIfNotProvided(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs index 8046af8ccd..92e50990a4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab HtmlGenerator = htmlGenerator; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { SetRandomNameIfNotProvided(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs index 0ffb5b9049..eca80c5fcf 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers ResourceService = resourceService; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var tagHelperItems = context.Items.GetOrDefault(AbpTagHelperConsts.ContextBundleItemListKey) as List; if (tagHelperItems != null) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs index 9158f33b90..f0c76d5cc4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers ResourceService = resourceService; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { await ResourceService.ProcessAsync( TagHelper.ViewContext, diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs index 9e4e77a6dd..6efbb793e7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs @@ -38,7 +38,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers ); } - protected async override Task> GetBundleFilesAsync(string bundleName) + protected override async Task> GetBundleFilesAsync(string bundleName) { return await BundleManager.GetScriptBundleFilesAsync(bundleName); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs index a9d9b54fca..8612e4f8b4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs @@ -38,7 +38,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers ); } - protected async override Task> GetBundleFilesAsync(string bundleName) + protected override async Task> GetBundleFilesAsync(string bundleName) { return await BundleManager.GetStyleBundleFilesAsync(bundleName); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/TagHelpers/AbpComponentDemoSectionTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/TagHelpers/AbpComponentDemoSectionTagHelper.cs index 9a16b4b43a..328024cc2b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/TagHelpers/AbpComponentDemoSectionTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/TagHelpers/AbpComponentDemoSectionTagHelper.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S _guidGenerator = guidGenerator; } - public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { output.TagName = null; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs index d3ecfaff27..706e514254 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Content return typeof(IRemoteStreamContent).IsAssignableFrom(type); } - public async override Task WriteResponseBodyAsync(OutputFormatterWriteContext context) + public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context) { var remoteStream = (IRemoteStreamContent)context.Object; using (var stream = remoteStream.GetStream()) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/SecurityLog/AspNetCoreSecurityLogManager.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/SecurityLog/AspNetCoreSecurityLogManager.cs index b518c5abbb..f0fc0aa347 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/SecurityLog/AspNetCoreSecurityLogManager.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/SecurityLog/AspNetCoreSecurityLogManager.cs @@ -48,7 +48,7 @@ namespace Volo.Abp.AspNetCore.SecurityLog WebClientInfoProvider = webClientInfoProvider; } - protected async override Task CreateAsync() + protected override async Task CreateAsync() { var securityLogInfo = await base.CreateAsync(); diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs index f889251c69..f636877fc1 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.Authorization _options = options.Value; } - public async override Task GetPolicyAsync(string policyName) + public override async Task GetPolicyAsync(string policyName) { var policy = await base.GetPolicyAsync(policyName); if (policy != null) diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs index b0446f5602..d4ec7c1d3c 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.Authorization _permissionChecker = permissionChecker; } - protected async override Task HandleRequirementAsync( + protected override async Task HandleRequirementAsync( AuthorizationHandlerContext context, PermissionRequirement requirement) { diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs index ac76733524..6e14b304e3 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Authorization.Permissions CurrentTenant = currentTenant; } - public async override Task CheckAsync(PermissionValueCheckContext context) + public override async Task CheckAsync(PermissionValueCheckContext context) { var clientId = context.Principal?.FindFirst(AbpClaimTypes.ClientId)?.Value; @@ -36,7 +36,7 @@ namespace Volo.Abp.Authorization.Permissions } } - public async override Task CheckAsync(PermissionValuesCheckContext context) + public override async Task CheckAsync(PermissionValuesCheckContext context) { var permissionNames = context.Permissions.Select(x => x.Name).ToArray(); diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs index e3ab7629a2..eec94b3b98 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Authorization.Permissions } - public async override Task CheckAsync(PermissionValueCheckContext context) + public override async Task CheckAsync(PermissionValueCheckContext context) { var roles = context.Principal?.FindAll(AbpClaimTypes.Role).Select(c => c.Value).ToArray(); @@ -37,7 +37,7 @@ namespace Volo.Abp.Authorization.Permissions return PermissionGrantResult.Undefined; } - public async override Task CheckAsync(PermissionValuesCheckContext context) + public override async Task CheckAsync(PermissionValuesCheckContext context) { var permissionNames = context.Permissions.Select(x => x.Name).ToList(); var result = new MultiplePermissionGrantResult(permissionNames.ToArray()); diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs index fcdc25d1e1..c90344371e 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Authorization.Permissions } - public async override Task CheckAsync(PermissionValueCheckContext context) + public override async Task CheckAsync(PermissionValueCheckContext context) { var userId = context.Principal?.FindFirst(AbpClaimTypes.UserId)?.Value; @@ -30,7 +30,7 @@ namespace Volo.Abp.Authorization.Permissions : PermissionGrantResult.Undefined; } - public async override Task CheckAsync(PermissionValuesCheckContext context) + public override async Task CheckAsync(PermissionValuesCheckContext context) { var permissionNames = context.Permissions.Select(x => x.Name).ToArray(); diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs index 2635294323..8eec35d816 100644 --- a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs +++ b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.BackgroundJobs Timer.Period = WorkerOptions.JobPollPeriod; } - protected async override Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { var store = workerContext.ServiceProvider.GetRequiredService(); diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs index 094c6eb7eb..ce4f9b42d7 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs @@ -22,13 +22,13 @@ namespace Volo.Abp.BackgroundWorkers Timer.Elapsed = Timer_Elapsed; } - public async override Task StartAsync(CancellationToken cancellationToken = default) + public override async Task StartAsync(CancellationToken cancellationToken = default) { await base.StartAsync(cancellationToken); Timer.Start(cancellationToken); } - public async override Task StopAsync(CancellationToken cancellationToken = default) + public override async Task StopAsync(CancellationToken cancellationToken = default) { Timer.Stop(cancellationToken); await base.StopAsync(cancellationToken); diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs index 6ac757fef5..e89204e81f 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs @@ -25,13 +25,13 @@ namespace Volo.Abp.BackgroundWorkers Timer.Elapsed += Timer_Elapsed; } - public async override Task StartAsync(CancellationToken cancellationToken = default) + public override async Task StartAsync(CancellationToken cancellationToken = default) { await base.StartAsync(cancellationToken); Timer.Start(cancellationToken); } - public async override Task StopAsync(CancellationToken cancellationToken = default) + public override async Task StopAsync(CancellationToken cancellationToken = default) { Timer.Stop(cancellationToken); await base.StopAsync(cancellationToken); diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index e3e7112afa..7f0edf3b4a 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -41,7 +41,7 @@ namespace Volo.Abp.BlazoriseUI.Components [Inject] protected IUiMessageService UiMessageService { get; set; } - protected async override Task OnInitializedAsync() + protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); await SetDefaultValuesAsync(); diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs index d6c9303afd..39e8aff996 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs @@ -73,7 +73,7 @@ namespace Volo.Abp.BlobStoring.Aliyun return Task.FromResult(BlobExists(ossClient, containerName, blobName)); } - public async override Task GetOrNullAsync(BlobProviderGetArgs args) + public override async Task GetOrNullAsync(BlobProviderGetArgs args) { var containerName = GetContainerName(args); var blobName = AliyunBlobNameCalculator.Calculate(args); diff --git a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs index 191f9a0ac7..dd9c205d8b 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProvider.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.BlobStoring.Aws AmazonS3ClientFactory = amazonS3ClientFactory; } - public async override Task SaveAsync(BlobProviderSaveArgs args) + public override async Task SaveAsync(BlobProviderSaveArgs args) { var blobName = AwsBlobNameCalculator.Calculate(args); var configuration = args.Configuration.GetAwsConfiguration(); @@ -48,7 +48,7 @@ namespace Volo.Abp.BlobStoring.Aws } } - public async override Task DeleteAsync(BlobProviderDeleteArgs args) + public override async Task DeleteAsync(BlobProviderDeleteArgs args) { var blobName = AwsBlobNameCalculator.Calculate(args); var containerName = GetContainerName(args); @@ -70,7 +70,7 @@ namespace Volo.Abp.BlobStoring.Aws } } - public async override Task ExistsAsync(BlobProviderExistsArgs args) + public override async Task ExistsAsync(BlobProviderExistsArgs args) { var blobName = AwsBlobNameCalculator.Calculate(args); var containerName = GetContainerName(args); @@ -81,7 +81,7 @@ namespace Volo.Abp.BlobStoring.Aws } } - public async override Task GetOrNullAsync(BlobProviderGetArgs args) + public override async Task GetOrNullAsync(BlobProviderGetArgs args) { var blobName = AwsBlobNameCalculator.Calculate(args); var containerName = GetContainerName(args); diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs index 3a9a062e76..1afc3b6a53 100644 --- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.BlobStoring.Azure AzureBlobNameCalculator = azureBlobNameCalculator; } - public async override Task SaveAsync(BlobProviderSaveArgs args) + public override async Task SaveAsync(BlobProviderSaveArgs args) { var blobName = AzureBlobNameCalculator.Calculate(args); var configuration = args.Configuration.GetAzureConfiguration(); @@ -33,7 +33,7 @@ namespace Volo.Abp.BlobStoring.Azure await GetBlobClient(args, blobName).UploadAsync(args.BlobStream, true); } - public async override Task DeleteAsync(BlobProviderDeleteArgs args) + public override async Task DeleteAsync(BlobProviderDeleteArgs args) { var blobName = AzureBlobNameCalculator.Calculate(args); @@ -45,14 +45,14 @@ namespace Volo.Abp.BlobStoring.Azure return false; } - public async override Task ExistsAsync(BlobProviderExistsArgs args) + public override async Task ExistsAsync(BlobProviderExistsArgs args) { var blobName = AzureBlobNameCalculator.Calculate(args); return await BlobExistsAsync(args, blobName); } - public async override Task GetOrNullAsync(BlobProviderGetArgs args) + public override async Task GetOrNullAsync(BlobProviderGetArgs args) { var blobName = AzureBlobNameCalculator.Calculate(args); diff --git a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs index 3a512a0ba3..cbfe4bcaf7 100644 --- a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.BlobStoring.FileSystem FilePathCalculator = filePathCalculator; } - public async override Task SaveAsync(BlobProviderSaveArgs args) + public override async Task SaveAsync(BlobProviderSaveArgs args) { var filePath = FilePathCalculator.Calculate(args); @@ -59,7 +59,7 @@ namespace Volo.Abp.BlobStoring.FileSystem return ExistsAsync(filePath); } - public async override Task GetOrNullAsync(BlobProviderGetArgs args) + public override async Task GetOrNullAsync(BlobProviderGetArgs args) { var filePath = FilePathCalculator.Calculate(args); diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs index fca23324dc..8e18f9dedb 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.BlobStoring.Minio MinioBlobNameCalculator = minioBlobNameCalculator; } - public async override Task SaveAsync(BlobProviderSaveArgs args) + public override async Task SaveAsync(BlobProviderSaveArgs args) { var blobName = MinioBlobNameCalculator.Calculate(args); var configuration = args.Configuration.GetMinioConfiguration(); @@ -36,7 +36,7 @@ namespace Volo.Abp.BlobStoring.Minio await client.PutObjectAsync(containerName, blobName, args.BlobStream, args.BlobStream.Length); } - public async override Task DeleteAsync(BlobProviderDeleteArgs args) + public override async Task DeleteAsync(BlobProviderDeleteArgs args) { var blobName = MinioBlobNameCalculator.Calculate(args); var client = GetMinioClient(args); @@ -51,7 +51,7 @@ namespace Volo.Abp.BlobStoring.Minio return false; } - public async override Task ExistsAsync(BlobProviderExistsArgs args) + public override async Task ExistsAsync(BlobProviderExistsArgs args) { var blobName = MinioBlobNameCalculator.Calculate(args); var client = GetMinioClient(args); @@ -60,7 +60,7 @@ namespace Volo.Abp.BlobStoring.Minio return await BlobExistsAsync(client, containerName, blobName); } - public async override Task GetOrNullAsync(BlobProviderGetArgs args) + public override async Task GetOrNullAsync(BlobProviderGetArgs args) { var blobName = MinioBlobNameCalculator.Calculate(args); var client = GetMinioClient(args); diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs index 7a99859d3a..433fde192f 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs +++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Castle.DynamicProxy Proceed = proceed; } - public async override Task ProceedAsync() + public override async Task ProceedAsync() { await Proceed(Invocation, ProceedInfo); } diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterWithReturnValue.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterWithReturnValue.cs index a0babad231..ef1c0ae54d 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterWithReturnValue.cs +++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapterWithReturnValue.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Castle.DynamicProxy Proceed = proceed; } - public async override Task ProceedAsync() + public override async Task ProceedAsync() { ReturnValue = await Proceed(Invocation, ProceedInfo); } diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs index 6d08e8f6a6..8a0c4fdd45 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs +++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs @@ -15,14 +15,14 @@ namespace Volo.Abp.Castle.DynamicProxy _abpInterceptor = abpInterceptor; } - protected async override Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func proceed) + protected override async Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func proceed) { await _abpInterceptor.InterceptAsync( new CastleAbpMethodInvocationAdapter(invocation, proceedInfo, proceed) ); } - protected async override Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func> proceed) + protected override async Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func> proceed) { var adapter = new CastleAbpMethodInvocationAdapterWithReturnValue(invocation, proceedInfo, proceed); diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs index 5c704f74f0..a81bfb8c7f 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Emailing EmailSender = emailSender; } - public async override Task ExecuteAsync(BackgroundEmailSendingJobArgs args) + public override async Task ExecuteAsync(BackgroundEmailSendingJobArgs args) { if (args.From.IsNullOrWhiteSpace()) { diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs index 710febff9d..24ca7d6a34 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs @@ -67,7 +67,7 @@ namespace Volo.Abp.Emailing.Smtp } } - protected async override Task SendEmailAsync(MailMessage mail) + protected override async Task SendEmailAsync(MailMessage mail) { using (var smtpClient = await BuildClientAsync()) { diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index 43a17ddf33..42423cbf3b 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -146,7 +146,7 @@ namespace Volo.Abp.EntityFrameworkCore } } - public async override Task SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default) + public override async Task SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default) { try { diff --git a/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs index 363744c1d4..fd6d773952 100644 --- a/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs @@ -146,7 +146,7 @@ namespace Volo.Abp.EventBus.Kafka GetOrCreateHandlerFactories(eventType).Locking(factories => factories.Clear()); } - public async override Task PublishAsync(Type eventType, object eventData) + public override async Task PublishAsync(Type eventType, object eventData) { var eventName = EventNameAttribute.GetNameOrDefault(eventType); var body = Serializer.Serialize(eventData); diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs index 44d229ee94..ce3549646e 100644 --- a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs @@ -124,7 +124,7 @@ namespace Volo.Abp.EventBus.Rebus return Subscribe(typeof(TEvent), handler); } - public async override Task PublishAsync(Type eventType, object eventData) + public override async Task PublishAsync(Type eventType, object eventData) { await AbpRebusEventBusOptions.Publish(Rebus, eventType, eventData); } diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs index 828bd4f5c7..8c7bef6f2d 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs @@ -117,7 +117,7 @@ namespace Volo.Abp.EventBus.Local GetOrCreateHandlerFactories(eventType).Locking(factories => factories.Clear()); } - public async override Task PublishAsync(Type eventType, object eventData) + public override async Task PublishAsync(Type eventType, object eventData) { var exceptions = new List(); diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs index 3bb039f7b2..db8ec4774f 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Features PrincipalAccessor = principalAccessor; } - public async override Task GetOrNullAsync(FeatureDefinition feature) + public override async Task GetOrNullAsync(FeatureDefinition feature) { var editionId = PrincipalAccessor.Principal?.FindEditionId(); if (editionId == null) diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs index b52ffe355e..84257df293 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.Features ); } - public async override Task GetOrNullAsync(string name) + public override async Task GetOrNullAsync(string name) { var featureDefinition = FeatureDefinitionManager.Get(name); var providers = Enumerable diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs index 6e4dc669fa..2e6f72a9c6 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Features CurrentTenant = currentTenant; } - public async override Task GetOrNullAsync(FeatureDefinition feature) + public override async Task GetOrNullAsync(FeatureDefinition feature) { return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString()); } diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs index f3001eb443..a829a630d6 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextIdentityModelRemoteServiceHttpClientAuthenticator.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Http.Client.IdentityModel.Web { } - public async override Task Authenticate(RemoteServiceHttpClientAuthenticateContext context) + public override async Task Authenticate(RemoteServiceHttpClientAuthenticateContext context) { if (context.RemoteService.GetUseCurrentAccessToken() != false) { diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs index 0e0b659ef1..c86fc095c7 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.Http.Client.IdentityModel.WebAssembly AccessTokenProvider = accessTokenProvider; } - public async override Task Authenticate(RemoteServiceHttpClientAuthenticateContext context) + public override async Task Authenticate(RemoteServiceHttpClientAuthenticateContext context) { if (context.RemoteService.GetUseCurrentAccessToken() != false) { diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs index 48ba2f1a4f..7eb4e5ad78 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs @@ -75,7 +75,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying Logger = NullLogger>.Instance; } - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { if (invocation.Method.ReturnType.GenericTypeArguments.IsNullOrEmpty()) { diff --git a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs index d089f7b684..0fb93e8f40 100644 --- a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs +++ b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.MailKit SmtpConfiguration = smtpConfiguration; } - protected async override Task SendEmailAsync(MailMessage mail) + protected override async Task SendEmailAsync(MailMessage mail) { using (var client = await BuildClientAsync()) { diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs index 6286356a04..9c1d34b741 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs @@ -19,12 +19,12 @@ namespace Volo.Abp.Settings CurrentTenant = currentTenant; } - public async override Task GetOrNullAsync(SettingDefinition setting) + public override async Task GetOrNullAsync(SettingDefinition setting) { return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentTenant.Id?.ToString()); } - public async override Task> GetAllAsync(SettingDefinition[] settings) + public override async Task> GetAllAsync(SettingDefinition[] settings) { return await SettingStore.GetAllAsync(settings.Select(x => x.Name).ToArray(), Name, CurrentTenant.Id?.ToString()); } diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs index 8c337bbee4..08ac6cc471 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Settings CurrentUser = currentUser; } - public async override Task GetOrNullAsync(SettingDefinition setting) + public override async Task GetOrNullAsync(SettingDefinition setting) { if (CurrentUser.Id == null) { @@ -29,7 +29,7 @@ namespace Volo.Abp.Settings return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentUser.Id.ToString()); } - public async override Task> GetAllAsync(SettingDefinition[] settings) + public override async Task> GetAllAsync(SettingDefinition[] settings) { if (CurrentUser.Id == null) { diff --git a/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs b/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs index a448c2160e..776cc32c36 100644 --- a/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs +++ b/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs @@ -60,7 +60,7 @@ namespace Volo.Abp.BlobStoring.Minio }); } - public async override void OnApplicationShutdown(ApplicationShutdownContext context) + public override async void OnApplicationShutdown(ApplicationShutdownContext context) { var minioClient = new MinioClient(_endPoint, _accessKey, _secretKey); if (await minioClient.BucketExistsAsync(_randomContainerName)) diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs index 7f38276df2..029073a310 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.DynamicProxy { public class SimpleAsyncInterceptor : AbpInterceptor { - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { await Task.Delay(5); (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_InterceptAsync_BeforeInvocation"); diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs index ebbf890b14..f19864f554 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.DynamicProxy _cache = new ConcurrentDictionary(); } - public async override Task InterceptAsync(IAbpMethodInvocation invocation) + public override async Task InterceptAsync(IAbpMethodInvocation invocation) { if (_cache.ContainsKey(invocation.Method)) { diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs index f998da8528..09b1551e3d 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs @@ -51,7 +51,7 @@ namespace Volo.Abp.MongoDB.Repositories } [Fact] - public async override Task InsertAsync() + public override async Task InsertAsync() { var person = new Person(Guid.NewGuid(), "New Person", 35); person.Phones.Add(new Phone(person.Id, "1234567890")); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/DistrictAppService.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/DistrictAppService.cs index 772db07e72..f7e7fde5e2 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/DistrictAppService.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/DistrictAppService.cs @@ -15,12 +15,12 @@ namespace Volo.Abp.TestApp.Application { } - protected async override Task DeleteByIdAsync(DistrictKey id) + protected override async Task DeleteByIdAsync(DistrictKey id) { await Repository.DeleteAsync(d => d.CityId == id.CityId && d.Name == id.Name); } - protected async override Task GetEntityByIdAsync(DistrictKey id) + protected override async Task GetEntityByIdAsync(DistrictKey id) { return await AsyncExecuter.FirstOrDefaultAsync( Repository.Where(d => d.CityId == id.CityId && d.Name == id.Name) From 9410e0656e7b37a7125cb1f4f8ef9ddd1f1a602f Mon Sep 17 00:00:00 2001 From: 09azAZ <9026284+09azAZ@users.noreply.github.com> Date: Mon, 11 Jan 2021 09:55:09 +0800 Subject: [PATCH 073/119] AbpTimer -> AbpAsyncTimer --- docs/en/Background-Workers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/Background-Workers.md b/docs/en/Background-Workers.md index 2e1b9d2a90..ef800108e2 100644 --- a/docs/en/Background-Workers.md +++ b/docs/en/Background-Workers.md @@ -45,7 +45,7 @@ Assume that we want to make a user passive, if the user has not logged in to the public class PassiveUserCheckerWorker : AsyncPeriodicBackgroundWorkerBase { public PassiveUserCheckerWorker( - AbpTimer timer, + AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory ) : base( timer, @@ -137,4 +137,4 @@ ABP Framework's background worker system is good to implement periodic tasks. Ho ## See Also * [Quartz Integration for the background workers](Background-Workers-Quartz.md) -* [Background Jobs](Background-Jobs.md) \ No newline at end of file +* [Background Jobs](Background-Jobs.md) From 9019cdb99bef515b7efb0a81aad37959652bb86f Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 11 Jan 2021 10:36:07 +0800 Subject: [PATCH 074/119] Consider port in DomainTenantResolveContributor. --- .../MultiTenancy/DomainTenantResolveContributor.cs | 7 ++++++- .../AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs index 7fa2038020..255e0ac89b 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs @@ -25,7 +25,12 @@ namespace Volo.Abp.AspNetCore.MultiTenancy protected override Task GetTenantIdOrNameFromHttpContextOrNullAsync(ITenantResolveContext context, HttpContext httpContext) { - var hostName = httpContext.Request.Host.Host.RemovePreFix(ProtocolPrefixes); + if (!httpContext.Request.Host.HasValue) + { + return Task.FromResult(null); + } + + var hostName = httpContext.Request.Host.Value.RemovePreFix(ProtocolPrefixes); var extractResult = FormattedStringValueExtracter.Extract(hostName, _domainFormat, ignoreCase: true); context.Handled = true; diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs index e2ac111f5d..7a7244aa69 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs @@ -38,7 +38,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy services.Configure(options => { - options.AddDomainTenantResolver("{0}.abp.io"); + options.AddDomainTenantResolver("{0}.abp.io:8080"); }); }); } @@ -46,14 +46,14 @@ namespace Volo.Abp.AspNetCore.MultiTenancy [Fact] public async Task Should_Use_Host_If_Tenant_Is_Not_Specified() { - var result = await GetResponseAsObjectAsync>("http://abp.io"); + var result = await GetResponseAsObjectAsync>("http://abp.io:8080"); result["TenantId"].ShouldBe(""); } [Fact] public async Task Should_Use_Domain_If_Specified() { - var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io:8080"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -62,8 +62,8 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add(_options.TenantKey, Guid.NewGuid().ToString()); - var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io:8080"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } } -} \ No newline at end of file +} From 3308b3cce012aaf59a97e17d0889dec03cf3df14 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 11 Jan 2021 11:14:45 +0800 Subject: [PATCH 075/119] Use relative path --- .../AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs b/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs index 0f19345038..5b5d3a4a52 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs @@ -15,8 +15,8 @@ namespace Microsoft.AspNetCore.Builder return app.UseSwaggerUI(options => { - options.InjectJavascript("/swagger/ui/abp.js"); - options.InjectJavascript("/swagger/ui/abp.swagger.js"); + options.InjectJavascript("ui/abp.js"); + options.InjectJavascript("ui/abp.swagger.js"); options.IndexStream = () => resolver.Resolver(); setupAction?.Invoke(options); From 1fb5408368de5e4b4afdde08375223e159120534 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 11 Jan 2021 16:31:20 +0800 Subject: [PATCH 076/119] ABP.IO platform localization. --- .../Base/Localization/Resources/zh-Hans.json | 2 ++ .../Localization/Resources/zh-Hans.json | 8 +++-- .../Localization/Resources/zh-Hans.json | 31 +++++++++++++++++-- .../Www/Localization/Resources/zh-Hans.json | 1 + 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json index 79493b537e..f061408c98 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json @@ -27,6 +27,8 @@ "Blog": "博客", "Commercial": "商业版", "MyAccount": "我的账户", + "Permission:License": "许可", + "Permission:UserInfo": "用户信息", "SeeDocuments": "查看文档", "Samples": "示例" } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json index 0147e71a05..82c23450a0 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json @@ -28,8 +28,12 @@ "MyOrganizations": "我的组织", "ApiKey": "API key", "UserNameNotFound": "没有用户名为{0}的用户", - "SuccessfullyAddedToNewsletter": "感谢你订阅我们的新闻通讯!", + "SuccessfullyAddedToNewsletter": "感谢你订阅我们的新闻简讯!", "MyProfile": "我的资料", - "EmailNotValid": "请输入有效的电子邮件地址" + "EmailNotValid": "请输入有效的电子邮件地址", + "JoinOurMarketingNewsletter": "加入我们的营销简讯", + "WouldLikeToReceiveMarketingMaterials": "我想收到市场营销资料,例如产品交易和特别优惠.", + "StartUsingYourLicenseNow": "立即开始使用你的许可证", + "WelcomePage": "欢迎页面" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json index fa793c91a0..49b819227f 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json @@ -35,7 +35,6 @@ "EmailNotValid": "请输入有效的电子邮箱地址.", "FeatureRequest": "功能请求", "CreateArticleTitleInfo": "文章标题显示在文章列表中.", - "CreateArticleUrlInfo": "文章的原始GitHub/外部URL.", "CreateArticleSummaryInfo": "文章的简短摘要将显示在文章列表中.", "CreateArticleCoverInfo": "为了创建有效的文章,请添加封面图. 仅支持16:9的图片!", "ThisExtensionIsNotAllowed": "不允许此扩展名.", @@ -84,6 +83,34 @@ "Edit": "修改", "ProfileImageChange": "更改资料图片", "BlogItemErrorMessage": "无法从ABP获取最新的博客文章详细信息.", - "PlannedReleaseDate": "计划发布日期" + "PlannedReleaseDate": "计划发布日期", + "CommunityArticleRequestErrorMessage": "无法从Github获取最新的文章请求.", + "ArticleRequestFromGithubIssue": "现在没有任何文章请求.", + "LatestArticles": "最新的帖子", + "ArticleRequests": "文章请求", + "AllArticleRequests": "查看所有文章请求", + "SubscribeToTheNewsletter": "订阅简讯", + "NewsletterEmailDefinition": "获取有关ABP发生的信息,例如新版本,免费资源,文章等.", + "NoThanks": "不用了,谢谢", + "MaybeLater": "以后再说", + "JoinOurArticleNewsletter": "加入我们的文章简讯", + "Community": "社区", + "Marketing": "营销", + "CommunityPrivacyPolicyConfirmation": "我同意条款和条件以及隐私政策.", + "ArticleRequestMessageTitle": "在GitHub上创建一个Issue,以请求你要在此网站上查看的文章/教程.", + "ArticleRequestMessageBody": "在这里,是社区请求的文章列表. 您要写一篇要求的文章吗? 请单击该请求并加入讨论.", + "Language": "语言", + "CreateArticleLanguageInfo": "本文所用的语言", + "VideoPost": "视频", + "Article": "文章", + "Read": "阅读", + "CreateGithubArticleUrlInfo": "文章的原始GitHub链接.", + "CreateVideoContentUrlInfo": "文章的原始Youtube链接.", + "CreateExternalArticleUrlInfo": "本文的原始外部网址", + "VideoContentForm": "视频内容来源", + "GithubPostForm": "Github文章来源", + "ExternalPostForm": "外部文章来源", + "PostSourceTypeChooses": "我们接受文章的三种来源类型;", + "Posts": "文章" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json index caf52554d1..7101efcbd2 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json @@ -192,6 +192,7 @@ "MultipleUIOptions": "多个UI选项", "MultipleDBOptions": "多个数据库提供程序", "MultipleUIOptionsExplanation": "核心框架设计为独立与UI,可以和任何类型的UI系统一起使用. 同时提供了多个开箱即用的预构建集成选项.", + "MultipleDBOptionsExplanation": "该框架可以使用任何数据源,而以下提供程序已得到正式开发和支持;", "SelectLanguage": "選擇語言" } } \ No newline at end of file From 51b1dfeac81520527f7031ad35a6b6071d7fd8df Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 11 Jan 2021 16:35:58 +0800 Subject: [PATCH 077/119] Update zh-Hans.json --- .../Www/Localization/Resources/zh-Hans.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json index 7101efcbd2..d01d847716 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json @@ -192,7 +192,7 @@ "MultipleUIOptions": "多个UI选项", "MultipleDBOptions": "多个数据库提供程序", "MultipleUIOptionsExplanation": "核心框架设计为独立与UI,可以和任何类型的UI系统一起使用. 同时提供了多个开箱即用的预构建集成选项.", - "MultipleDBOptionsExplanation": "该框架可以使用任何数据源,而以下提供程序已得到正式开发和支持;", - "SelectLanguage": "選擇語言" + "MultipleDBOptionsExplanation": "该框架可以使用任何数据源,并且以下提供程序已得到正式开发和支持;", + "SelectLanguage": "选择语言" } -} \ No newline at end of file +} From 02e993a82d3e2d44357f23c02696a019f6702162 Mon Sep 17 00:00:00 2001 From: zfmy Date: Mon, 11 Jan 2021 17:30:08 +0800 Subject: [PATCH 078/119] a typo fixed in Abp.MongoDB --- .../Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs index ff367dc554..90605f416e 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Domain.Repositories return repository.ToMongoDbRepository().GetDatabaseAsync(); } - [Obsolete("Use GetCollection method.")] + [Obsolete("Use GetCollectionAsync method.")] public static IMongoCollection GetCollection(this IBasicRepository repository) where TEntity : class, IEntity { From 4aec6a9245fe005d19993365fa88c14cbea6e655 Mon Sep 17 00:00:00 2001 From: zfmy Date: Mon, 11 Jan 2021 17:36:30 +0800 Subject: [PATCH 079/119] fix namespace for IMongoDbBulkOperationProvider --- .../Repositories/MongoDB/IMongoDbBulkOperationProvider.cs | 3 +-- .../Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs index fda7f291c7..cdb91aa4a7 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs @@ -3,9 +3,8 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Entities; -using Volo.Abp.Domain.Repositories.MongoDB; -namespace Volo.Abp.MongoDB.Volo.Abp.Domain.Repositories.MongoDB +namespace Volo.Abp.Domain.Repositories.MongoDB { public interface IMongoDbBulkOperationProvider { diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index 537f6cdad3..b252c48999 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -16,7 +16,6 @@ using Volo.Abp.EventBus.Distributed; using Volo.Abp.EventBus.Local; using Volo.Abp.Guids; using Volo.Abp.MongoDB; -using Volo.Abp.MongoDB.Volo.Abp.Domain.Repositories.MongoDB; namespace Volo.Abp.Domain.Repositories.MongoDB { From d514194bea772524f5552df4e6826608d09a7c0c Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 11 Jan 2021 13:45:51 +0300 Subject: [PATCH 080/119] chore: upgrade ng-zorro-and version to the latest --- npm/ng-packs/packages/components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/components/package.json b/npm/ng-packs/packages/components/package.json index 68b26abf8c..243deddcd0 100644 --- a/npm/ng-packs/packages/components/package.json +++ b/npm/ng-packs/packages/components/package.json @@ -11,7 +11,7 @@ "@ng-bootstrap/ng-bootstrap": ">=6.0.0" }, "dependencies": { - "ng-zorro-antd": "^9.3.0", + "ng-zorro-antd": "^11.0.0", "tslib": "^2.0.0" }, "publishConfig": { From 93188c06732cf5511a79865c451f0e5b6d18bfd1 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 11 Jan 2021 13:46:06 +0300 Subject: [PATCH 081/119] chore: add start script to package.json of the verdaccio-containers --- npm/verdaccio-containers/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/npm/verdaccio-containers/package.json b/npm/verdaccio-containers/package.json index 310b896fb9..06866c853a 100644 --- a/npm/verdaccio-containers/package.json +++ b/npm/verdaccio-containers/package.json @@ -4,7 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "prepare": "node prepare" + "prepare": "node prepare", + "start": "docker-compose rm -f && docker-compose build --build-arg next_version=\"4.1.0\" && docker-compose up" }, "keywords": [], "author": "", From 0543e19ed5937cc0227ebc37899b521fdd3f4d99 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 11 Jan 2021 18:49:59 +0800 Subject: [PATCH 082/119] Add GetCountAsync method --- .../Volo/Abp/Identity/IdentityRoleAppService.cs | 2 +- .../ApiResources/IApiResourceRepository.cs | 5 +++++ .../IdentityServer/ApiScopes/IApiScopeRepository.cs | 5 +++++ .../Abp/IdentityServer/Clients/IClientRepository.cs | 5 +++++ .../IdentityResources/IIdentityResourceRepository.cs | 5 +++++ .../ApiResources/ApiResourceRepository.cs | 10 ++++++++++ .../Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs | 10 ++++++++++ .../Abp/IdentityServer/Clients/ClientRepository.cs | 7 +++++++ .../IdentityResources/IdentityResourceRepository.cs | 10 ++++++++++ .../MongoDB/MongoApiResourceRepository.cs | 9 +++++++-- .../IdentityServer/MongoDB/MongoApiScopeRepository.cs | 10 ++++++++++ .../IdentityServer/MongoDB/MongoClientRepository.cs | 8 ++++++++ .../MongoDB/MongoIdentityResourceRepository.cs | 10 ++++++++++ 13 files changed, 93 insertions(+), 3 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index 9eecb1058e..070f55901e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.Identity public virtual async Task> GetListAsync(GetIdentityRolesInput input) { var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); - var totalCount = await RoleRepository.GetCountAsync(); + var totalCount = await RoleRepository.GetCountAsync(input.Filter); return new PagedResultDto( totalCount, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs index 5d99666183..d1f60bcb7b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs @@ -35,6 +35,11 @@ namespace Volo.Abp.IdentityServer.ApiResources CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task CheckNameExistAsync( string name, Guid? expectedId = null, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs index a0aba8fe2a..a6736bdda6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs @@ -29,6 +29,11 @@ namespace Volo.Abp.IdentityServer.ApiScopes CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task CheckNameExistAsync( string name, Guid? expectedId = null, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs index 059882eb47..55d15a8c83 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs @@ -24,6 +24,11 @@ namespace Volo.Abp.IdentityServer.Clients CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task> GetAllDistinctAllowedCorsOriginsAsync(CancellationToken cancellationToken = default); Task CheckClientIdExistAsync( diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs index 4dd5472ea9..0ddf31e58e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs @@ -23,6 +23,11 @@ namespace Volo.Abp.IdentityServer.IdentityResources CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task FindByNameAsync( string name, bool includeDetails = true, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 3cdcb7e49d..064d7b67fe 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -68,6 +68,16 @@ namespace Volo.Abp.IdentityServer.ApiResources .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, GetCancellationToken(cancellationToken)); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs index c2a962ead6..00395a13a0 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs @@ -48,6 +48,16 @@ namespace Volo.Abp.IdentityServer.ApiScopes .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await DbSet.AnyAsync(x => x.Id != expectedId && x.Name == name, GetCancellationToken(cancellationToken)); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 671d98d822..90a1d48069 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -41,6 +41,13 @@ namespace Volo.Abp.IdentityServer.Clients .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetAllDistinctAllowedCorsOriginsAsync(CancellationToken cancellationToken = default) { return await DbContext.ClientCorsOrigins diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs index 6ddf38e2db..da47f22ed3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs @@ -49,6 +49,16 @@ namespace Volo.Abp.IdentityServer.IdentityResources .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task FindByNameAsync( string name, bool includeDetails = true, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index 599fa913b5..ec072ce5e7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -57,9 +57,14 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task GetTotalCount() + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { - return await GetCountAsync(); + return await GetMongoQueryable() + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); } public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs index 91a408392f..bb6bc33064 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs @@ -53,6 +53,16 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await GetMongoQueryable().AnyAsync(x => x.Id != expectedId && x.Name == name, GetCancellationToken(cancellationToken)); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs index a68f5738d0..2ccfa3eb5f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs @@ -48,6 +48,14 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.ClientId.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetAllDistinctAllowedCorsOriginsAsync( CancellationToken cancellationToken = default) { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs index 15fdf5b00c..104612e91e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs @@ -30,6 +30,16 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task FindByNameAsync( string name, bool includeDetails = true, From e1f176639176e74dd54b73d29177b69f71617325 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 11 Jan 2021 13:52:16 +0300 Subject: [PATCH 083/119] chore: reinstall the ng-packs packages --- npm/ng-packs/package.json | 2 +- npm/ng-packs/yarn.lock | 479 ++++++++++++++++++++------------------ 2 files changed, 256 insertions(+), 225 deletions(-) diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index d604dd533b..8fb4c748b4 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -80,7 +80,7 @@ "just-compare": "^1.3.0", "lerna": "^3.19.0", "ng-packagr": "^11.0.1", - "ng-zorro-antd": "^10.1.1", + "ng-zorro-antd": "^11.0.1", "ngxs-schematic": "^1.1.9", "prettier": "^2.2.0", "protractor": "~7.0.0", diff --git a/npm/ng-packs/yarn.lock b/npm/ng-packs/yarn.lock index bc2c1e46f5..69e3985105 100644 --- a/npm/ng-packs/yarn.lock +++ b/npm/ng-packs/yarn.lock @@ -2,12 +2,12 @@ # yarn lockfile v1 -"@abp/ng.core@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-4.1.0-rc.2.tgz#5fe53658965af66fae655dfce4bf6a7ad7105032" - integrity sha512-NcjOn1HYIdLTdHPbWTiLywPp1jQ+zmoeknnb0q/JfUUDn5r5kPrCf85xiZBUo8e+2ViB5vXvkM5lOOD5RfES6A== +"@abp/ng.core@~4.1.0", "@abp/ng.core@~4.1.0-rc.2": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-4.1.0.tgz#be90be576300e9f379775484bc22643013e79b74" + integrity sha512-Jd9d4qIAzrhmU4cyZXCS4qOHIDQRJpirwxKwaPooKeeNrNs1HqVVLTNAlhGC/ofmukYsiJC99wpmd7pvUN2tBA== dependencies: - "@abp/utils" "^4.1.0-rc.1" + "@abp/utils" "^4.1.0-rc.2" "@angular/localize" "~10.0.10" "@ngxs/store" "^3.7.0" angular-oauth2-oidc "^10.0.0" @@ -17,35 +17,35 @@ ts-toolbelt "6.15.4" tslib "^2.0.0" -"@abp/ng.feature-management@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-4.1.0-rc.2.tgz#02e760bfa913276e694dbff545e39210a69b21bd" - integrity sha512-vf//thBD3ve8tkmAIan2FqQeHrO/sP8NVV83noGVMTpqKIAWIu7PBuSL3YqcNVOVxHLsO6EIwr63OAJytlvH6A== +"@abp/ng.feature-management@~4.1.0", "@abp/ng.feature-management@~4.1.0-rc.2": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-4.1.0.tgz#5e87592d276315994fa1b5f35f2a568476d9cf3d" + integrity sha512-PJM/rj5mjzGHXUEKa6UWbhhgjJafoKkHTYW/4+4KNM8tmwggNS+YmwOj0xdqfQlF1aYtUsMWpI0koMbtqgBH/A== dependencies: - "@abp/ng.theme.shared" "~4.1.0-rc.2" + "@abp/ng.theme.shared" "~4.1.0" tslib "^2.0.0" "@abp/ng.identity@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-4.1.0-rc.2.tgz#381d956cebe2f3c272c59567ff424d3729adb6aa" - integrity sha512-4Wnx/iXAOgdexDYuNTV+DBdnjyfhcgca1ZiUSuEnSVDKePq0xvpGeKvpXzhhm9T3uXNsqYwqNq/X5jK3jd6mZg== + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-4.1.0.tgz#bebf0e4b85f0332313a827cc344c3d9e6af59d33" + integrity sha512-doBqoPtxPdT8e27s4h97ldV6tsMHeKCXpyNiMAlweTFcsXjZjXnVJbuXYvqdoyRItqTbSxSlBKxk+6KRb9lPQQ== dependencies: - "@abp/ng.permission-management" "~4.1.0-rc.2" - "@abp/ng.theme.shared" "~4.1.0-rc.2" + "@abp/ng.permission-management" "~4.1.0" + "@abp/ng.theme.shared" "~4.1.0" tslib "^2.0.0" -"@abp/ng.permission-management@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-4.1.0-rc.2.tgz#b74402241886e156a0e72baddfbc0ebebb7576aa" - integrity sha512-6/Z/8KGKkAflfk6CoXk92StEELuP0xkwj2dvvFvnGpr2od9ELGWWqtiJ5Pjz6i5FQvrLdqcHqPh8x/vgr7QV9w== +"@abp/ng.permission-management@~4.1.0", "@abp/ng.permission-management@~4.1.0-rc.2": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-4.1.0.tgz#1bf09f21a254c265d75db83e96f48a5706214a08" + integrity sha512-/kc9wFtGmwHW28a2GfroJqUOk6PPlGQ8YNzU37cuN5BBK7909Eu1Q+4a9JigQqCsBGTxVgIpP4WQ2p7CcfIymg== dependencies: - "@abp/ng.theme.shared" "~4.1.0-rc.2" + "@abp/ng.theme.shared" "~4.1.0" tslib "^2.0.0" "@abp/ng.schematics@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.schematics/-/ng.schematics-4.1.0-rc.2.tgz#31dada6fc1f69d0198f4fb3801b6009d6a0a0c09" - integrity sha512-yVi/C1IbwcOQfXUAe8FSlekdNfoqi/UQvTBQ19h/HGBBDxhqbv6QKjhkaVs/+EOAW8WHWCufyVtQ2/y/jrCeog== + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.schematics/-/ng.schematics-4.1.0.tgz#f2b2361ccbe49c7981d3c2fe6b43c745eedc46c1" + integrity sha512-BNpyqkkWBEF8nYZwK+krHjqbbQHHiqUoXe/FspNDkSuVTvC6wGmNe/8BalJLZzPF3lNI8ByNC2/MwrGh/Tzlpg== dependencies: "@angular-devkit/core" "~11.0.2" "@angular-devkit/schematics" "~11.0.2" @@ -54,36 +54,36 @@ typescript "~3.9.2" "@abp/ng.setting-management@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-4.1.0-rc.2.tgz#4b61bff63fa9d68be5f1c7b8c47049cc1bd8b5a8" - integrity sha512-Df2QS0bsytytUSkQ0KrI/m4pVTpQS708fwl8t3KcpeQ4hlgdg6LtTmhUaY/j6k8M1RJHaKvjPE9Jg6R2daLNGg== + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-4.1.0.tgz#8ef31a7f4c75be34f5be78427165f2d2b85ae16e" + integrity sha512-8zH4jCNVwPIGgYlrHSm/0BKje1bFCQBOwAsdlVP6A6GRyOVY/6G5166ZAnEqbim8K6ln5WXPHTHtYnxB7Qur8Q== dependencies: - "@abp/ng.theme.shared" "~4.1.0-rc.2" + "@abp/ng.theme.shared" "~4.1.0" tslib "^2.0.0" "@abp/ng.tenant-management@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-4.1.0-rc.2.tgz#b75b60db124e5246476821da2bfeebd5e5da09b6" - integrity sha512-AnDiMa/M4xSwiSXjyIsBY13BNxm+JMhWiIEb9WAPlk8IUaNDJZH9zHJH/HQSUHdy6dFCmutl5Ezi6U1J9ZHpPQ== + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-4.1.0.tgz#ec59e469e806a5081b52b1c597c333b49381afe7" + integrity sha512-VZ/qiOz/XbUJT6rb+X9GUhwnBTqTt9UIAlAGiT7qONH/39pqUpe6n5d3lbL5oGGZ+ZxJ6S2/+dSKLC1cFt+Bgg== dependencies: - "@abp/ng.feature-management" "~4.1.0-rc.2" - "@abp/ng.theme.shared" "~4.1.0-rc.2" + "@abp/ng.feature-management" "~4.1.0" + "@abp/ng.theme.shared" "~4.1.0" tslib "^2.0.0" "@abp/ng.theme.basic@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-4.1.0-rc.2.tgz#4c0ccb5386a09cf7d89efaee59c8920265032361" - integrity sha512-2NjHymzE/sgbZ8e+CJ4iMemB+mD6e/VSKA2EkCaekPpXDlp0Z3f2yyhm0jwYqCQPsmCjykdtTpR266yLQOs7ug== + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-4.1.0.tgz#0931a33ca6cdb7375d77e75611cd7d3542b16c43" + integrity sha512-rI80s3meGZzgHa4Ke5fAhwP79D/MRiThI47ixFhxUyPSP3+ogjziAn98SIsadkcjhH86lsSV9s2uCnzeqReBMg== dependencies: - "@abp/ng.theme.shared" "~4.1.0-rc.2" + "@abp/ng.theme.shared" "~4.1.0" tslib "^2.0.0" -"@abp/ng.theme.shared@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-4.1.0-rc.2.tgz#eaf524ef26f5433ec7ea01d402ba071c42ce1aa6" - integrity sha512-d6dVhV2wer7eeHoT8Y91Bqf7m2r3FVexUp7R+/f93564swuceZGZWSsgntwpHkNdDJaxhLUJ8tG5XMe2deEGTQ== +"@abp/ng.theme.shared@~4.1.0", "@abp/ng.theme.shared@~4.1.0-rc.2": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-4.1.0.tgz#e0140bdc9f44609e77097dd046ce3067546fc6ca" + integrity sha512-0YtyVBp/1Tciu+8ORkRVTHSFT7kJGTqH+cdq+FnbqD90JQ5XZjlHcz+h/VhARoB00xbXsG8ZbwCOi/8ZFDg5wQ== dependencies: - "@abp/ng.core" "~4.1.0-rc.2" + "@abp/ng.core" "~4.1.0" "@fortawesome/fontawesome-free" "^5.14.0" "@ng-bootstrap/ng-bootstrap" "^7.0.0" "@ngx-validate/core" "^0.0.13" @@ -92,10 +92,10 @@ chart.js "^2.9.3" tslib "^2.0.0" -"@abp/utils@^4.1.0-rc.1", "@abp/utils@^4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0-rc.2.tgz#eb6dbf0ee493d0f050b37347d2d6d283098aedae" - integrity sha512-V2k5I89lVBoeGIKgg4p2H9GlMAcDWbctwKZPVwBEMVEVm1uTR2xQAWdTdSFd5Q8I8Xsf/aIG8ELM7l5j2h7/zQ== +"@abp/utils@^4.1.0-rc.2": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" + integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== dependencies: just-compare "^1.3.0" @@ -117,12 +117,12 @@ "@angular-devkit/core" "10.1.7" rxjs "6.6.2" -"@angular-devkit/architect@0.1100.5": - version "0.1100.5" - resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1100.5.tgz#3cf9b25464d484160b10417668efbdbd15c9e492" - integrity sha512-yOYfucNouc1doTbcGbCNMXGMSc36+j97XpdNoeGyzFQ7GwezLAro0a9gxc5PdOxndfelkND7J1JuOjxdW5O17A== +"@angular-devkit/architect@0.1100.6": + version "0.1100.6" + resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1100.6.tgz#ce90ffb78d1d945cafc339d4cfc63b3582cb8e6a" + integrity sha512-4O+cg3AimI2bNAxxdu5NrqSf4Oa8r8xL0+G2Ycd3jLoFv0h0ecJiNKEG5F6IpTprb4aexZD6pcxBJCqQ8MmzWQ== dependencies: - "@angular-devkit/core" "11.0.5" + "@angular-devkit/core" "11.0.6" rxjs "6.6.3" "@angular-devkit/architect@>=0.1000.0 < 0.1100.0": @@ -134,14 +134,14 @@ rxjs "6.6.2" "@angular-devkit/build-angular@~0.1100.0": - version "0.1100.5" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.1100.5.tgz#36a609a334369d9597ac50731f458440ffdbb2d1" - integrity sha512-lJYsnBImBAqUAIVC2qGY64UaC2uWOPZEpSWjYUxkRZA/c4IVCJj3M12CgONBjtcKYzFVXc1eojhrScukGIJJcg== - dependencies: - "@angular-devkit/architect" "0.1100.5" - "@angular-devkit/build-optimizer" "0.1100.5" - "@angular-devkit/build-webpack" "0.1100.5" - "@angular-devkit/core" "11.0.5" + version "0.1100.6" + resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.1100.6.tgz#4aa7635ab8fc1c6435b2b93954c08f2a7d7a8dd9" + integrity sha512-HcqsWiSIUxExGg3HRQScLOmF+ckVkCKolfpPcNOCCpBYxH/i8n4wDGLBP5Rtxky+0Qz+3nnAaFIpNb9p9aUmbg== + dependencies: + "@angular-devkit/architect" "0.1100.6" + "@angular-devkit/build-optimizer" "0.1100.6" + "@angular-devkit/build-webpack" "0.1100.6" + "@angular-devkit/core" "11.0.6" "@babel/core" "7.12.3" "@babel/generator" "7.12.1" "@babel/plugin-transform-runtime" "7.12.1" @@ -149,7 +149,7 @@ "@babel/runtime" "7.12.1" "@babel/template" "7.10.4" "@jsdevtools/coverage-istanbul-loader" "3.0.5" - "@ngtools/webpack" "11.0.5" + "@ngtools/webpack" "11.0.6" ansi-colors "4.1.1" autoprefixer "9.8.6" babel-loader "8.1.0" @@ -216,10 +216,10 @@ "@angular-devkit/architect" "0.1001.7" rxjs "6.6.2" -"@angular-devkit/build-optimizer@0.1100.5": - version "0.1100.5" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.1100.5.tgz#25de00e9cbea1444f911aa0a7a53a05800c90d62" - integrity sha512-aKITFuiydR681eS1z84EIdOtqdxP/V5xGZuF3xjGmg5Ddwv36PweAHaCVJEB4btHSWH6uxMvW2hLXg2RTWbRNg== +"@angular-devkit/build-optimizer@0.1100.6": + version "0.1100.6" + resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.1100.6.tgz#4d6712ae75eeae71d74fd161a0a18c08402dc527" + integrity sha512-Qkq7n6510N+nXmfZqpqpI0I6Td+b+06RRNmS7KftSNJntU1z5QYh4FggwlthZ5P0QUT92cnBQsnT8OgYqGnwbg== dependencies: loader-utils "2.0.0" source-map "0.7.3" @@ -227,13 +227,13 @@ typescript "4.0.5" webpack-sources "2.0.1" -"@angular-devkit/build-webpack@0.1100.5": - version "0.1100.5" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1100.5.tgz#81be4b35dc90ea66be205ad1cb9dc44dc31bf9e0" - integrity sha512-oD5t2oCfyiCyyeZckrqBnQco94zIMkRnRGzy3lFDH7KMiL0DG9l7x3nxn9H0YunYWr55LsGWwXGoR7l03Kl+jw== +"@angular-devkit/build-webpack@0.1100.6": + version "0.1100.6" + resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1100.6.tgz#301caf71bebed6e841cb15fb3af5147c3b2d9c97" + integrity sha512-kK0FlpYJHP25o1yzIGHQqIvO5kp+p6V5OwGpD2GGRZLlJqd3WdjY5DxnyZoX3/IofO6KsTnmm76fzTRqc62z/Q== dependencies: - "@angular-devkit/architect" "0.1100.5" - "@angular-devkit/core" "11.0.5" + "@angular-devkit/architect" "0.1100.6" + "@angular-devkit/core" "11.0.6" rxjs "6.6.3" "@angular-devkit/core@10.0.8": @@ -269,10 +269,10 @@ rxjs "6.6.2" source-map "0.7.3" -"@angular-devkit/core@11.0.5", "@angular-devkit/core@~11.0.2": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-11.0.5.tgz#8239486d2de6c08fc55d2a64f12a7f5d518c8beb" - integrity sha512-hwV8fjF8JNPJkiVWw8MNzeIfDo01aD/OAOlC4L5rQnVHn+i2EiU3brSDmFqyeHPPV3h/QjuBkS3tkN7gSnVWaQ== +"@angular-devkit/core@11.0.6", "@angular-devkit/core@~11.0.2": + version "11.0.6" + resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-11.0.6.tgz#b3ea815ecdea5f77dae58f3f410b268453d7eb8b" + integrity sha512-nhvU5hH01r9qcexAqvIFU233treWWeW3ncs9UFYjD9Hys9sDSvqC3+bvGvl9vCG5FsyY7oDsjaVAipyUc+SFAg== dependencies: ajv "6.12.6" fast-json-stable-stringify "2.1.0" @@ -322,12 +322,12 @@ ora "5.0.0" rxjs "6.6.2" -"@angular-devkit/schematics@11.0.5", "@angular-devkit/schematics@~11.0.2": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-11.0.5.tgz#e5d89451daa644eccce93970709f7cdf44c11982" - integrity sha512-0NKGC8Nf/4vvDpWKB7bwxIazvNnNHnZBX6XlyBXNl+fW8tpTef3PNMJMSErTz9LFnuv61vsKbc36u/Ek2YChWg== +"@angular-devkit/schematics@11.0.6", "@angular-devkit/schematics@~11.0.2": + version "11.0.6" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-11.0.6.tgz#06631190cb22609462597cd6659080fc3313582a" + integrity sha512-hCyu/SSSiC6dKl/NxdWctknIrBqKR6pRe7DMArWowrZX6P9oi36LpKEFnKutE8+tXjsOqQj8XMBq9L64sXZWqg== dependencies: - "@angular-devkit/core" "11.0.5" + "@angular-devkit/core" "11.0.6" ora "5.1.0" rxjs "6.6.3" @@ -340,31 +340,31 @@ rxjs "6.4.0" "@angular/animations@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-11.0.5.tgz#44157c8bbb3f20ce1d3d6386eae956659cefd9d7" - integrity sha512-ghE/xDTYuEWkKNZtioH9JBrSlux0MLHzWoE7tNP+XMaplt80lCm979vWsEBO3/xpQLRmRlGPul6RacCAoeqogg== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-11.0.7.tgz#d71ebb581da4e2805df1b35c75a331192063846a" + integrity sha512-P3cluDGIsaj7vqvqIGW7xFCIXWa1lJDsHsmY3Fexk+ZVCncokftp5ZUANb2+DwOD3BPgd/WjBdXVjwzFQFsoVA== dependencies: tslib "^2.0.0" -"@angular/cdk@^10.2.4": - version "10.2.7" - resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-10.2.7.tgz#0ff82eb91b2653ea26909c57a460d4593b44f186" - integrity sha512-ZQjDfTRTn7JuAKsf3jiIdU2XBaxxGBi/ZWYv5Pb3HCl6B4PISsIE5VWRhkoUogoAB0MiFHpjnWeIqknJEm11YQ== +"@angular/cdk@^11.0.2": + version "11.0.3" + resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-11.0.3.tgz#f5a119e28b4ba21a6f013dfd4de41b16083bd25a" + integrity sha512-hgbJXvZURKBnZawwxUrsZE/3a+HCJh2UhoLIng3cn5Q+WIW/4a37knDl8B9DYKBWrCqeINXNcUHVSKkWc/gjCA== dependencies: tslib "^2.0.0" optionalDependencies: parse5 "^5.0.0" "@angular/cli@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-11.0.5.tgz#1066d290fc91460f98cedcfbc9a5736340661467" - integrity sha512-k4j/2z7qkuigJ1shH0McW1wW63clhrbrg98FK4/KWhU/sce5AgVjuHDQFycAclTwHesf7Vs6Gzt7zGlqUmeKIg== - dependencies: - "@angular-devkit/architect" "0.1100.5" - "@angular-devkit/core" "11.0.5" - "@angular-devkit/schematics" "11.0.5" - "@schematics/angular" "11.0.5" - "@schematics/update" "0.1100.5" + version "11.0.6" + resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-11.0.6.tgz#8d65d3ad3841aabe23ff38a41fa6c4f38dd12f66" + integrity sha512-bwrXXyU23HjUlFl0CNCU+XMGa/enooqpMLcTAA15StVpKFHyaA4c57il/aqu+1IuB+zR6rGDzhAABuvRcHd+mQ== + dependencies: + "@angular-devkit/architect" "0.1100.6" + "@angular-devkit/core" "11.0.6" + "@angular-devkit/schematics" "11.0.6" + "@schematics/angular" "11.0.6" + "@schematics/update" "0.1100.6" "@yarnpkg/lockfile" "1.1.0" ansi-colors "4.1.1" debug "4.2.0" @@ -382,9 +382,9 @@ uuid "8.3.1" "@angular/common@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/common/-/common-11.0.5.tgz#7ec508cb7e14cf38640fe4e1c0fa3dd322a52505" - integrity sha512-aoXdTkoni65LWhrPKNsAiOnO70XFaTaisO+K8ZYMpciMTTAxHx3hFCF9sj4a+Bo3M1a5UDjpsFDYMeGgJOkmFA== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/common/-/common-11.0.7.tgz#bc76452161bc0728563bbf05fe10cac492dcfdad" + integrity sha512-9VuT9qrSP7Q91Wp276DDieCIZiTBrpLNoJzK/RygQShTymCVPg4Dsl3tQUKaHBPx9MexeqRG/HjN02DVpeqtsA== dependencies: tslib "^2.0.0" @@ -427,23 +427,23 @@ integrity sha512-6Pxgsrf0qF9iFFqmIcWmjJGkkCaCm6V5QNnxMy2KloO3SDq6QuMVRbN9RtC8Urmo25LP+eZ6ZgYqFYpdD8Hd9w== "@angular/core@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/core/-/core-11.0.5.tgz#b8c448c3cd4f6dae7327cc1ba4ee2aa29c8dbc26" - integrity sha512-XAXWQi7R3ucZXQwx9QK5jSKJeQyRJ53u2dQDpr7R5stzeCy1a5hrNOkZLg9zOTTPcth/6+FrOrRZP9SMdxtw3w== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/core/-/core-11.0.7.tgz#4d81b1a49d3d4aaeb0ef9908695a3cc06707cfd9" + integrity sha512-Kj5uRZoK5+xfMTjkP3tw8oIF5hKTnoF9Bwh5m9GUKqg1wHVKOJcT5JBIEMc8qPyiFgALREA01reIzQdGMjX36A== dependencies: tslib "^2.0.0" "@angular/forms@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-11.0.5.tgz#1be90f86b45a3d672eecea249b1d8e5e9f8f0bc3" - integrity sha512-2zB1IuqYNJrjh7Og9J8f/AtjX3NHc3VVbt0rPw35ghqIU3aQLpOichdQ1y5QvMWic1UzZ7SjWXDU7RpKbm4iUA== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-11.0.7.tgz#958558b92d2e524e08b447c16b17b2ae42717657" + integrity sha512-+3A+SciMyHTdUwkKUz4XzC1DSYexQEbFLe0PKQIFSFOROmbssjnWJv7yO2HbzCpGa7oGKPYNlE5twYWyLxpvFg== dependencies: tslib "^2.0.0" "@angular/language-service@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-11.0.5.tgz#92499b5f29509142f29ae7af64b049765a7f7050" - integrity sha512-EzGycD9ztTKAZB+kR+masNqCfGmU0vnKd/z33VLmeo9fo41t/YNCEQEEFz/pEl2dEwX/Wjou+3oyTYZIZz2uSA== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-11.0.7.tgz#78a912eaf025c2d01181dc72ff4fb99ca598ae49" + integrity sha512-1IiJNwy/phjpYfqLVlhOp4Gr/A89joydwqPB7Nf7hbhl3xFnT98GOp/nsoZCwMBKotXYNk93m025LbJ++augfQ== "@angular/localize@~10.0.10": version "10.0.14" @@ -455,32 +455,32 @@ yargs "15.3.0" "@angular/localize@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-11.0.5.tgz#e770d4ec1b2094822fdb0524516dca6bf39dfd05" - integrity sha512-tvzgRa/t0xCouCPFMurqZImLeWIISUjVEzkcny9P7xaaz0Cw7kSyulc0e8HXf+8oijSJ624YOYUzr7mkPoIfew== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-11.0.7.tgz#0335f1fc4852d6d36d99d239ef946645b34c78fb" + integrity sha512-NDs08oAELLn7tA/hHLuW8APULg25C7iINYTA168QzOdFTEsJ2MoLf3SiVQExUV65h3MnB24xNbhaNodmBKUNPg== dependencies: "@babel/core" "7.8.3" glob "7.1.2" yargs "^16.1.1" "@angular/platform-browser-dynamic@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-11.0.5.tgz#1e1de1ca429d85eb43b14cd5da90eba4ac95bd76" - integrity sha512-MFjpQcqkHOu8iTUMKVG6vfuOHwrRlgPBvkNucEbtXhTTYNlsw2mprxfUODYEu26EBUAh+FGttu8ZjclUGw4bVg== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-11.0.7.tgz#8ee8c72799a96eee3967596ae52b69ee90ac3df0" + integrity sha512-pUXCum1Z2DZV/34WR4Vfmkc5nWxbmVdwAA9pXbAarwAYqHIqOzX8rpRaHsuHBAR+SK+VH+xjproeLgsVfV8FSA== dependencies: tslib "^2.0.0" "@angular/platform-browser@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-11.0.5.tgz#b695d2533491f85721612a41d6d3708791bca96c" - integrity sha512-173JZHF3QS78hEscBxFZ/kX8KLjdaDhfAYi4Sh8daIKNUcDcyhqEy7wpAjWmCwdspL1QUtWKCrhZqrEVNGTpvA== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-11.0.7.tgz#1475540b38d1e2d19dbd9242e0a9ddf6d9bf7873" + integrity sha512-W8Wt8jMUjcbpqGtqrNWAj0p7CLdjOxgVlbrgBXTbaoqdchvXH85YzGr7ohA3MuE61H90OcVK9OhfYQk5o6joSg== dependencies: tslib "^2.0.0" "@angular/router@~11.0.0": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@angular/router/-/router-11.0.5.tgz#95d47b3b510f6a49597db64cfd7ef936bb24c402" - integrity sha512-mSD4tbzuFH4uBb9vxPQHBUbkIMoWAfVUb7r9gtn3/deOxQbVh08f2gk2iWDN3OQLAa5mNHswuLByAYSw2rPbMA== + version "11.0.7" + resolved "https://registry.yarnpkg.com/@angular/router/-/router-11.0.7.tgz#c5d0cacb927018eb495a4538ab1f81c088f5b7f1" + integrity sha512-oh/MOPRSOCLRPsM/3CVUNYZ3pz3g+CzLOk5Vad/zFJmnGwjA/lQGJo2pl7VXVq3RF7MieaHlDWG5TexGlXAP5w== dependencies: tslib "^2.0.0" @@ -491,10 +491,10 @@ dependencies: "@ctrl/tinycolor" "^3.3.1" -"@ant-design/icons-angular@^10.0.0": - version "10.2.0" - resolved "https://registry.yarnpkg.com/@ant-design/icons-angular/-/icons-angular-10.2.0.tgz#cf13a6a33b1415934b7331b58cc38fa0653fa374" - integrity sha512-c5g31hD9otf0DAmHMlvijyOcq1sXpdqKbMFZHxXAUG2sTi+cgixqI8LNePCc9MxBy0N48gAmp0CfhGiByxZJnQ== +"@ant-design/icons-angular@^11.0.1": + version "11.0.1" + resolved "https://registry.yarnpkg.com/@ant-design/icons-angular/-/icons-angular-11.0.1.tgz#8ff3131f3d9b4b25fd28c64c4a9bdfe36da54942" + integrity sha512-WwxVx/aToxTjWmB5+O+3rOjSYdF8FC/Yd/8jF1ZGQMtLWAzP8/foQmKvPAktTUsh0/Ijhtur7LrHN2VuUedMcA== dependencies: "@ant-design/colors" "^5.0.0" tslib "^2.0.0" @@ -2466,12 +2466,12 @@ jquery "3.5.0" replace-in-file "^4.1.3" -"@ngtools/webpack@11.0.5": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-11.0.5.tgz#9d1abb9f9a5e72c014b5ed3e0c2cefe2a4175b30" - integrity sha512-hM0LdOSlC6c7ij+BvIpAFbe7dpJhL+A51L5v6YbMA6aM0Sb/y+HpE2u34AHEQvute7cLe4EyOyvJ9jSinVAJhQ== +"@ngtools/webpack@11.0.6": + version "11.0.6" + resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-11.0.6.tgz#1a1d7775022e7e6263f8d9ee2872d995163b3fc0" + integrity sha512-vf5YNEpXWRa0fKC/BRq5sVVj2WnEqW8jn14YQRHwVt5ppUeyu8IKUF69p6W1MwZMgMqMaw/vPQ8LI5cFbyf3uw== dependencies: - "@angular-devkit/core" "11.0.5" + "@angular-devkit/core" "11.0.6" enhanced-resolve "5.3.1" webpack-sources "2.0.1" @@ -2552,10 +2552,10 @@ is-plain-object "^5.0.0" universal-user-agent "^6.0.0" -"@octokit/openapi-types@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-2.0.1.tgz#7453d8281ce66b8ed1607f7ac7d751c3baffd2cc" - integrity sha512-9AuC04PUnZrjoLiw3uPtwGh9FE4Q3rTqs51oNlQ0rkwgE8ftYsOC+lsrQyvCvWm85smBbSc0FNRKKumvGyb44Q== +"@octokit/openapi-types@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-2.2.0.tgz#123e0438a0bc718ccdac3b5a2e69b3dd00daa85b" + integrity sha512-274lNUDonw10kT8wHg8fCcUc1ZjZHbWv0/TbAwb0ojhBQqZYc1cQ/4yqTVTtPMDeZ//g7xVEYe/s3vURkRghPg== "@octokit/plugin-enterprise-rest@^6.0.1": version "6.0.1" @@ -2644,11 +2644,11 @@ "@types/node" ">= 8" "@octokit/types@^6.0.0", "@octokit/types@^6.0.3": - version "6.1.2" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.1.2.tgz#2b3a6ae0b8b71c27c770b4ff3e9ad8f1f538af58" - integrity sha512-LPCpcLbcky7fWfHCTuc7tMiSHFpFlrThJqVdaHgowBTMS0ijlZFfonQC/C1PrZOjD4xRCYgBqH9yttEATGE/nw== + version "6.2.1" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.2.1.tgz#7f881fe44475ab1825776a4a59ca1ae082ed1043" + integrity sha512-jHs9OECOiZxuEzxMZcXmqrEO8GYraHF+UzNVH2ACYh8e/Y7YoT+hUf9ldvVd6zIvWv4p3NdxbQ0xx3ku5BnSiA== dependencies: - "@octokit/openapi-types" "^2.0.1" + "@octokit/openapi-types" "^2.2.0" "@types/node" ">= 8" "@rollup/plugin-commonjs@^15.0.0": @@ -2692,13 +2692,13 @@ estree-walker "^1.0.1" picomatch "^2.2.2" -"@schematics/angular@11.0.5": - version "11.0.5" - resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-11.0.5.tgz#149f908fd600e881ff87c5192d2673d0e3c37f38" - integrity sha512-7p2wweoJYhim8YUy3ih1SrPGqRsa6+aEFbYgo9v4zt7b3tOva8SvkbC2alayK74fclzQ7umqa6xAwvWhy8ORvg== +"@schematics/angular@11.0.6": + version "11.0.6" + resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-11.0.6.tgz#5e52f8396e66138df0d6062130399fab830ee79e" + integrity sha512-XUcpOrlcp55PBHrgpIVx69lnhDY6ro35BSRmqNmjXik56qcOkfvdki8vvyW9EsWvu9/sfBSsVDdparlbVois7w== dependencies: - "@angular-devkit/core" "11.0.5" - "@angular-devkit/schematics" "11.0.5" + "@angular-devkit/core" "11.0.6" + "@angular-devkit/schematics" "11.0.6" jsonc-parser "2.3.1" "@schematics/angular@~10.0.5": @@ -2717,13 +2717,13 @@ "@angular-devkit/core" "10.1.7" "@angular-devkit/schematics" "10.1.7" -"@schematics/update@0.1100.5": - version "0.1100.5" - resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.1100.5.tgz#40b529d93db51e6f66378bd9f4ff99f2e9c278f6" - integrity sha512-BYtKKuiWsrlc4FMW3bRyl4tm6lWNMTi8oql/mtkSgH7V5eMmaLDJtM+zDl+qyC/KHPxbHTfoHDapfv1tITSWjA== +"@schematics/update@0.1100.6": + version "0.1100.6" + resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.1100.6.tgz#8e76276a3daecfd698b39e7643bc21f3abb3a4d0" + integrity sha512-+B8n+k+zZ3VYOhjNBsLqzjp8O9ZdUWgdpf9L8XAA7mh/oPwufXpExyEc66uAS07imvUMmjz6i8E2eNWV/IjBJg== dependencies: - "@angular-devkit/core" "11.0.5" - "@angular-devkit/schematics" "11.0.5" + "@angular-devkit/core" "11.0.6" + "@angular-devkit/schematics" "11.0.6" "@yarnpkg/lockfile" "1.1.0" ini "1.3.6" npm-package-arg "^8.0.0" @@ -2885,9 +2885,9 @@ integrity sha512-AzfesNFLvOs6Q1mHzIsVJXSeUnqVh4ZHG8ngygKJfbkcSLwzrBVm/LKa+mR8KrOfnWtUL47112gde1MC0IXqpQ== "@types/jest@26.x": - version "26.0.19" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.19.tgz#e6fa1e3def5842ec85045bd5210e9bb8289de790" - integrity sha512-jqHoirTG61fee6v6rwbnEuKhpSKih0tuhqeFbCmMmErhtu3BYlOZaXWjffgOstMM4S/3iQD31lI5bGLTrs97yQ== + version "26.0.20" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.20.tgz#cd2f2702ecf69e86b586e1f5223a60e454056307" + integrity sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA== dependencies: jest-diff "^26.0.0" pretty-format "^26.0.0" @@ -2923,14 +2923,14 @@ integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg== "@types/node@*", "@types/node@>= 8": - version "14.14.19" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.19.tgz#5135176a8330b88ece4e9ab1fdcfc0a545b4bab4" - integrity sha512-4nhBPStMK04rruRVtVc6cDqhu7S9GZai0fpXgPXrFpcPX6Xul8xnrjSdGB4KPBVYG/R5+fXWdCM8qBoiULWGPQ== + version "14.14.20" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.20.tgz#f7974863edd21d1f8a494a73e8e2b3658615c340" + integrity sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A== "@types/node@^12.11.1": - version "12.19.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.11.tgz#9220ab4b20d91169eb78f456dbfcbabee89dfb50" - integrity sha512-bwVfNTFZOrGXyiQ6t4B9sZerMSShWNsGRw8tC5DY1qImUNczS9SjT4G6PnzjCnxsu5Ubj6xjL2lgwddkxtQl5w== + version "12.19.12" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.12.tgz#04793c2afa4ce833a9972e4c476432e30f9df47b" + integrity sha512-UwfL2uIU9arX/+/PRcIkT08/iBadGN2z6ExOROA2Dh5mAuWTBj6iJbQX4nekiV5H8cTrEG569LeX+HRco9Cbxw== "@types/node@^8.0.31": version "8.10.66" @@ -3800,9 +3800,9 @@ binary-extensions@^1.0.0: integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== binary-extensions@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9" - integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ== + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== bindings@^1.5.0: version "1.5.0" @@ -3990,15 +3990,15 @@ browserify-zlib@^0.2.0: pako "~1.0.5" browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.14.5, browserslist@^4.16.0, browserslist@^4.7.0, browserslist@^4.9.1: - version "4.16.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.0.tgz#410277627500be3cb28a1bfe037586fbedf9488b" - integrity sha512-/j6k8R0p3nxOC6kx5JGAxsnhc9ixaWJfYc+TNTzxg6+ARaESAvQGV7h0uNOB4t+pLQJZWzcrMxXOxjgsCj3dqQ== + version "4.16.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.1.tgz#bf757a2da376b3447b800a16f0f1c96358138766" + integrity sha512-UXhDrwqsNcpTYJBTZsbGATDxZbiVDsx6UjpmRUmtnP10pr8wAYr5LgFoEFw9ixriQH2mv/NX2SfGzE/o8GndLA== dependencies: - caniuse-lite "^1.0.30001165" + caniuse-lite "^1.0.30001173" colorette "^1.2.1" - electron-to-chromium "^1.3.621" + electron-to-chromium "^1.3.634" escalade "^3.1.1" - node-releases "^1.1.67" + node-releases "^1.1.69" browserstack@^1.5.1: version "1.6.1" @@ -4181,12 +4181,12 @@ cachedir@2.2.0: integrity sha512-VvxA0xhNqIIfg0V9AmJkDg91DaJwryutH5rVEZAhcNi4iJFj9f+QxmAjgK1LT9I8OgToX27fypX6/MeCXVbBjQ== call-bind@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.0.tgz#24127054bb3f9bdcb4b1fb82418186072f77b8ce" - integrity sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w== + version "1.0.1" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.1.tgz#29aca9151f8ddcfd5b9b786898f005f425e88567" + integrity sha512-tvAvUwNcRikl3RVF20X9lsYmmepsovzTWeJiXjO0PkJp15uy/6xKFZOQtuiSULwYW+6ToZBprphCgWXC2dSgcQ== dependencies: function-bind "^1.1.1" - get-intrinsic "^1.0.0" + get-intrinsic "^1.0.2" call-me-maybe@^1.0.1: version "1.0.1" @@ -4273,10 +4273,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001032, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001165: - version "1.0.30001173" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001173.tgz#3c47bbe3cd6d7a9eda7f50ac016d158005569f56" - integrity sha512-R3aqmjrICdGCTAnSXtNyvWYMK3YtV5jwudbq0T7nN9k4kmE4CBuwPqyJ+KBzepSTh0huivV2gLbSMEzTTmfeYw== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001032, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001173: + version "1.0.30001174" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001174.tgz#0f2aca2153fd88ceb07a2bb982fc2acb787623c4" + integrity sha512-tqClL/4ThQq6cfFXH3oJL4rifFBeM6gTkphjao5kgwMaW9yn0tKgQLAEfKzDwj6HQWCB/aWo8kTFlSvIN8geEA== canonical-path@1.0.0: version "1.0.0" @@ -4360,9 +4360,9 @@ chartjs-color@^2.1.0: color-convert "^1.9.3" "chokidar@>=2.0.0 <4.0.0", chokidar@^3.0.0, chokidar@^3.0.2, chokidar@^3.2.1, chokidar@^3.4.1: - version "3.4.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" - integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== + version "3.5.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.0.tgz#458a4816a415e9d3b3caa4faec2b96a6935a9e65" + integrity sha512-JgQM9JS92ZbFR4P90EvmzNpSGhpPBGBSj10PILeDyYFwp4h2/D9OM03wsJ4zW1fEp4ka2DGrnUeD7FuvQ2aZ2Q== dependencies: anymatch "~3.1.1" braces "~3.0.2" @@ -4372,7 +4372,7 @@ chartjs-color@^2.1.0: normalize-path "~3.0.0" readdirp "~3.5.0" optionalDependencies: - fsevents "~2.1.2" + fsevents "~2.3.1" chokidar@^2.1.8: version "2.1.8" @@ -5832,10 +5832,10 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -electron-to-chromium@^1.3.621: - version "1.3.633" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.633.tgz#16dd5aec9de03894e8d14a1db4cda8a369b9b7fe" - integrity sha512-bsVCsONiVX1abkWdH7KtpuDAhsQ3N3bjPYhROSAXE78roJKet0Y5wznA14JE9pzbwSZmSMAW6KiKYf1RvbTJkA== +electron-to-chromium@^1.3.634: + version "1.3.635" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.635.tgz#8d1591eeca6b257d380061a2c04f0b3cc6c9e33b" + integrity sha512-RRriZOLs9CpW6KTLmgBqyUdnY0QNqqWs0HOtuQGGEMizOTNNn1P7sGRBxARnUeLejOsgwjDyRqT3E/CSst02ZQ== elliptic@^6.5.3: version "6.5.3" @@ -6668,10 +6668,10 @@ fsevents@^1.2.7: bindings "^1.5.0" nan "^2.12.1" -fsevents@^2.1.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.2.1.tgz#1fb02ded2036a8ac288d507a65962bd87b97628d" - integrity sha512-bTLYHSeC0UH/EFXS9KqWnXuOl/wHK5Z/d+ghd5AsFMYN7wIGkUCOJyzy88+wJKkZPGON8u4Z9f6U4FdgURE9qA== +fsevents@^2.1.2, fsevents@~2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f" + integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw== fsevents@~2.1.2: version "2.1.3" @@ -6712,7 +6712,7 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.0.0: +get-intrinsic@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.0.2.tgz#6820da226e50b24894e08859469dc68361545d49" integrity sha512-aeX0vrFm21ILl3+JpFFRNe9aUvp6VFZb2/CTbgLb8j75kOhvoNYjt9d8KA/tJG4gSo8nzEDedRl0h7vDmBYRVg== @@ -6930,9 +6930,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globby@^11.0.1: - version "11.0.1" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.1.tgz#9a2bf107a068f3ffeabc49ad702c79ede8cfd357" - integrity sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ== + version "11.0.2" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.2.tgz#1af538b766a3b540ebfb58a32b2e2d5897321d83" + integrity sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== dependencies: array-union "^2.1.0" dir-glob "^3.0.1" @@ -9180,9 +9180,9 @@ meow@^4.0.0: trim-newlines "^2.0.0" meow@^8.0.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.0.tgz#0fcaa267e35e4d58584b8205923df6021ddcc7ba" - integrity sha512-fNWkgM1UVMey2kf24yLiccxLihc5W+6zVus3/N0b+VfnJgxV99E9u04X6NAiKdg6ED7DAQBX5sy36NM0QJZkWA== + version "8.1.2" + resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" + integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== dependencies: "@types/minimist" "^1.2.0" camelcase-keys "^6.2.2" @@ -9622,13 +9622,13 @@ ng-packagr@^11.0.1: stylus "^0.54.7" terser "^5.0.0" -ng-zorro-antd@^10.1.1: - version "10.2.2" - resolved "https://registry.yarnpkg.com/ng-zorro-antd/-/ng-zorro-antd-10.2.2.tgz#5951f1fd5d1e405e7fe983756dca1eb942b255de" - integrity sha512-4Q2G6DtRJnEQXFcIEUyqgFi6JXcEF9bN0zOPNBV7LTNgjOf31QiE+3Pu2ifz8esGVwv7vmG8if8V2/Ha/Ol8Dw== +ng-zorro-antd@^11.0.1: + version "11.0.1" + resolved "https://registry.yarnpkg.com/ng-zorro-antd/-/ng-zorro-antd-11.0.1.tgz#ffa642a225b4dd41ddad93ac5e83aa3cd9422567" + integrity sha512-RfU19OMCRqRw/p/2+2XETcDFInCEZwVgSIFMnTqIqAFk0ndfmrPXbVWdIMTCCllKc3md414ExYckWXaqQ/8Vzg== dependencies: - "@angular/cdk" "^10.2.4" - "@ant-design/icons-angular" "^10.0.0" + "@angular/cdk" "^11.0.2" + "@ant-design/icons-angular" "^11.0.1" date-fns "^2.10.0" resize-observer-polyfill "^1.5.1" tslib "^2.0.0" @@ -9736,10 +9736,10 @@ node-notifier@^6.0.0: shellwords "^0.1.1" which "^1.3.1" -node-releases@^1.1.67: - version "1.1.67" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.67.tgz#28ebfcccd0baa6aad8e8d4d8fe4cbc49ae239c12" - integrity sha512-V5QF9noGFl3EymEwUYzO+3NTDpGfQB4ve6Qfnzf3UNydMhjQRVPR1DZTuvWiLzaFJYw2fmDwAfnRNEVb64hSIg== +node-releases@^1.1.69: + version "1.1.69" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.69.tgz#3149dbde53b781610cd8b486d62d86e26c3725f6" + integrity sha512-DGIjo79VDEyAnRlfSqYTsy+yoHd2IOjJiKUozD2MV2D85Vso6Bug56mb9tT/fY5Urt0iqk01H7x+llAruDR2zA== node-sass-tilde-importer@^1.0.0: version "1.0.2" @@ -10423,12 +10423,14 @@ parse-passwd@^1.0.0: integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= parse-path@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.2.tgz#ef14f0d3d77bae8dd4bc66563a4c151aac9e65aa" - integrity sha512-HSqVz6iuXSiL8C1ku5Gl1Z5cwDd9Wo0q8CoffdAghP6bz8pJa1tcMC+m4N+z6VAS8QdksnIGq1TB6EgR4vPR6w== + version "4.0.3" + resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.3.tgz#82d81ec3e071dcc4ab49aa9f2c9c0b8966bb22bf" + integrity sha512-9Cepbp2asKnWTJ9x2kpw6Fe8y9JDbqwahGCTvklzd/cEq5C5JC59x2Xb0Kx+x0QZ8bvNquGO8/BWP0cwBHzSAA== dependencies: is-ssh "^1.3.0" protocols "^1.4.0" + qs "^6.9.4" + query-string "^6.13.8" parse-url@^5.0.0: version "5.0.2" @@ -11222,11 +11224,25 @@ qs@6.7.0: resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== +qs@^6.9.4: + version "6.9.4" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.4.tgz#9090b290d1f91728d3c22e54843ca44aea5ab687" + integrity sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ== + qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== +query-string@^6.13.8: + version "6.13.8" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.8.tgz#8cf231759c85484da3cf05a851810d8e825c1159" + integrity sha512-jxJzQI2edQPE/NPUOusNjO/ZOGqr1o2OBa/3M00fU76FsLXDVbJDv/p7ng5OdQyorKrkRz1oqfwmbe5MAMePQg== + dependencies: + decode-uri-component "^0.2.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -11558,9 +11574,9 @@ regjsgen@^0.5.1: integrity sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A== regjsparser@^0.6.4: - version "0.6.4" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.4.tgz#a769f8684308401a66e9b529d2436ff4d0666272" - integrity sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw== + version "0.6.6" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.6.tgz#6d8c939d1a654f78859b08ddcc4aa777f3fa800a" + integrity sha512-jjyuCp+IEMIm3N1H1LLTJW1EISEJV9+5oHdEyrt43Pg9cDSb6rrLZei2cVWpl0xTjmmlpec/lEQGYgM7xfpGCQ== dependencies: jsesc "~0.5.0" @@ -11857,9 +11873,9 @@ rollup@2.32.1: fsevents "~2.1.2" rollup@^2.8.0: - version "2.35.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.35.1.tgz#e6bc8d10893556a638066f89e8c97f422d03968c" - integrity sha512-q5KxEyWpprAIcainhVy6HfRttD9kutQpHbeqDTWnqAFNJotiojetK6uqmcydNMymBEtC4I8bCYR+J3mTMqeaUA== + version "2.36.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.36.1.tgz#2174f0c25c7b400d57b05628d0e732c7ae8d2178" + integrity sha512-eAfqho8dyzuVvrGqpR0ITgEdq0zG2QJeWYh+HeuTbpcaXk8vNFc48B7bJa1xYosTCKx0CuW+447oQOW8HgBIZQ== optionalDependencies: fsevents "~2.1.2" @@ -11969,9 +11985,9 @@ sass@1.27.0: chokidar ">=2.0.0 <4.0.0" sass@^1.23.0: - version "1.32.0" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.32.0.tgz#10101a026c13080b14e2b374d4e15ee24400a4d3" - integrity sha512-fhyqEbMIycQA4blrz/C0pYhv2o4x2y6FYYAH0CshBw3DXh5D5wyERgxw0ptdau1orc/GhNrhF7DFN2etyOCEng== + version "1.32.2" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.32.2.tgz#66dc0250bc86c15d19ddee7135e93d0cf3d3257b" + integrity sha512-u1pUuzqwz3SAgvHSWp1k0mRhX82b2DdlVnP6UIetQPZtYbuJUDaPQhZE12jyjB7vYeOScfz9WPsZJB6Rpk7heA== dependencies: chokidar ">=2.0.0 <4.0.0" @@ -12476,6 +12492,11 @@ speed-measure-webpack-plugin@1.3.3: dependencies: chalk "^2.0.1" +split-on-first@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" + integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw== + split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" @@ -12605,6 +12626,11 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== +strict-uri-encode@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" + integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY= + string-length@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/string-length/-/string-length-3.1.0.tgz#107ef8c23456e187a8abd4a61162ff4ac6e25837" @@ -12919,9 +12945,9 @@ tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: yallist "^3.0.3" tar@^6.0.2: - version "6.0.5" - resolved "https://registry.yarnpkg.com/tar/-/tar-6.0.5.tgz#bde815086e10b39f1dcd298e89d596e1535e200f" - integrity sha512-0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg== + version "6.1.0" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.0.tgz#d1724e9bcc04b977b18d5c573b333a2207229a83" + integrity sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA== dependencies: chownr "^2.0.0" fs-minipass "^2.0.0" @@ -13274,7 +13300,7 @@ tsickle@^0.39.1: resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.39.1.tgz#7ccf672cde5b430f5dd0b281ee49e170ef390ff9" integrity sha512-CCc9cZhZbKoNizVM+K3Uqgit/go8GacjpqTv1cpwG/n2P0gB9GMoWZbxrUULDE9Wz26Lh86CGf6QyIPUVV1lnQ== -tslib@2.0.3, tslib@^2.0.0: +tslib@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.3.tgz#8e0741ac45fc0c226e58a17bfc3e64b9bc6ca61c" integrity sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ== @@ -13284,6 +13310,11 @@ tslib@^1.10.0, tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== +tslib@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" + integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== + tslint@~6.1.0: version "6.1.3" resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.3.tgz#5c23b2eccc32487d5523bd3a470e9aa31789d904" @@ -13536,9 +13567,9 @@ upath@^1.1.1, upath@^1.2.0: integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== uri-js@^4.2.2: - version "4.4.0" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602" - integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g== + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" @@ -13736,9 +13767,9 @@ webdriver-js-extender@2.1.0: selenium-webdriver "^3.0.1" webdriver-manager@^12.1.7: - version "12.1.7" - resolved "https://registry.yarnpkg.com/webdriver-manager/-/webdriver-manager-12.1.7.tgz#ed4eaee8f906b33c146e869b55e850553a1b1162" - integrity sha512-XINj6b8CYuUYC93SG3xPkxlyUc3IJbD6Vvo75CVGuG9uzsefDzWQrhz0Lq8vbPxtb4d63CZdYophF8k8Or/YiA== + version "12.1.8" + resolved "https://registry.yarnpkg.com/webdriver-manager/-/webdriver-manager-12.1.8.tgz#5e70e73eaaf53a0767d5745270addafbc5905fd4" + integrity sha512-qJR36SXG2VwKugPcdwhaqcLQOD7r8P2Xiv9sfNbfZrKBnX243iAkOueX1yAmeNgIKhJ3YAT/F2gq6IiEZzahsg== dependencies: adm-zip "^0.4.9" chalk "^1.1.1" From c6d62a2c9901e7022089ebd051b02a55d4b9bb06 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Mon, 11 Jan 2021 14:05:22 +0300 Subject: [PATCH 084/119] added missing virtual to identity mongo repositories --- .../MongoDB/MongoIdentityClaimTypeRepository.cs | 2 +- .../MongoDB/MongoIdentityLinkUserRepository.cs | 4 ++-- .../Identity/MongoDB/MongoIdentityRoleRepository.cs | 6 +++--- .../MongoDB/MongoIdentitySecurityLogRepository.cs | 6 +++--- .../Identity/MongoDB/MongoIdentityUserRepository.cs | 10 +++++----- .../MongoDB/MongoOrganizationUnitRepository.cs | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs index 6795735793..3ad208efc0 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs @@ -55,7 +55,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs index 43bad94271..e670759e5c 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Identity.MongoDB { } - public async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .OrderBy(x => x.Id).FirstOrDefaultAsync(x => @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.MongoDB , cancellationToken: GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.SourceUserId == linkUserInfo.UserId && x.SourceTenantId == linkUserInfo.TenantId || diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs index 0731008f57..f4b5049b16 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity.MongoDB { } - public async Task FindByNormalizedNameAsync( + public virtual async Task FindByNormalizedNameAsync( string normalizedRoleName, bool includeDetails = true, CancellationToken cancellationToken = default) @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.MongoDB .FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, @@ -64,7 +64,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs index a0a8b9b103..cc926db139 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Identity.MongoDB { } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -53,7 +53,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( DateTime? startTime = null, DateTime? endTime = null, string applicationName = null, @@ -82,7 +82,7 @@ namespace Volo.Abp.Identity.MongoDB } - public async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, + public virtual async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).OrderBy(x => x.Id).FirstOrDefaultAsync(x => x.Id == id && x.UserId == userId, diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index 0864f7b01c..1909b269cc 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -53,7 +53,7 @@ namespace Volo.Abp.Identity.MongoDB return await dbContext.Roles.AsQueryable().Where(r => allRoleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetRoleNamesInOrganizationUnitAsync( + public virtual async Task> GetRoleNamesInOrganizationUnitAsync( Guid id, CancellationToken cancellationToken = default) { @@ -178,7 +178,7 @@ namespace Volo.Abp.Identity.MongoDB return await dbContext.Roles.AsQueryable().Where(r => allRoleIds.Contains(r.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetOrganizationUnitsAsync( + public virtual async Task> GetOrganizationUnitsAsync( Guid id, bool includeDetails = false, CancellationToken cancellationToken = default) @@ -210,7 +210,7 @@ namespace Volo.Abp.Identity.MongoDB .LongCountAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetUsersInOrganizationUnitAsync( + public virtual async Task> GetUsersInOrganizationUnitAsync( Guid organizationUnitId, CancellationToken cancellationToken = default) { @@ -221,7 +221,7 @@ namespace Volo.Abp.Identity.MongoDB return result; } - public async Task> GetUsersInOrganizationsListAsync( + public virtual async Task> GetUsersInOrganizationsListAsync( List organizationUnitIds, CancellationToken cancellationToken = default) { @@ -232,7 +232,7 @@ namespace Volo.Abp.Identity.MongoDB return result; } - public async Task> GetUsersInOrganizationUnitWithChildrenAsync( + public virtual async Task> GetUsersInOrganizationUnitWithChildrenAsync( string code, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs index de0afd8abc..6479bc4be0 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs @@ -112,7 +112,7 @@ namespace Volo.Abp.Identity.MongoDB .CountAsync(cancellationToken); } - public async Task> GetUnaddedRolesAsync( + public virtual async Task> GetUnaddedRolesAsync( OrganizationUnit organizationUnit, string sorting = null, int maxResultCount = int.MaxValue, @@ -132,7 +132,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(cancellationToken); } - public async Task GetUnaddedRolesCountAsync( + public virtual async Task GetUnaddedRolesCountAsync( OrganizationUnit organizationUnit, string filter = null, CancellationToken cancellationToken = default) @@ -174,7 +174,7 @@ namespace Volo.Abp.Identity.MongoDB return await query.CountAsync(cancellationToken); } - public async Task> GetUnaddedUsersAsync( + public virtual async Task> GetUnaddedUsersAsync( OrganizationUnit organizationUnit, string sorting = null, int maxResultCount = int.MaxValue, @@ -199,7 +199,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetUnaddedUsersCountAsync(OrganizationUnit organizationUnit, string filter = null, + public virtual async Task GetUnaddedUsersCountAsync(OrganizationUnit organizationUnit, string filter = null, CancellationToken cancellationToken = default) { var dbContext = await GetDbContextAsync(cancellationToken); From f6c8feeac8b03a96658a5fca30c0f8f4727c605b Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Mon, 11 Jan 2021 14:08:27 +0300 Subject: [PATCH 085/119] added missing virtual to identity efcore repositories --- .../EFCoreIdentitySecurityLogRepository.cs | 6 +++--- .../EfCoreIdentityClaimTypeRepository.cs | 2 +- .../EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs | 4 ++-- .../EntityFrameworkCore/EfCoreIdentityRoleRepository.cs | 2 +- .../EntityFrameworkCore/EfCoreIdentityUserRepository.cs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs index 91915cd9b8..c985680455 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -54,7 +54,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .ToListAsync(cancellationToken); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( DateTime? startTime = null, DateTime? endTime = null, string applicationName = null, @@ -84,7 +84,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await query.LongCountAsync(cancellationToken); } - public async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, CancellationToken cancellationToken = default) + public virtual async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .OrderBy(x => x.Id) diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs index 4cbdfb5725..f634050b23 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs @@ -47,7 +47,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return identityClaimTypes; } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs index 6920d1081e..c7e81f327e 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore } - public async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .OrderBy(x => x.Id).FirstOrDefaultAsync(x => @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore , cancellationToken: GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where(x => diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs index b1389afd6a..aed6ed2232 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs @@ -64,7 +64,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs index 8fcce7c35a..57b625a816 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs @@ -231,7 +231,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await query.ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetUsersInOrganizationsListAsync( + public virtual async Task> GetUsersInOrganizationsListAsync( List organizationUnitIds, CancellationToken cancellationToken = default ) From 6306126399a3e804d451514014663e3ca5fbefd6 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Mon, 11 Jan 2021 14:08:29 +0300 Subject: [PATCH 086/119] add info on authorization to Angular UI docs --- docs/en/UI/Angular/Authorization.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/en/UI/Angular/Authorization.md diff --git a/docs/en/UI/Angular/Authorization.md b/docs/en/UI/Angular/Authorization.md new file mode 100644 index 0000000000..75d6107341 --- /dev/null +++ b/docs/en/UI/Angular/Authorization.md @@ -0,0 +1,28 @@ +# Authorization in Angular UI + +OAuth is preconfigured in Angular application templates. So, when you start a project using the CLI (or Suite, for that matter), authorization already works. You can find **OAuth configuration** in the _environment.ts_ files. + +```js +import { Config } from '@abp/ng.core'; + +const baseUrl = 'http://localhost:4200'; + +export const environment = { + // other options removed for sake of brevity + + oAuthConfig: { + issuer: 'https://localhost:44305', + redirectUri: baseUrl, + clientId: 'MyProjectName_App', + responseType: 'code', + scope: 'offline_access MyProjectName', + }, + + // other options removed for sake of brevity +} as Config.Environment; + +``` + +This configuration results in an [OAuth authorization code flow with PKCE](https://tools.ietf.org/html/rfc7636) and we are using [angular-oauth2-oidc library](https://github.com/manfredsteyer/angular-oauth2-oidc#logging-in) for managing OAuth in the Angular client. + +According to this flow, the user is redirected to an external login page which is built with MVC. So, if you need **to customize the login page**, please follow [this community article](https://community.abp.io/articles/how-to-customize-the-login-page-for-mvc-razor-page-applications-9a40f3cd). From 245f73db4cc20637023340d17b3946e79bee1c07 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Mon, 11 Jan 2021 14:09:48 +0300 Subject: [PATCH 087/119] add Angular UI authorization doc to nav --- docs/en/docs-nav.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index be24432203..ec9d665373 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -755,6 +755,10 @@ "text": "Config State Service", "path": "UI/Angular/Config-State-Service.md" }, + { + "text": "Authorization", + "path": "UI/Angular/Authorization.md" + }, { "text": "HTTP Requests", "path": "UI/Angular/HTTP-Requests.md" From 2f263e710c322653d7287ac4a23a0a88cab26ea3 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 11 Jan 2021 15:20:50 +0300 Subject: [PATCH 088/119] Microservice template generation via CLI --- .../Building/ProjectBuildContextExtensions.cs | 7 +- .../Steps/RemoveProjectFromSolutionStep.cs | 25 ++++++- .../TemplateProjectBuildPipelineBuilder.cs | 4 +- .../ProjectBuilding/TemplateInfoProvider.cs | 3 + .../Microservice/MicroserviceProTemplate.cs | 16 ++++ .../Microservice/MicroserviceTemplateBase.cs | 74 +++++++++++++++++++ 6 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceProTemplate.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs index e793c77011..80fb6db058 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs @@ -16,5 +16,10 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building return file; } + + public static FileEntry FindFile(this ProjectBuildContext context, string filePath) + { + return context.Files.FirstOrDefault(f => f.Name == filePath); + } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs index 7b48c780f1..6026ea96ca 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs @@ -7,8 +7,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps public class RemoveProjectFromSolutionStep : ProjectBuildPipelineStep { private readonly string _projectName; - private readonly string _solutionFilePath; - private readonly string _projectFolderPath; + private string _solutionFilePath; + private string _projectFolderPath; private string ProjectNameWithQuotes => $"\"{_projectName}\""; @@ -18,12 +18,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps string projectFolderPath = null) { _projectName = projectName; - _solutionFilePath = solutionFilePath ?? "/aspnet-core/MyCompanyName.MyProjectName.sln"; - _projectFolderPath = projectFolderPath ?? ("/aspnet-core/src/" + projectName); + _solutionFilePath = solutionFilePath; + _projectFolderPath = projectFolderPath; } public override void Execute(ProjectBuildContext context) { + SetSolutionAndProjectPathsIfNull(context); + new RemoveFolderStep(_projectFolderPath).Execute(context); var solutionFile = context.GetFile(_solutionFilePath); solutionFile.NormalizeLineEndings(); @@ -75,5 +77,20 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps return null; } + + private void SetSolutionAndProjectPathsIfNull(ProjectBuildContext context) + { + + if (_solutionFilePath == null) + { + _solutionFilePath = context.FindFile("/aspnet-core/MyCompanyName.MyProjectName.sln")?.Name ?? + context.FindFile("/MyCompanyName.MyProjectName.sln").Name; + } + if (_projectFolderPath == null) + { + _projectFolderPath = context.FindFile("/aspnet-core/src/" + _projectName.EnsureEndsWith('/'))?.Name ?? + context.FindFile("/src/" + _projectName.EnsureEndsWith('/')).Name; + } + } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs index 31c8f216b4..7642a7d697 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs @@ -1,5 +1,6 @@ using Volo.Abp.Cli.ProjectBuilding.Building.Steps; using Volo.Abp.Cli.ProjectBuilding.Templates.App; +using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule; namespace Volo.Abp.Cli.ProjectBuilding.Building @@ -25,6 +26,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building pipeline.Steps.Add(new SolutionRenameStep()); if (context.Template.Name == AppProTemplate.TemplateName || + context.Template.Name == MicroserviceProTemplate.TemplateName || context.Template.Name == ModuleProTemplate.TemplateName) { pipeline.Steps.Add(new LicenseCodeReplaceStep()); // todo: move to custom steps? @@ -37,7 +39,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building } if ((context.BuildArgs.UiFramework == UiFramework.Mvc || context.BuildArgs.UiFramework == UiFramework.Blazor) - && context.BuildArgs.MobileApp == MobileApp.None) + && context.BuildArgs.MobileApp == MobileApp.None && context.Template.Name != MicroserviceProTemplate.TemplateName) { pipeline.Steps.Add(new RemoveRootFolderStep()); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs index 2aefcfd1a9..b9308dd707 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs @@ -8,6 +8,7 @@ using Volo.Abp.Cli.Http; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Templates.App; using Volo.Abp.Cli.ProjectBuilding.Templates.Console; +using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule; using Volo.Abp.Cli.ProjectBuilding.Templates.Wpf; using Volo.Abp.DependencyInjection; @@ -49,6 +50,8 @@ namespace Volo.Abp.Cli.ProjectBuilding return new AppTemplate(); case AppProTemplate.TemplateName: return new AppProTemplate(); + case MicroserviceProTemplate.TemplateName: + return new MicroserviceProTemplate(); case ModuleTemplate.TemplateName: return new ModuleTemplate(); case ModuleProTemplate.TemplateName: diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceProTemplate.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceProTemplate.cs new file mode 100644 index 0000000000..aef7ffec3b --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceProTemplate.cs @@ -0,0 +1,16 @@ +namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice +{ + public class MicroserviceProTemplate : MicroserviceTemplateBase + { + /// + /// "microservice-pro". + /// + public const string TemplateName = "microservice-pro"; + + public MicroserviceProTemplate() + : base(TemplateName) + { + DocumentUrl = null; // todo: set this + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs new file mode 100644 index 0000000000..13bfe3433e --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using JetBrains.Annotations; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.Cli.ProjectBuilding.Building.Steps; + +namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice +{ + public abstract class MicroserviceTemplateBase : TemplateInfo + { + protected MicroserviceTemplateBase([NotNull] string name) + : base(name) + { + } + + public override IEnumerable GetCustomSteps(ProjectBuildContext context) + { + var steps = new List(); + + DeleteUnrelatedProjects(context, steps); + RandomizeStringEncryption(context, steps); + UpdateNuGetConfig(context, steps); + + return steps; + } + + private static void DeleteUnrelatedProjects(ProjectBuildContext context, List steps) + { + switch (context.BuildArgs.UiFramework) + { + case UiFramework.None: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.WebGateway")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor")); + steps.Add(new RemoveFolderStep("/angular")); + break; + + case UiFramework.Angular: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.WebGateway")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor")); + break; + + + case UiFramework.Blazor: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.WebGateway")); + steps.Add(new RemoveFolderStep("/angular")); + break; + + case UiFramework.Mvc: + case UiFramework.NotSpecified: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor")); + steps.Add(new RemoveFolderStep("/angular")); + break; + } + + if (!context.BuildArgs.PublicWebSite) + { + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.PublicWeb")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.PublicWebGateway")); + } + } + + private static void RandomizeStringEncryption(ProjectBuildContext context, List steps) + { + steps.Add(new RandomizeStringEncryptionStep()); + } + + private static void UpdateNuGetConfig(ProjectBuildContext context, List steps) + { + steps.Add(new UpdateNuGetConfigStep("/NuGet.Config")); + } + } +} From 3aacb2d5ae8fde3b9a4a0d14cb56c9aee15a00b0 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 11 Jan 2021 15:54:58 +0300 Subject: [PATCH 089/119] Update RemoveProjectFromSolutionStep.cs --- .../Building/Steps/RemoveProjectFromSolutionStep.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs index 6026ea96ca..942dd91067 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs @@ -26,6 +26,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { SetSolutionAndProjectPathsIfNull(context); + if (_solutionFilePath == null || _projectFolderPath == null) + { + return; + } + new RemoveFolderStep(_projectFolderPath).Execute(context); var solutionFile = context.GetFile(_solutionFilePath); solutionFile.NormalizeLineEndings(); @@ -84,12 +89,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps if (_solutionFilePath == null) { _solutionFilePath = context.FindFile("/aspnet-core/MyCompanyName.MyProjectName.sln")?.Name ?? - context.FindFile("/MyCompanyName.MyProjectName.sln").Name; + context.FindFile("/MyCompanyName.MyProjectName.sln")?.Name; } if (_projectFolderPath == null) { _projectFolderPath = context.FindFile("/aspnet-core/src/" + _projectName.EnsureEndsWith('/'))?.Name ?? - context.FindFile("/src/" + _projectName.EnsureEndsWith('/')).Name; + context.FindFile("/src/" + _projectName.EnsureEndsWith('/'))?.Name; } } } From 56f1e34328dd9116a65da8bb92c90e7dbd0d5156 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 11 Jan 2021 17:00:57 +0300 Subject: [PATCH 090/119] cli: fix nuget config api-key in for module-template --- .../Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs index 5e8db9a346..ef8385d479 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs @@ -75,7 +75,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Module private static void UpdateNuGetConfig(ProjectBuildContext context, List steps) { - steps.Add(new UpdateNuGetConfigStep("/NuGet.Config")); + steps.Add(new UpdateNuGetConfigStep("/aspnet-core/NuGet.Config")); } private void CleanupFolderHierarchy(ProjectBuildContext context, List steps) From 3c9a9b9fc0987806fb3a2b16a60d1bde1e2871af Mon Sep 17 00:00:00 2001 From: bnymncoskuner Date: Mon, 11 Jan 2021 19:26:56 +0300 Subject: [PATCH 091/119] feat: add page alert service and use it in theme-basic --- .../application-layout.component.html | 4 ++- .../theme-basic/src/lib/components/index.ts | 1 + .../page-alert-container.component.html | 22 ++++++++++++ .../page-alert-container.component.ts | 11 ++++++ .../theme-basic/src/lib/theme-basic.module.ts | 3 ++ .../theme-shared/src/lib/services/index.ts | 1 + .../src/lib/services/page-alert.service.ts | 34 +++++++++++++++++++ 7 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 npm/ng-packs/packages/theme-basic/src/lib/components/page-alert-container/page-alert-container.component.html create mode 100644 npm/ng-packs/packages/theme-basic/src/lib/components/page-alert-container/page-alert-container.component.ts create mode 100644 npm/ng-packs/packages/theme-shared/src/lib/services/page-alert.service.ts diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html index eb68dc7df0..7892d43a00 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html @@ -1,7 +1,7 @@