From 2ac19a485d8bbe79bca29241fea4df574c393e67 Mon Sep 17 00:00:00 2001
From: wakuflair <130427427@qq.com>
Date: Sat, 23 Nov 2019 14:36:53 +0800
Subject: [PATCH 001/105] Resolved:
https://github.com/abpframework/abp/issues/2239
---
.../Pages/SettingManagement/Index.cshtml | 9 ++++++---
.../Pages/SettingManagement/SettingPageGroup.cs | 5 ++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml
index 88645ad20e..aa69161a10 100644
--- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml
+++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml
@@ -19,14 +19,17 @@
-
+
@foreach (var group in Model.SettingPageCreationContext.Groups)
{
-
+
@group.DisplayName
- @await Component.InvokeAsync(group.ComponentType)
+ @await Component.InvokeAsync(group.ComponentType, new
+ {
+ settingDefinitions = group.Parameter
+ })
}
diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/SettingPageGroup.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/SettingPageGroup.cs
index 5acd284267..f6fae8726d 100644
--- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/SettingPageGroup.cs
+++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/SettingPageGroup.cs
@@ -26,11 +26,14 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
}
private Type _componentType;
- public SettingPageGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType)
+ public object Parameter { get; set; }
+
+ public SettingPageGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType, object parameter = null)
{
Id = id;
DisplayName = displayName;
ComponentType = componentType;
+ Parameter = parameter;
}
}
}
\ No newline at end of file
From 9e7d425f64cfdd59884c9841736e2aeb3ebe7be2 Mon Sep 17 00:00:00 2001
From: wakuflair <130427427@qq.com>
Date: Sat, 23 Nov 2019 14:46:28 +0800
Subject: [PATCH 002/105] rename the parameter's name
---
.../Pages/SettingManagement/Index.cshtml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml
index aa69161a10..7a4a36ed6a 100644
--- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml
+++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml
@@ -28,7 +28,7 @@
@await Component.InvokeAsync(group.ComponentType, new
{
- settingDefinitions = group.Parameter
+ parameter = group.Parameter
})
}
From bc02f0e980c60abf18a3173ccf1f4ccb9c983f14 Mon Sep 17 00:00:00 2001
From: iyilm4z
Date: Wed, 11 Dec 2019 18:37:16 +0300
Subject: [PATCH 003/105] AddGlobalFilters method of MongoDbRepository
extracted to a service
---
.../MongoDB/IMongoDbRepositoryFilterer.cs | 20 ++++++
.../Repositories/MongoDB/MongoDbRepository.cs | 59 ++--------------
.../MongoDB/MongoDbRepositoryFilterer.cs | 68 +++++++++++++++++++
3 files changed, 94 insertions(+), 53 deletions(-)
create mode 100644 framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepositoryFilterer.cs
create mode 100644 framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepositoryFilterer.cs
diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepositoryFilterer.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepositoryFilterer.cs
new file mode 100644
index 0000000000..680afce38f
--- /dev/null
+++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepositoryFilterer.cs
@@ -0,0 +1,20 @@
+using MongoDB.Driver;
+using System.Collections.Generic;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Domain.Repositories.MongoDB
+{
+ public interface IMongoDbRepositoryFilterer
+ where TEntity : class, IEntity
+ {
+ void AddGlobalFilters(List> filters);
+ }
+
+ public interface IMongoDbRepositoryFilterer : IMongoDbRepositoryFilterer
+ where TEntity : class, IEntity
+ {
+ FilterDefinition CreateEntityFilter(TKey id, bool applyFilters = false);
+
+ FilterDefinition CreateEntityFilter(TEntity entity, bool withConcurrencyStamp = false, string concurrencyStamp = null);
+ }
+}
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 057f72bbb5..8dd452463f 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
@@ -14,8 +14,6 @@ using Volo.Abp.EventBus.Distributed;
using Volo.Abp.EventBus.Local;
using Volo.Abp.Guids;
using Volo.Abp.MongoDB;
-using Volo.Abp.MultiTenancy;
-using Volo.Abp.Reflection;
using Volo.Abp.Threading;
namespace Volo.Abp.Domain.Repositories.MongoDB
@@ -411,6 +409,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
where TMongoDbContext : IAbpMongoDbContext
where TEntity : class, IEntity
{
+ public virtual IMongoDbRepositoryFilterer RepositoryFilterer { get; set; }
+
public MongoDbRepository(IMongoDbContextProvider dbContextProvider)
: base(dbContextProvider)
{
@@ -450,18 +450,18 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
CancellationToken cancellationToken = default)
{
return await Collection
- .Find(CreateEntityFilter(id, true))
+ .Find(RepositoryFilterer.CreateEntityFilter(id, true))
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public virtual TEntity Find(TKey id, bool includeDetails = true)
{
- return Collection.Find(CreateEntityFilter(id, true)).FirstOrDefault();
+ return Collection.Find(RepositoryFilterer.CreateEntityFilter(id, true)).FirstOrDefault();
}
public virtual void Delete(TKey id, bool autoSave = false)
{
- Collection.DeleteOne(CreateEntityFilter(id));
+ Collection.DeleteOne(RepositoryFilterer.CreateEntityFilter(id));
}
public virtual Task DeleteAsync(
@@ -470,56 +470,9 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
CancellationToken cancellationToken = default)
{
return Collection.DeleteOneAsync(
- CreateEntityFilter(id),
+ RepositoryFilterer.CreateEntityFilter(id),
GetCancellationToken(cancellationToken)
);
}
-
- protected override FilterDefinition CreateEntityFilter(TEntity entity, bool withConcurrencyStamp = false, string concurrencyStamp = null)
- {
- if (!withConcurrencyStamp || !(entity is IHasConcurrencyStamp entityWithConcurrencyStamp))
- {
- return Builders.Filter.Eq(e => e.Id, entity.Id);
- }
-
- if (concurrencyStamp == null)
- {
- concurrencyStamp = entityWithConcurrencyStamp.ConcurrencyStamp;
- }
-
- return Builders.Filter.And(
- Builders.Filter.Eq(e => e.Id, entity.Id),
- Builders.Filter.Eq(e => ((IHasConcurrencyStamp)e).ConcurrencyStamp, concurrencyStamp)
- );
- }
-
- protected virtual FilterDefinition CreateEntityFilter(TKey id, bool applyFilters = false)
- {
- var filters = new List>
- {
- Builders.Filter.Eq(e => e.Id, id)
- };
-
- if (applyFilters)
- {
- AddGlobalFilters(filters);
- }
-
- return Builders.Filter.And(filters);
- }
-
- protected virtual void AddGlobalFilters(List> filters)
- {
- if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)) && DataFilter.IsEnabled())
- {
- filters.Add(Builders.Filter.Eq(e => ((ISoftDelete)e).IsDeleted, false));
- }
-
- if (typeof(IMultiTenant).IsAssignableFrom(typeof(TEntity)))
- {
- var tenantId = CurrentTenant.Id;
- filters.Add(Builders.Filter.Eq(e => ((IMultiTenant)e).TenantId, tenantId));
- }
- }
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepositoryFilterer.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepositoryFilterer.cs
new file mode 100644
index 0000000000..5222121cab
--- /dev/null
+++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepositoryFilterer.cs
@@ -0,0 +1,68 @@
+using MongoDB.Driver;
+using System.Collections.Generic;
+using Volo.Abp.Data;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities;
+using Volo.Abp.MultiTenancy;
+
+namespace Volo.Abp.Domain.Repositories.MongoDB
+{
+ public class MongoDbRepositoryFilterer : IMongoDbRepositoryFilterer, ITransientDependency
+ where TEntity : class, IEntity
+ {
+ public IDataFilter DataFilter { get; set; }
+
+ public ICurrentTenant CurrentTenant { get; set; }
+
+ public void AddGlobalFilters(List> filters)
+ {
+ if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)) && DataFilter.IsEnabled())
+ {
+ filters.Add(Builders.Filter.Eq(e => ((ISoftDelete)e).IsDeleted, false));
+ }
+
+ if (typeof(IMultiTenant).IsAssignableFrom(typeof(TEntity)))
+ {
+ var tenantId = CurrentTenant.Id;
+ filters.Add(Builders.Filter.Eq(e => ((IMultiTenant)e).TenantId, tenantId));
+ }
+ }
+ }
+
+ public class MongoDbRepositoryFilterer : MongoDbRepositoryFilterer, IMongoDbRepositoryFilterer, ITransientDependency
+ where TEntity : class, IEntity
+ {
+ public FilterDefinition CreateEntityFilter(TKey id, bool applyFilters = false)
+ {
+ var filters = new List>
+ {
+ Builders.Filter.Eq(e => e.Id, id)
+ };
+
+ if (applyFilters)
+ {
+ AddGlobalFilters(filters);
+ }
+
+ return Builders.Filter.And(filters);
+ }
+
+ public FilterDefinition CreateEntityFilter(TEntity entity, bool withConcurrencyStamp = false, string concurrencyStamp = null)
+ {
+ if (!withConcurrencyStamp || !(entity is IHasConcurrencyStamp entityWithConcurrencyStamp))
+ {
+ return Builders.Filter.Eq(e => e.Id, entity.Id);
+ }
+
+ if (concurrencyStamp == null)
+ {
+ concurrencyStamp = entityWithConcurrencyStamp.ConcurrencyStamp;
+ }
+
+ return Builders.Filter.And(
+ Builders.Filter.Eq(e => e.Id, entity.Id),
+ Builders.Filter.Eq(e => ((IHasConcurrencyStamp)e).ConcurrencyStamp, concurrencyStamp)
+ );
+ }
+ }
+}
From b1eed339622e4a5abba6d0e1c4f29f52f1ab3846 Mon Sep 17 00:00:00 2001
From: maliming
Date: Thu, 12 Dec 2019 15:36:38 +0800
Subject: [PATCH 004/105] Implement AsyncBackgroundJob.
Resolve #2374
---
.../AbpBackgroundJobsAbstractionsModule.cs | 3 ++-
.../Abp/BackgroundJobs/AsyncBackgroundJob.cs | 20 +++++++++++++++
.../BackgroundJobs/BackgroundJobArgsHelper.cs | 7 ++++--
.../BackgroundJobs/BackgroundJobExecuter.cs | 17 ++++++++++---
.../Abp/BackgroundJobs/IAsyncBackgroundJob.cs | 16 ++++++++++++
.../BackgroundJobExecuter_Tests.cs | 25 ++++++++++++++++++-
.../BackgroundJobManager_Tests.cs | 8 ++++++
.../Volo/Abp/BackgroundJobs/MyAsyncJob.cs | 19 ++++++++++++++
.../Volo/Abp/BackgroundJobs/MyAsyncJobArgs.cs | 17 +++++++++++++
9 files changed, 125 insertions(+), 7 deletions(-)
create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AsyncBackgroundJob.cs
create mode 100644 framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IAsyncBackgroundJob.cs
create mode 100644 framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJob.cs
create mode 100644 framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/MyAsyncJobArgs.cs
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
index 38a0afb2cd..2b5f6fa7a5 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AbpBackgroundJobsAbstractionsModule.cs
@@ -23,7 +23,8 @@ namespace Volo.Abp.BackgroundJobs
services.OnRegistred(context =>
{
- if (ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IBackgroundJob<>)))
+ if (ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IBackgroundJob<>)) ||
+ ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IAsyncBackgroundJob<>)))
{
jobTypes.Add(context.ImplementationType);
}
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AsyncBackgroundJob.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AsyncBackgroundJob.cs
new file mode 100644
index 0000000000..3c76bd718e
--- /dev/null
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/AsyncBackgroundJob.cs
@@ -0,0 +1,20 @@
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+
+namespace Volo.Abp.BackgroundJobs
+{
+ public abstract class AsyncBackgroundJob : IAsyncBackgroundJob
+ {
+ //TODO: Add UOW, Localization and other useful properties..?
+
+ public ILogger> Logger { get; set; }
+
+ protected AsyncBackgroundJob()
+ {
+ Logger = NullLogger>.Instance;
+ }
+
+ public abstract Task ExecuteAsync(TArgs args);
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs
index 284a2cbb42..58199a9659 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobArgsHelper.cs
@@ -13,7 +13,8 @@ namespace Volo.Abp.BackgroundJobs
continue;
}
- if (@interface.GetGenericTypeDefinition() != typeof(IBackgroundJob<>))
+ if (@interface.GetGenericTypeDefinition() != typeof(IBackgroundJob<>) &&
+ @interface.GetGenericTypeDefinition() != typeof(IAsyncBackgroundJob<>))
{
continue;
}
@@ -27,7 +28,9 @@ namespace Volo.Abp.BackgroundJobs
return genericArgs[0];
}
- throw new AbpException($"Could not find type of the job args. Ensure that given type implements the {typeof(IBackgroundJob<>).AssemblyQualifiedName} interface. Given job type: {jobType.AssemblyQualifiedName}");
+ throw new AbpException($"Could not find type of the job args. " +
+ $"Ensure that given type implements the {typeof(IBackgroundJob<>).AssemblyQualifiedName} or {typeof(IAsyncBackgroundJob<>).AssemblyQualifiedName} interface. " +
+ $"Given job type: {jobType.AssemblyQualifiedName}");
}
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs
index df0ec36dd6..ec0ac8ee3f 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs
@@ -2,7 +2,9 @@
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using System;
+using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
+using Volo.Abp.Threading;
namespace Volo.Abp.BackgroundJobs
{
@@ -27,15 +29,24 @@ namespace Volo.Abp.BackgroundJobs
throw new AbpException("The job type is not registered to DI: " + context.JobType);
}
- var jobExecuteMethod = context.JobType.GetMethod(nameof(IBackgroundJob
@@ -59,12 +60,21 @@
{{ 'AbpIdentity::Actions' | abpLocalization }} |
{{ 'AbpIdentity::UserName' | abpLocalization }}
-
+
|
{{ 'AbpIdentity::EmailAddress' | abpLocalization }}
-
+
|
{{ 'AbpIdentity::PhoneNumber' | abpLocalization }}
@@ -86,7 +96,11 @@
{{ 'AbpIdentity::Actions' | abpLocalization }}
-
@@ -142,7 +162,9 @@
-
+
@@ -166,7 +188,12 @@
-
+
@@ -210,7 +237,9 @@
[attr.id]="'roles-' + i"
[formControl]="roleGroup.controls[roles[i].name]"
/>
-
+
@@ -229,5 +258,9 @@
-
+
diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts
index f258c5147b..b0cbacb324 100644
--- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts
+++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts
@@ -1,14 +1,15 @@
import { ABP, ConfigState } from '@abp/ng.core';
import { ConfirmationService, Toaster } from '@abp/ng.theme.shared';
-import { Component, TemplateRef, TrackByFunction, ViewChild, OnInit } from '@angular/core';
+import { Component, OnInit, TemplateRef, TrackByFunction, ViewChild } from '@angular/core';
import {
AbstractControl,
FormArray,
FormBuilder,
+ FormControl,
FormGroup,
Validators,
- FormControl,
} from '@angular/forms';
+import { PasswordRules, validatePassword } from '@ngx-validate/core';
import { Select, Store } from '@ngxs/store';
import { Observable } from 'rxjs';
import { finalize, pluck, switchMap, take } from 'rxjs/operators';
@@ -16,15 +17,14 @@ import snq from 'snq';
import {
CreateUser,
DeleteUser,
+ GetRoles,
GetUserById,
GetUserRoles,
GetUsers,
UpdateUser,
- GetRoles,
} from '../../actions/identity.actions';
import { Identity } from '../../models/identity';
import { IdentityState } from '../../states/identity.state';
-import { PasswordRules, validatePassword } from '@ngx-validate/core';
@Component({
selector: 'abp-users',
templateUrl: './users.component.html',
From a6ccc3320fa17a017325c24015616589a7255be0 Mon Sep 17 00:00:00 2001
From: maliming
Date: Thu, 19 Dec 2019 13:30:34 +0800
Subject: [PATCH 030/105] Add Razor support for mvc.
Resolve #2420
---
.../Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj | 1 +
.../Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj | 1 +
.../Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj | 1 +
.../Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj | 1 +
.../Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj | 1 +
.../Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj | 1 +
.../Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj | 1 +
.../Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj | 1 +
.../src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj | 1 +
9 files changed, 9 insertions(+)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
index f3556c1dbd..c6ad85408b 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
index 8601c0e51d..a1b83cbaef 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI.Bundling
Volo.Abp.AspNetCore.Mvc.UI.Bundling
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
index 960fbd3205..7a31569dda 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy
Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
index 92937c38ce..7a86cbb464 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI.Packages
Volo.Abp.AspNetCore.Mvc.UI.Packages
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj
index f26bc29d7e..168ca481fd 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic
Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
index c869ae2789..0962057909 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared
Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
index d9651aca86..d26c12fc7a 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI.Widgets
Volo.Abp.AspNetCore.Mvc.UI.Widgets
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
index aff29f8709..fb784efd44 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc.UI
Volo.Abp.AspNetCore.Mvc.UI
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
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 d4affa5fca..9e8980367b 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
@@ -4,6 +4,7 @@
netcoreapp3.1
+ true
Volo.Abp.AspNetCore.Mvc
Volo.Abp.AspNetCore.Mvc
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
From 0ae1d767d48ce13588e41893a0b926260c94ba41 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Fri, 20 Dec 2019 16:47:01 +0300
Subject: [PATCH 031/105] feature(core): add state actions to state services
---
.../core/src/lib/services/config-state.service.ts | 14 ++++++++++++++
.../core/src/lib/services/profile-state.service.ts | 14 ++++++++++++++
.../core/src/lib/services/session-state.service.ts | 10 ++++++++++
3 files changed, 38 insertions(+)
diff --git a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
index d238fd4734..877fdab0d3 100644
--- a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { ConfigState } from '../states';
+import { GetAppConfiguration, PatchRouteByName, AddRoute } from '../actions/config.actions';
+import { ABP } from '../models';
@Injectable({
providedIn: 'root',
@@ -47,4 +49,16 @@ export class ConfigStateService {
getLocalization(...args: Parameters) {
return this.store.selectSnapshot(ConfigState.getLocalization(...args));
}
+
+ addData() {
+ return this.store.dispatch(new GetAppConfiguration());
+ }
+
+ patchRoute(name: string, newValue: Partial) {
+ return this.store.dispatch(new PatchRouteByName(name, newValue));
+ }
+
+ addRoute(payload: Omit) {
+ return this.store.dispatch(new AddRoute(payload));
+ }
}
diff --git a/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
index 7dea8de2ea..372ce40e19 100644
--- a/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { ProfileState } from '../states';
+import { Profile } from '../models';
+import { GetProfile, UpdateProfile, ChangePassword } from '../actions';
@Injectable({
providedIn: 'root',
@@ -11,4 +13,16 @@ export class ProfileStateService {
getProfile() {
return this.store.selectSnapshot(ProfileState.getProfile);
}
+
+ fetchProfile() {
+ return this.store.dispatch(new GetProfile());
+ }
+
+ updateProfile(payload: Profile.Response) {
+ return this.store.dispatch(new UpdateProfile(payload));
+ }
+
+ changePassword(payload: Profile.ChangePasswordRequest) {
+ return this.store.dispatch(new ChangePassword(payload));
+ }
}
diff --git a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
index b74a8ed397..af7261229e 100644
--- a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { SessionState } from '../states';
+import { ABP } from '../models';
+import { SetLanguage, SetTenant } from '../actions';
@Injectable({
providedIn: 'root',
@@ -15,4 +17,12 @@ export class SessionStateService {
getTenant() {
return this.store.selectSnapshot(SessionState.getTenant);
}
+
+ setLanguage(payload: string) {
+ return this.store.dispatch(new SetLanguage(payload));
+ }
+
+ setTenant(payload: ABP.BasicItem) {
+ return this.store.dispatch(new SetTenant(payload));
+ }
}
From e2fb9384c47b1a3604a8eb00ce2d6850e6630936 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Fri, 20 Dec 2019 16:47:50 +0300
Subject: [PATCH 032/105] feature(feature-management): add state actions to
state service
---
.../lib/services/feature-management-state.service.ts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts b/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
index a40d0f6186..94f2f7fc6b 100644
--- a/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
+++ b/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { FeatureManagementState } from '../states';
+import { FeatureManagement } from '../models';
+import { GetFeatures, UpdateFeatures } from '../actions';
@Injectable({
providedIn: 'root',
@@ -11,4 +13,12 @@ export class FeatureManagementStateService {
getFeatures() {
return this.store.selectSnapshot(FeatureManagementState.getFeatures);
}
+
+ fetchFeatures(payload: FeatureManagement.Provider) {
+ return this.store.dispatch(new GetFeatures(payload));
+ }
+
+ updateFeatures(payload: FeatureManagement.Provider & FeatureManagement.Features) {
+ return this.store.dispatch(new UpdateFeatures(payload));
+ }
}
From b2e5362d835821a49a5ec0314eb1ead67cfd4832 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Fri, 20 Dec 2019 16:48:12 +0300
Subject: [PATCH 033/105] feature(identity): add actions to state service
---
.../lib/services/identity-state.service.ts | 59 +++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
index e5abe60fe9..746645e98d 100644
--- a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
+++ b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
@@ -1,5 +1,20 @@
+import { ABP } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
+import {
+ CreateRole,
+ CreateUser,
+ DeleteRole,
+ DeleteUser,
+ GetRoleById,
+ GetRoles,
+ GetUserById,
+ GetUsers,
+ UpdateRole,
+ UpdateUser,
+ GetUserRoles,
+} from '../actions/identity.actions';
+import { Identity } from '../models/identity';
import { IdentityState } from '../states/identity.state';
@Injectable({
@@ -20,4 +35,48 @@ export class IdentityStateService {
getUsersTotalCount() {
return this.store.selectSnapshot(IdentityState.getUsersTotalCount);
}
+
+ fetchRoles(payload?: ABP.PageQueryParams) {
+ return this.store.dispatch(new GetRoles(payload));
+ }
+
+ fetchRole(payload: string) {
+ return this.store.dispatch(new GetRoleById(payload));
+ }
+
+ deleteRole(payload: string) {
+ return this.store.dispatch(new DeleteRole(payload));
+ }
+
+ createRole(payload: Identity.RoleSaveRequest) {
+ return this.store.dispatch(new CreateRole(payload));
+ }
+
+ updateRole(payload: Identity.RoleItem) {
+ return this.store.dispatch(new UpdateRole(payload));
+ }
+
+ fetchUsers(payload?: ABP.PageQueryParams) {
+ return this.store.dispatch(new GetUsers(payload));
+ }
+
+ fetchUser(payload: string) {
+ return this.store.dispatch(new GetUserById(payload));
+ }
+
+ deleteUser(payload: string) {
+ return this.store.dispatch(new DeleteUser(payload));
+ }
+
+ createUser(payload: Identity.UserSaveRequest) {
+ return this.store.dispatch(new CreateUser(payload));
+ }
+
+ updateUser(payload: Identity.UserItem) {
+ return this.store.dispatch(new UpdateUser(payload));
+ }
+
+ getUserRoles(payload: string) {
+ return this.store.dispatch(new GetUserRoles(payload));
+ }
}
From 76c578a22415e2582b36c8897624d0903b7570d0 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Fri, 20 Dec 2019 17:04:20 +0300
Subject: [PATCH 034/105] fix(identity): correct parameter type
---
.../identity/src/lib/services/identity-state.service.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
index 746645e98d..9448273c0c 100644
--- a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
+++ b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
@@ -72,7 +72,7 @@ export class IdentityStateService {
return this.store.dispatch(new CreateUser(payload));
}
- updateUser(payload: Identity.UserItem) {
+ updateUser(payload: Identity.UserSaveRequest & { id: string }) {
return this.store.dispatch(new UpdateUser(payload));
}
From efae782ccee7e89812d8415b27f81693785812c3 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Fri, 20 Dec 2019 17:06:07 +0300
Subject: [PATCH 035/105] feature(permission-management): add actions to state
service
---
.../services/permission-management-state.service.ts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts b/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
index a85d637c87..243926aaea 100644
--- a/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
+++ b/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { PermissionManagementState } from '../states/permission-management.state';
+import { PermissionManagement } from '../models';
+import { GetPermissions, UpdatePermissions } from '../actions';
@Injectable({
providedIn: 'root',
@@ -14,4 +16,14 @@ export class PermissionManagementStateService {
getEntityDisplayName() {
return this.store.selectSnapshot(PermissionManagementState.getEntityDisplayName);
}
+
+ getPermissions(payload: PermissionManagement.GrantedProvider) {
+ return this.store.dispatch(new GetPermissions(payload));
+ }
+
+ updatePermissions(
+ payload: PermissionManagement.GrantedProvider & PermissionManagement.UpdateRequest,
+ ) {
+ return this.store.dispatch(new UpdatePermissions(payload));
+ }
}
From 0114677c636d37d9322ac8bf867f21982d6e5a0e Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Fri, 20 Dec 2019 17:33:27 +0300
Subject: [PATCH 036/105] feature(tenant-management): add actions to state
service
---
.../tenant-management-state.service.ts | 23 +++++++++++++++++++
.../src/lib/states/tenant-management.state.ts | 6 ++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
index 442289a66f..e27e4b3d67 100644
--- a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
+++ b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
@@ -1,6 +1,9 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { TenantManagementState } from '../states/tenant-management.state';
+import { ABP } from '@abp/ng.core';
+import { GetTenants, GetTenantById, CreateTenant, UpdateTenant, DeleteTenant } from '../actions';
+import { TenantManagement } from '../models';
@Injectable({
providedIn: 'root',
@@ -15,4 +18,24 @@ export class TenantManagementStateService {
getTenantsTotalCount() {
return this.store.selectSnapshot(TenantManagementState.getTenantsTotalCount);
}
+
+ getTenants(payload?: ABP.PageQueryParams) {
+ return this.store.dispatch(new GetTenants(payload));
+ }
+
+ getTenantById(payload: string) {
+ return this.store.dispatch(new GetTenantById(payload));
+ }
+
+ createTenant(payload: TenantManagement.AddRequest) {
+ return this.store.dispatch(new CreateTenant(payload));
+ }
+
+ updateTenant(payload: TenantManagement.UpdateRequest) {
+ return this.store.dispatch(new UpdateTenant(payload));
+ }
+
+ deleteTenant(payload: string) {
+ return this.store.dispatch(new DeleteTenant(payload));
+ }
}
diff --git a/npm/ng-packs/packages/tenant-management/src/lib/states/tenant-management.state.ts b/npm/ng-packs/packages/tenant-management/src/lib/states/tenant-management.state.ts
index c183cb48cc..bbd4a35d4f 100644
--- a/npm/ng-packs/packages/tenant-management/src/lib/states/tenant-management.state.ts
+++ b/npm/ng-packs/packages/tenant-management/src/lib/states/tenant-management.state.ts
@@ -1,15 +1,15 @@
+import { ABP } from '@abp/ng.core';
import { Action, Selector, State, StateContext } from '@ngxs/store';
-import { switchMap, tap } from 'rxjs/operators';
+import { tap } from 'rxjs/operators';
import {
CreateTenant,
DeleteTenant,
- GetTenants,
GetTenantById,
+ GetTenants,
UpdateTenant,
} from '../actions/tenant-management.actions';
import { TenantManagement } from '../models/tenant-management';
import { TenantManagementService } from '../services/tenant-management.service';
-import { ABP } from '@abp/ng.core';
@State({
name: 'TenantManagementState',
From 447237426e69cf642820c435d6d03ffab2b2ea09 Mon Sep 17 00:00:00 2001
From: YinChang
Date: Sun, 8 Dec 2019 17:43:23 +0800
Subject: [PATCH 037/105] modify several module's SettingDefinitionProvider to
support multi-lingual
---
.../Volo.Abp.Emailing.csproj | 10 ++++++
.../Volo/Abp/Emailing/AbpEmailingModule.cs | 10 ++++++
.../Volo/Abp/Emailing/EmailSettingProvider.cs | 24 ++++++++-----
.../Emailing/Localization/EmailingResource.cs | 10 ++++++
.../Volo/Abp/Emailing/Localization/en.json | 23 ++++++++++++
.../Abp/Emailing/Localization/zh-Hans.json | 23 ++++++++++++
.../LocalizationSettingProvider.cs | 9 +++--
.../Resources/AbpValidation/en.json | 4 ++-
.../Resources/AbpValidation/zh-Hans.json | 4 ++-
.../Account/Localization/Resources/en.json | 6 +++-
.../Localization/Resources/zh-Hans.json | 6 +++-
.../AccountSettingDefinitionProvider.cs | 12 +++++--
.../Volo/Abp/Identity/Localization/en.json | 28 ++++++++++++++-
.../Abp/Identity/Localization/zh-Hans.json | 29 ++++++++++++++-
.../AbpIdentitySettingDefinitionProvider.cs | 35 +++++++++++--------
15 files changed, 199 insertions(+), 34 deletions(-)
create mode 100644 framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs
create mode 100644 framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json
create mode 100644 framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json
diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
index 5ed32e6961..51ba1544db 100644
--- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
+++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
@@ -18,6 +18,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
index 55ec63b9ac..b8195ecf09 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BackgroundJobs;
+using Volo.Abp.Emailing.Localization;
using Volo.Abp.Emailing.Templates;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
@@ -30,6 +31,15 @@ namespace Volo.Abp.Emailing
options.FileSets.AddEmbedded();
});
+ Configure(options =>
+ {
+ options.Resources
+ .Add("en")
+ .AddBaseTypes(
+ typeof(EmailingResource)
+ ).AddVirtualJson("/Volo/Abp/Emailing/Localization");
+ });
+
Configure(options =>
{
options.AddJob();
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
index 32d1fb8c1c..8e3ade25a9 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
@@ -1,3 +1,5 @@
+using Volo.Abp.Emailing.Localization;
+using Volo.Abp.Localization;
using Volo.Abp.Settings;
namespace Volo.Abp.Emailing
@@ -11,16 +13,20 @@ namespace Volo.Abp.Emailing
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(EmailSettingNames.Smtp.Host, "127.0.0.1"),
- new SettingDefinition(EmailSettingNames.Smtp.Port, "25"),
- new SettingDefinition(EmailSettingNames.Smtp.UserName),
- new SettingDefinition(EmailSettingNames.Smtp.Password, isEncrypted: true),
- new SettingDefinition(EmailSettingNames.Smtp.Domain),
- new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "false"),
- new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "true"),
- new SettingDefinition(EmailSettingNames.DefaultFromAddress, "noreply@abp.io"),
- new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "ABP application")
+ new SettingDefinition(EmailSettingNames.Smtp.Host, "127.0.0.1", L("DisplayName:Abp.Mailing.Smtp.Host"), L("Description:Abp.Mailing.Smtp.Host")),
+ new SettingDefinition(EmailSettingNames.Smtp.Port, "25", L("DisplayName:Abp.Mailing.Smtp.Port"), L("Description:Abp.Mailing.Smtp.Port")),
+ new SettingDefinition(EmailSettingNames.Smtp.UserName, displayName: L("DisplayName:Abp.Mailing.Smtp.UserName"), description: L("Description:Abp.Mailing.Smtp.UserName")),
+ new SettingDefinition(EmailSettingNames.Smtp.Password, displayName: L("DisplayName:Abp.Mailing.Smtp.Password"), description: L("Description:Abp.Mailing.Smtp.Password"), isEncrypted: true),
+ new SettingDefinition(EmailSettingNames.Smtp.Domain, displayName: L("DisplayName:Abp.Mailing.Smtp.Domain"), description: L("Description:Abp.Mailing.Smtp.Domain")),
+ new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "false", L("DisplayName:Abp.Mailing.Smtp.EnableSsl"), L("Description:Abp.Mailing.Smtp.EnableSsl")),
+ new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "true", L("DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials"), L("Description:Abp.Mailing.Smtp.UseDefaultCredentials")),
+ new SettingDefinition(EmailSettingNames.DefaultFromAddress, "noreply@abp.io", L("DisplayName:Abp.Mailing.DefaultFromAddress"), L("Description:Abp.Mailing.DefaultFromAddress")),
+ new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "ABP application", L("DisplayName:Abp.Mailing.DefaultFromDisplayName"), L("Description:Abp.Mailing.DefaultFromDisplayName"))
);
}
+ private static LocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs
new file mode 100644
index 0000000000..3560c0db26
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs
@@ -0,0 +1,10 @@
+using Volo.Abp.Localization;
+
+namespace Volo.Abp.Emailing.Localization
+{
+ [LocalizationResourceName("AbpEmailing")]
+ public class EmailingResource
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json
new file mode 100644
index 0000000000..6fa4e626ff
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json
@@ -0,0 +1,23 @@
+{
+ "culture": "en",
+ "texts": {
+ "DisplayName:Abp.Mailing.DefaultFromAddress": "Default from address",
+ "DisplayName:Abp.Mailing.DefaultFromDisplayName": "Default from display name",
+ "DisplayName:Abp.Mailing.Smtp.Host": "Host",
+ "DisplayName:Abp.Mailing.Smtp.Port": "Port",
+ "DisplayName:Abp.Mailing.Smtp.UserName": "User name",
+ "DisplayName:Abp.Mailing.Smtp.Password": "Password",
+ "DisplayName:Abp.Mailing.Smtp.Domain": "Domain",
+ "DisplayName:Abp.Mailing.Smtp.EnableSsl": "Enable SSL",
+ "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "Use default credentials",
+ "Description:Abp.Mailing.DefaultFromAddress": "The default from address",
+ "Description:Abp.Mailing.DefaultFromDisplayName": "The default from display name",
+ "Description:Abp.Mailing.Smtp.Host": "The name or IP address of the host used for SMTP transactions.",
+ "Description:Abp.Mailing.Smtp.Port": "The port used for SMTP transactions.",
+ "Description:Abp.Mailing.Smtp.UserName": "User name associated with the credentials.",
+ "Description:Abp.Mailing.Smtp.Password": "The password for the user name associated with the credentials.",
+ "Description:Abp.Mailing.Smtp.Domain": "The domain or computer name that verifies the credentials.",
+ "Description:Abp.Mailing.Smtp.EnableSsl": "Whether the SmtpClient uses Secure Sockets Layer (SSL) to encrypt the connection.",
+ "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Whether the DefaultCredentials are sent with requests."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json
new file mode 100644
index 0000000000..0e2d25bff1
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json
@@ -0,0 +1,23 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "DisplayName:Abp.Mailing.DefaultFromAddress": "默认发件人地址",
+ "DisplayName:Abp.Mailing.DefaultFromDisplayName": "默认发件人名字",
+ "DisplayName:Abp.Mailing.Smtp.Host": "主机",
+ "DisplayName:Abp.Mailing.Smtp.Port": "端口",
+ "DisplayName:Abp.Mailing.Smtp.UserName": "用户名",
+ "DisplayName:Abp.Mailing.Smtp.Password": "密码",
+ "DisplayName:Abp.Mailing.Smtp.Domain": "域",
+ "DisplayName:Abp.Mailing.Smtp.EnableSsl": "启用SSL",
+ "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "使用默认凭据",
+ "Description:Abp.Mailing.DefaultFromAddress": "默认的发件人地址.",
+ "Description:Abp.Mailing.DefaultFromDisplayName": "默认的发件人名字.",
+ "Description:Abp.Mailing.Smtp.Host": "SMTP 事务的主机名或主机 IP 地址.",
+ "Description:Abp.Mailing.Smtp.Port": "SMTP 事务的端口.",
+ "Description:Abp.Mailing.Smtp.UserName": "凭据关联的用户名.",
+ "Description:Abp.Mailing.Smtp.Password": "凭据关联的用户名的密码.",
+ "Description:Abp.Mailing.Smtp.Domain": "验证凭据的域名或计算机名.",
+ "Description:Abp.Mailing.Smtp.EnableSsl": "指定 SmtpClient 是否使用安全套接字层 (SSL) 加密连接.",
+ "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "控制默认凭据是否随请求一起发送."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs
index c748156506..8b0ef51029 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.Settings;
+using Volo.Abp.Localization.Resources.AbpValidation;
+using Volo.Abp.Settings;
namespace Volo.Abp.Localization
{
@@ -7,8 +8,12 @@ namespace Volo.Abp.Localization
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(LocalizationSettingNames.DefaultLanguage, "en", isVisibleToClients: true)
+ new SettingDefinition(LocalizationSettingNames.DefaultLanguage, "en", L("DisplayName:Abp.Localization.DefaultLanguage"), L("Description:Abp.Localization.DefaultLanguage"), isVisibleToClients: true)
);
}
+ private static LocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json
index b6ff1bb26c..417dfcd8c9 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json
@@ -29,6 +29,8 @@
"ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "This field must be a string with a maximum length of {0}.",
"ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "This field must be a string with a minimum length of {1} and a maximum length of {0}.",
"ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "This field is not a valid fully-qualified http, https, or ftp URL.",
- "ThisFieldIsInvalid.": "This field is invalid."
+ "ThisFieldIsInvalid.": "This field is invalid.",
+ "DisplayName:Abp.Localization.DefaultLanguage": "Default language",
+ "Description:Abp.Localization.DefaultLanguage": "The default language of the application."
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
index d56c893c38..3731d6d01e 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
@@ -29,6 +29,8 @@
"ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "字段必须是长度为{0}的字符串.",
"ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "字段必须是最小长度为{1}并且最大长度{*}的字符串.",
"ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "字段{0}不是有效的完全限定的http,https或ftp URL.",
- "ThisFieldIsInvalid.": "字段是无效值."
+ "ThisFieldIsInvalid.": "字段是无效值.",
+ "DisplayName:Abp.Localization.DefaultLanguage": "默认语言",
+ "Description:Abp.Localization.DefaultLanguage": "应用程序默认语言."
}
}
\ No newline at end of file
diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
index bc507158b1..1f8c0f2eca 100644
--- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
+++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
@@ -35,6 +35,10 @@
"PasswordChanged": "Password changed",
"NewPasswordConfirmFailed": "Please confirm the new password.",
"Manage": "Manage",
- "ManageYourProfile": "Manage your profile"
+ "ManageYourProfile": "Manage your profile",
+ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Is self-registration enabled",
+ "Description:Abp.Account.IsSelfRegistrationEnabled": "Whether a user can register the account by him or herself.",
+ "DisplayName:Abp.Account.EnableLocalLogin": "Authenticate with a local account",
+ "Description:Abp.Account.EnableLocalLogin": "Indicates if Server will allow users to authenticate with a local account."
}
}
\ No newline at end of file
diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
index 1db38474ae..044041f026 100644
--- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
+++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
@@ -35,6 +35,10 @@
"PasswordChanged": "修改密码",
"NewPasswordConfirmFailed": "请确认新密码",
"Manage": "管理",
- "ManageYourProfile": "管理你的个人资料"
+ "ManageYourProfile": "管理你的个人资料",
+ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "启用自行注册",
+ "Description:Abp.Account.IsSelfRegistrationEnabled": "是否允许用户自行注册帐户.",
+ "DisplayName:Abp.Account.EnableLocalLogin": "使用本地帐户进行身份验证",
+ "Description:Abp.Account.EnableLocalLogin": "伺服器是否将允许用户使用本地帐户进行身份验证。"
}
}
diff --git a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
index be16fa7045..1a613704f7 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
@@ -1,4 +1,6 @@
-using Volo.Abp.Settings;
+using Volo.Abp.Account.Localization;
+using Volo.Abp.Localization;
+using Volo.Abp.Settings;
namespace Volo.Abp.Account.Web.Settings
{
@@ -7,12 +9,16 @@ namespace Volo.Abp.Account.Web.Settings
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true")
+ new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true", L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"), L("Description:Abp.Account.IsSelfRegistrationEnabled"))
);
context.Add(
- new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true")
+ new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true", L("DisplayName:Abp.Account.EnableLocalLogin"), L("Description:Abp.Account.EnableLocalLogin"))
);
}
+ private static LocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
}
}
\ No newline at end of file
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json
index 5b5927b9a1..e7a038fd57 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json
+++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json
@@ -71,6 +71,32 @@
"Permission:Delete": "Delete",
"Permission:ChangePermissions": "Change permissions",
"Permission:UserManagement": "User management",
- "Permission:UserLookup": "User lookup"
+ "Permission:UserLookup": "User lookup",
+ "DisplayName:Abp.Identity.Password.RequiredLength": "Required length",
+ "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "Required unique characters number",
+ "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "Required non-alphanumeric character",
+ "DisplayName:Abp.Identity.Password.RequireLowercase": "Required lower case character",
+ "DisplayName:Abp.Identity.Password.RequireUppercase": "Required upper case character",
+ "DisplayName:Abp.Identity.Password.RequireDigit": "Required digit",
+ "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Allowed for new users",
+ "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Lockout duration(seconds)",
+ "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max failed access attempts",
+ "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "Require confirmed email",
+ "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "Require confirmed phoneNumber",
+ "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "Is username update enabled",
+ "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "Is email update enabled",
+ "Description:Abp.Identity.Password.RequiredLength": "The minimum length a password must be.",
+ "Description:Abp.Identity.Password.RequiredUniqueChars": "The minimum number of unique characters which a password must contain.",
+ "Description:Abp.Identity.Password.RequireNonAlphanumeric": "If passwords must contain a non-alphanumeric character.",
+ "Description:Abp.Identity.Password.RequireLowercase": "If passwords must contain a lower case ASCII character.",
+ "Description:Abp.Identity.Password.RequireUppercase": "If passwords must contain a upper case ASCII character.",
+ "Description:Abp.Identity.Password.RequireDigit": "If passwords must contain a digit.",
+ "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Whether a new user can be locked out.",
+ "Description:Abp.Identity.Lockout.LockoutDuration": "The duration a user is locked out for when a lockout occurs.",
+ "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "The number of failed access attempts allowed before a user is locked out, assuming lock out is enabled.",
+ "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "Whether a confirmed email address is required to sign in.",
+ "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "Whether a confirmed telephone number is required to sign in.",
+ "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "Whether the username can be updated by the user.",
+ "Description:Abp.Identity.User.IsEmailUpdateEnabled": "Whether the email can be updated by the user."
}
}
\ No newline at end of file
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json
index 28786b8767..f57029eb9e 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json
+++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json
@@ -71,6 +71,33 @@
"Permission:Delete": "删除",
"Permission:ChangePermissions": "更改权限",
"Permission:UserManagement": "用户管理",
- "Permission:UserLookup": "用户查询"
+ "Permission:UserLookup": "用户查询",
+ "DisplayName:Abp.Identity.Password.RequiredLength": "要求长度",
+ "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "要求唯一字符数量",
+ "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "要求非字母数字",
+ "DisplayName:Abp.Identity.Password.RequireLowercase": "要求小写字母",
+ "DisplayName:Abp.Identity.Password.RequireUppercase": "要求大写字母",
+ "DisplayName:Abp.Identity.Password.RequireDigit": "要求数字",
+ "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "允许新用户",
+ "DisplayName:Abp.Identity.Lockout.LockoutDuration": "锁定时间(秒)",
+ "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "最大失败访问尝试次数",
+ "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "要求验证的电子邮箱",
+ "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "要求验证的电话号码",
+ "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "启用用户名更新",
+ "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "启用电子邮箱更新",
+ "Description:Abp.Identity.Password.RequiredLength": "密码的最小长度.",
+ "Description:Abp.Identity.Password.RequiredUniqueChars": "密码必须包含唯一字符的数量.",
+ "Description:Abp.Identity.Password.RequireNonAlphanumeric": "密码是否必须包含非字母数字.",
+ "Description:Abp.Identity.Password.RequireLowercase": "密码是否必须包含小写字母.",
+ "Description:Abp.Identity.Password.RequireUppercase": "密码是否必须包含大写字母.",
+ "Description:Abp.Identity.Password.RequireDigit": "密码是否必须包含数字.",
+ "Description:Abp.Identity.Lockout.AllowedForNewUsers": "允许新用户被锁定.",
+ "Description:Abp.Identity.Lockout.LockoutDuration": "当锁定发生时用户被的锁定的时间(秒).",
+ "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "如果启用锁定, 当用户被锁定前失败的访问尝试次数.",
+ "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "登录时是否需要验证的电子邮箱.",
+ "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "登录时是否需要验证的电话号码.",
+ "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "是否允许用户更新用户名.",
+ "Description:Abp.Identity.User.IsEmailUpdateEnabled": "是否允许用户更新电子邮箱."
+
}
}
\ No newline at end of file
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
index 0edeacf848..faf6c5b5dd 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
@@ -1,4 +1,6 @@
-using Volo.Abp.Identity.Settings;
+using Volo.Abp.Identity.Localization;
+using Volo.Abp.Identity.Settings;
+using Volo.Abp.Localization;
using Volo.Abp.Settings;
namespace Volo.Abp.Identity
@@ -8,23 +10,28 @@ namespace Volo.Abp.Identity
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(IdentitySettingNames.Password.RequiredLength, 6.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.Password.RequiredUniqueChars, 1.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.Password.RequireNonAlphanumeric, true.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.Password.RequireLowercase, true.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.Password.RequireUppercase, true.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.Password.RequireDigit, true.ToString(), null, null, true),
+ new SettingDefinition(IdentitySettingNames.Password.RequiredLength, 6.ToString(), L("DisplayName:Abp.Identity.Password.RequiredLength"), L("Description:Abp.Identity.Password.RequiredLength"), true),
+ new SettingDefinition(IdentitySettingNames.Password.RequiredUniqueChars, 1.ToString(), L("DisplayName:Abp.Identity.Password.RequiredUniqueChars"), L("Description:Abp.Identity.Password.RequiredUniqueChars"), true),
+ new SettingDefinition(IdentitySettingNames.Password.RequireNonAlphanumeric, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireNonAlphanumeric"), L("Description:Abp.Identity.Password.RequireNonAlphanumeric"), true),
+ new SettingDefinition(IdentitySettingNames.Password.RequireLowercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireLowercase"), L("Description:Abp.Identity.Password.RequireLowercase"), true),
+ new SettingDefinition(IdentitySettingNames.Password.RequireUppercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireUppercase"), L("Description:Abp.Identity.Password.RequireUppercase"), true),
+ new SettingDefinition(IdentitySettingNames.Password.RequireDigit, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireDigit"), L("Description:Abp.Identity.Password.RequireDigit"), true),
- new SettingDefinition(IdentitySettingNames.Lockout.AllowedForNewUsers, true.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.Lockout.LockoutDuration, (5*60).ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, 5.ToString(), null, null, true),
+ new SettingDefinition(IdentitySettingNames.Lockout.AllowedForNewUsers, true.ToString(), L("DisplayName:Abp.Identity.Lockout.AllowedForNewUsers"), L("Description:Abp.Identity.Lockout.AllowedForNewUsers"), true),
+ new SettingDefinition(IdentitySettingNames.Lockout.LockoutDuration, (5*60).ToString(), L("DisplayName:Abp.Identity.Lockout.LockoutDuration"), L("Description:Abp.Identity.Lockout.LockoutDuration"), true),
+ new SettingDefinition(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, 5.ToString(), L("DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts"), L("Description:Abp.Identity.Lockout.MaxFailedAccessAttempts"), true),
- new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedEmail, false.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, false.ToString(), null, null, true),
+ new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedEmail, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail"), L("Description:Abp.Identity.SignIn.RequireConfirmedEmail"), true),
+ new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), L("Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), true),
- new SettingDefinition(IdentitySettingNames.User.IsUserNameUpdateEnabled, true.ToString(), null, null, true),
- new SettingDefinition(IdentitySettingNames.User.IsEmailUpdateEnabled, true.ToString(), null, null, true)
+ new SettingDefinition(IdentitySettingNames.User.IsUserNameUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled"), L("Description:Abp.Identity.User.IsUserNameUpdateEnabled"), true),
+ new SettingDefinition(IdentitySettingNames.User.IsEmailUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsEmailUpdateEnabled"), L("Description:Abp.Identity.User.IsEmailUpdateEnabled"), true)
);
}
+ private static LocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
+
}
}
From 49a9eb0a0c2c52aa9739aab8aead9ddc0c835030 Mon Sep 17 00:00:00 2001
From: YinChang
Date: Sat, 14 Dec 2019 08:33:48 +0800
Subject: [PATCH 038/105] configure embedded resources by wildcard
---
framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
index 51ba1544db..aad33abfbc 100644
--- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
+++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
@@ -19,13 +19,11 @@
-
-
+
-
-
+
From 9b502bd69afa7e7dcf67a3013de81a8eaaaadf62 Mon Sep 17 00:00:00 2001
From: YinChang
Date: Mon, 16 Dec 2019 18:08:25 +0800
Subject: [PATCH 039/105] fix EmailingResource's Definition
---
.../Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
index b8195ecf09..c2e29a7ff7 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs
@@ -35,9 +35,7 @@ namespace Volo.Abp.Emailing
{
options.Resources
.Add("en")
- .AddBaseTypes(
- typeof(EmailingResource)
- ).AddVirtualJson("/Volo/Abp/Emailing/Localization");
+ .AddVirtualJson("/Volo/Abp/Emailing/Localization");
});
Configure(options =>
From 97353bf5f9217abb6f6eb85a6d3cbea2713dad10 Mon Sep 17 00:00:00 2001
From: maliming
Date: Tue, 17 Dec 2019 17:41:54 +0800
Subject: [PATCH 040/105] Formatting code.
---
.../Volo.Abp.Emailing.csproj | 3 -
.../Volo/Abp/Emailing/EmailSettingProvider.cs | 60 ++++++++++--
.../LocalizationSettingProvider.cs | 7 +-
.../AccountSettingDefinitionProvider.cs | 13 ++-
.../AbpIdentitySettingDefinitionProvider.cs | 97 +++++++++++++++----
5 files changed, 148 insertions(+), 32 deletions(-)
diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
index aad33abfbc..1bd548e6c2 100644
--- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
+++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
@@ -20,9 +20,6 @@
-
-
-
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
index 8e3ade25a9..0fb3402740 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
@@ -13,17 +13,59 @@ namespace Volo.Abp.Emailing
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(EmailSettingNames.Smtp.Host, "127.0.0.1", L("DisplayName:Abp.Mailing.Smtp.Host"), L("Description:Abp.Mailing.Smtp.Host")),
- new SettingDefinition(EmailSettingNames.Smtp.Port, "25", L("DisplayName:Abp.Mailing.Smtp.Port"), L("Description:Abp.Mailing.Smtp.Port")),
- new SettingDefinition(EmailSettingNames.Smtp.UserName, displayName: L("DisplayName:Abp.Mailing.Smtp.UserName"), description: L("Description:Abp.Mailing.Smtp.UserName")),
- new SettingDefinition(EmailSettingNames.Smtp.Password, displayName: L("DisplayName:Abp.Mailing.Smtp.Password"), description: L("Description:Abp.Mailing.Smtp.Password"), isEncrypted: true),
- new SettingDefinition(EmailSettingNames.Smtp.Domain, displayName: L("DisplayName:Abp.Mailing.Smtp.Domain"), description: L("Description:Abp.Mailing.Smtp.Domain")),
- new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "false", L("DisplayName:Abp.Mailing.Smtp.EnableSsl"), L("Description:Abp.Mailing.Smtp.EnableSsl")),
- new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "true", L("DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials"), L("Description:Abp.Mailing.Smtp.UseDefaultCredentials")),
- new SettingDefinition(EmailSettingNames.DefaultFromAddress, "noreply@abp.io", L("DisplayName:Abp.Mailing.DefaultFromAddress"), L("Description:Abp.Mailing.DefaultFromAddress")),
- new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "ABP application", L("DisplayName:Abp.Mailing.DefaultFromDisplayName"), L("Description:Abp.Mailing.DefaultFromDisplayName"))
+ new SettingDefinition(
+ EmailSettingNames.Smtp.Host,
+ "127.0.0.1",
+ L("DisplayName:Abp.Mailing.Smtp.Host"),
+ L("Description:Abp.Mailing.Smtp.Host")),
+
+ new SettingDefinition(EmailSettingNames.Smtp.Port,
+ "25",
+ L("DisplayName:Abp.Mailing.Smtp.Port"),
+ L("Description:Abp.Mailing.Smtp.Port")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.UserName,
+ displayName: L("DisplayName:Abp.Mailing.Smtp.UserName"),
+ description: L("Description:Abp.Mailing.Smtp.UserName")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.Password,
+ displayName:
+ L("DisplayName:Abp.Mailing.Smtp.Password"),
+ description: L("Description:Abp.Mailing.Smtp.Password"),
+ isEncrypted: true),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.Domain,
+ displayName: L("DisplayName:Abp.Mailing.Smtp.Domain"),
+ description: L("Description:Abp.Mailing.Smtp.Domain")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.EnableSsl,
+ "false",
+ L("DisplayName:Abp.Mailing.Smtp.EnableSsl"),
+ L("Description:Abp.Mailing.Smtp.EnableSsl")),
+
+ new SettingDefinition(
+ EmailSettingNames.Smtp.UseDefaultCredentials,
+ "true",
+ L("DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials"),
+ L("Description:Abp.Mailing.Smtp.UseDefaultCredentials")),
+
+ new SettingDefinition(
+ EmailSettingNames.DefaultFromAddress,
+ "noreply@abp.io",
+ L("DisplayName:Abp.Mailing.DefaultFromAddress"),
+ L("Description:Abp.Mailing.DefaultFromAddress")),
+
+ new SettingDefinition(EmailSettingNames.DefaultFromDisplayName,
+ "ABP application",
+ L("DisplayName:Abp.Mailing.DefaultFromDisplayName"),
+ L("Description:Abp.Mailing.DefaultFromDisplayName"))
);
}
+
private static LocalizableString L(string name)
{
return LocalizableString.Create(name);
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs
index 8b0ef51029..14afe69dac 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs
@@ -8,9 +8,14 @@ namespace Volo.Abp.Localization
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(LocalizationSettingNames.DefaultLanguage, "en", L("DisplayName:Abp.Localization.DefaultLanguage"), L("Description:Abp.Localization.DefaultLanguage"), isVisibleToClients: true)
+ new SettingDefinition(LocalizationSettingNames.DefaultLanguage,
+ "en",
+ L("DisplayName:Abp.Localization.DefaultLanguage"),
+ L("Description:Abp.Localization.DefaultLanguage"),
+ isVisibleToClients: true)
);
}
+
private static LocalizableString L(string name)
{
return LocalizableString.Create(name);
diff --git a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
index 1a613704f7..53c2df6fbd 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
@@ -9,13 +9,22 @@ namespace Volo.Abp.Account.Web.Settings
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true", L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"), L("Description:Abp.Account.IsSelfRegistrationEnabled"))
+ new SettingDefinition(
+ AccountSettingNames.IsSelfRegistrationEnabled,
+ "true",
+ L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"),
+ L("Description:Abp.Account.IsSelfRegistrationEnabled"))
);
context.Add(
- new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true", L("DisplayName:Abp.Account.EnableLocalLogin"), L("Description:Abp.Account.EnableLocalLogin"))
+ new SettingDefinition(
+ AccountSettingNames.EnableLocalLogin,
+ "true",
+ L("DisplayName:Abp.Account.EnableLocalLogin"),
+ L("Description:Abp.Account.EnableLocalLogin"))
);
}
+
private static LocalizableString L(string name)
{
return LocalizableString.Create(name);
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
index faf6c5b5dd..efae6e467a 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
@@ -10,28 +10,91 @@ namespace Volo.Abp.Identity
public override void Define(ISettingDefinitionContext context)
{
context.Add(
- new SettingDefinition(IdentitySettingNames.Password.RequiredLength, 6.ToString(), L("DisplayName:Abp.Identity.Password.RequiredLength"), L("Description:Abp.Identity.Password.RequiredLength"), true),
- new SettingDefinition(IdentitySettingNames.Password.RequiredUniqueChars, 1.ToString(), L("DisplayName:Abp.Identity.Password.RequiredUniqueChars"), L("Description:Abp.Identity.Password.RequiredUniqueChars"), true),
- new SettingDefinition(IdentitySettingNames.Password.RequireNonAlphanumeric, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireNonAlphanumeric"), L("Description:Abp.Identity.Password.RequireNonAlphanumeric"), true),
- new SettingDefinition(IdentitySettingNames.Password.RequireLowercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireLowercase"), L("Description:Abp.Identity.Password.RequireLowercase"), true),
- new SettingDefinition(IdentitySettingNames.Password.RequireUppercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireUppercase"), L("Description:Abp.Identity.Password.RequireUppercase"), true),
- new SettingDefinition(IdentitySettingNames.Password.RequireDigit, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireDigit"), L("Description:Abp.Identity.Password.RequireDigit"), true),
-
- new SettingDefinition(IdentitySettingNames.Lockout.AllowedForNewUsers, true.ToString(), L("DisplayName:Abp.Identity.Lockout.AllowedForNewUsers"), L("Description:Abp.Identity.Lockout.AllowedForNewUsers"), true),
- new SettingDefinition(IdentitySettingNames.Lockout.LockoutDuration, (5*60).ToString(), L("DisplayName:Abp.Identity.Lockout.LockoutDuration"), L("Description:Abp.Identity.Lockout.LockoutDuration"), true),
- new SettingDefinition(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, 5.ToString(), L("DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts"), L("Description:Abp.Identity.Lockout.MaxFailedAccessAttempts"), true),
-
- new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedEmail, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail"), L("Description:Abp.Identity.SignIn.RequireConfirmedEmail"), true),
- new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), L("Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), true),
-
- new SettingDefinition(IdentitySettingNames.User.IsUserNameUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled"), L("Description:Abp.Identity.User.IsUserNameUpdateEnabled"), true),
- new SettingDefinition(IdentitySettingNames.User.IsEmailUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsEmailUpdateEnabled"), L("Description:Abp.Identity.User.IsEmailUpdateEnabled"), true)
+ new SettingDefinition(
+ IdentitySettingNames.Password.RequiredLength,
+ 6.ToString(),
+ L("DisplayName:Abp.Identity.Password.RequiredLength"),
+ L("Description:Abp.Identity.Password.RequiredLength"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Password.RequiredUniqueChars,
+ 1.ToString(),
+ L("DisplayName:Abp.Identity.Password.RequiredUniqueChars"),
+ L("Description:Abp.Identity.Password.RequiredUniqueChars"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Password.RequireNonAlphanumeric,
+ true.ToString(),
+ L("DisplayName:Abp.Identity.Password.RequireNonAlphanumeric"),
+ L("Description:Abp.Identity.Password.RequireNonAlphanumeric"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Password.RequireLowercase,
+ true.ToString(), L("DisplayName:Abp.Identity.Password.RequireLowercase"),
+ L("Description:Abp.Identity.Password.RequireLowercase"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Password.RequireUppercase,
+ true.ToString(), L("DisplayName:Abp.Identity.Password.RequireUppercase"),
+ L("Description:Abp.Identity.Password.RequireUppercase"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Password.RequireDigit,
+ true.ToString(), L("DisplayName:Abp.Identity.Password.RequireDigit"),
+ L("Description:Abp.Identity.Password.RequireDigit"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Lockout.AllowedForNewUsers,
+ true.ToString(), L("DisplayName:Abp.Identity.Lockout.AllowedForNewUsers"),
+ L("Description:Abp.Identity.Lockout.AllowedForNewUsers"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Lockout.LockoutDuration,
+ (5*60).ToString(), L("DisplayName:Abp.Identity.Lockout.LockoutDuration"),
+ L("Description:Abp.Identity.Lockout.LockoutDuration"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.Lockout.MaxFailedAccessAttempts,
+ 5.ToString(), L("DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts"),
+ L("Description:Abp.Identity.Lockout.MaxFailedAccessAttempts"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.SignIn.RequireConfirmedEmail,
+ false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail"),
+ L("Description:Abp.Identity.SignIn.RequireConfirmedEmail"),
+ true),
+ new SettingDefinition(
+ IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber,
+ false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"),
+ L("Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.User.IsUserNameUpdateEnabled,
+ true.ToString(), L("DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled"),
+ L("Description:Abp.Identity.User.IsUserNameUpdateEnabled"),
+ true),
+
+ new SettingDefinition(
+ IdentitySettingNames.User.IsEmailUpdateEnabled,
+ true.ToString(), L("DisplayName:Abp.Identity.User.IsEmailUpdateEnabled"),
+ L("Description:Abp.Identity.User.IsEmailUpdateEnabled"),
+ true)
);
}
+
private static LocalizableString L(string name)
{
return LocalizableString.Create(name);
}
-
}
}
From 87eb1891f5c1193f5b12c6d3ff2cc75d2c80fdc5 Mon Sep 17 00:00:00 2001
From: maliming
Date: Tue, 17 Dec 2019 17:52:32 +0800
Subject: [PATCH 041/105] Change some simplified Chinese translations.
---
.../Abp/Localization/Resources/AbpValidation/zh-Hans.json | 4 ++--
.../Volo/Abp/Account/Localization/Resources/zh-Hans.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
index 3731d6d01e..5e535d5b67 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
@@ -29,8 +29,8 @@
"ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "字段必须是长度为{0}的字符串.",
"ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "字段必须是最小长度为{1}并且最大长度{*}的字符串.",
"ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "字段{0}不是有效的完全限定的http,https或ftp URL.",
- "ThisFieldIsInvalid.": "字段是无效值.",
+ "ThisFieldIsInvalid.": "该字段无效.",
"DisplayName:Abp.Localization.DefaultLanguage": "默认语言",
- "Description:Abp.Localization.DefaultLanguage": "应用程序默认语言."
+ "Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言."
}
}
\ No newline at end of file
diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
index 044041f026..391dee0531 100644
--- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
+++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
@@ -39,6 +39,6 @@
"DisplayName:Abp.Account.IsSelfRegistrationEnabled": "启用自行注册",
"Description:Abp.Account.IsSelfRegistrationEnabled": "是否允许用户自行注册帐户.",
"DisplayName:Abp.Account.EnableLocalLogin": "使用本地帐户进行身份验证",
- "Description:Abp.Account.EnableLocalLogin": "伺服器是否将允许用户使用本地帐户进行身份验证。"
+ "Description:Abp.Account.EnableLocalLogin": "服务器是否将允许用户使用本地帐户进行身份验证。"
}
}
From 3ba06fe0227b86099f3aa718b5d3976bb0e4bbe0 Mon Sep 17 00:00:00 2001
From: YinChang
Date: Sat, 21 Dec 2019 13:30:08 +0800
Subject: [PATCH 042/105] move AbpValidationResource to Volo.Abp.Validation
from Volo.Abp.Localization
---
.../Volo.Abp.Localization.csproj | 1 +
.../Abp/Localization/AbpLocalizationModule.cs | 11 ++++++++--
.../AbpLocalizationResource.cs | 10 ++++++++++
.../Resources/AbpLocalization/en.json | 7 +++++++
.../Resources/AbpLocalization/zh-Hans.json | 7 +++++++
.../AbpValidation/AbpValidationResource.cs | 5 ++++-
.../Volo.Abp.Validation.csproj | 8 +++++++-
.../Abp/Validation/AbpValidationModule.cs | 20 +++++++++++++++++++
.../Localization/AbpValidationResource.cs | 10 ++++++++++
.../Volo/Abp/Validation/Localization}/cs.json | 0
.../Volo/Abp/Validation/Localization}/en.json | 4 +---
.../Volo/Abp/Validation/Localization}/es.json | 0
.../Volo/Abp/Validation/Localization}/pl.json | 0
.../Abp/Validation/Localization}/pt-BR.json | 0
.../Volo/Abp/Validation/Localization}/tr.json | 0
.../Volo/Abp/Validation/Localization}/vi.json | 0
.../Abp/Validation/Localization}/zh-Hans.json | 4 +---
17 files changed, 77 insertions(+), 10 deletions(-)
create mode 100644 framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs
create mode 100644 framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json
create mode 100644 framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json
create mode 100644 framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/cs.json (100%)
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/en.json (93%)
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/es.json (100%)
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/pl.json (100%)
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/pt-BR.json (100%)
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/tr.json (100%)
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/vi.json (100%)
rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/zh-Hans.json (93%)
diff --git a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj
index 65ceed101e..3bc8eafb11 100644
--- a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj
+++ b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj
@@ -14,6 +14,7 @@
+
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs
index 60df66feec..175e3f9d12 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.Localization.Resources.AbpValidation;
+using Volo.Abp.Localization.Resources.AbpLocalization;
+using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.Settings;
using Volo.Abp.VirtualFileSystem;
@@ -27,10 +28,16 @@ namespace Volo.Abp.Localization
.Resources
.Add("en");
+ //TODO: Obsolete, Remove in the future version
options
.Resources
.Add("en")
- .AddVirtualJson("/Localization/Resources/AbpValidation");
+ .AddVirtualJson("/Volo/Abp/Validation/Localization");//load from Volo.Abp.Validation
+
+ options
+ .Resources
+ .Add("en")
+ .AddVirtualJson("/Localization/Resources/AbpLocalization");
});
}
}
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs
new file mode 100644
index 0000000000..abfd1688b7
--- /dev/null
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Volo.Abp.Localization.Resources.AbpLocalization
+{
+ [LocalizationResourceName("AbpLocalization")]
+ public class AbpLocalizationResource
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json
new file mode 100644
index 0000000000..aee47a44b6
--- /dev/null
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json
@@ -0,0 +1,7 @@
+{
+ "culture": "en",
+ "texts": {
+ "DisplayName:Abp.Localization.DefaultLanguage": "Default language",
+ "Description:Abp.Localization.DefaultLanguage": "The default language of the application."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json
new file mode 100644
index 0000000000..7167aac9fd
--- /dev/null
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json
@@ -0,0 +1,7 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "DisplayName:Abp.Localization.DefaultLanguage": "默认语言",
+ "Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs
index 667244886c..5d0151fe66 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs
+++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs
@@ -1,8 +1,11 @@
-namespace Volo.Abp.Localization.Resources.AbpValidation
+using System;
+
+namespace Volo.Abp.Localization.Resources.AbpValidation
{
//TODO: Move to Volo.Abp.Validation!
[LocalizationResourceName("AbpValidation")]
+ [Obsolete("This resource is obsolete.Use Volo.Abp.Validation.Localization.AbpValidationResource instead.", false)]
public class AbpValidationResource
{
diff --git a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj
index c8cc738e98..9e1e81b1d9 100644
--- a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj
+++ b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj
@@ -1,4 +1,4 @@
-
+
@@ -13,8 +13,14 @@
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
index bb2d41f927..ad2be911de 100644
--- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
@@ -1,10 +1,16 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Localization;
using Volo.Abp.Modularity;
+using Volo.Abp.Validation.Localization;
+using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.Validation
{
+ [DependsOn(
+ typeof(AbpLocalizationModule)
+ )]
public class AbpValidationModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
@@ -12,6 +18,20 @@ namespace Volo.Abp.Validation
context.Services.OnRegistred(ValidationInterceptorRegistrar.RegisterIfNeeded);
AutoAddObjectValidationContributors(context.Services);
}
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Add("en")
+ .AddVirtualJson("/Volo/Abp/Validation/Localization");
+ });
+ }
private static void AutoAddObjectValidationContributors(IServiceCollection services)
{
diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs
new file mode 100644
index 0000000000..0de105747d
--- /dev/null
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs
@@ -0,0 +1,10 @@
+using Volo.Abp.Localization;
+
+namespace Volo.Abp.Validation.Localization
+{
+ [LocalizationResourceName("AbpValidation")]
+ public class AbpValidationResource
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/cs.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/cs.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json
similarity index 93%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json
index 417dfcd8c9..b6ff1bb26c 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json
@@ -29,8 +29,6 @@
"ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "This field must be a string with a maximum length of {0}.",
"ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "This field must be a string with a minimum length of {1} and a maximum length of {0}.",
"ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "This field is not a valid fully-qualified http, https, or ftp URL.",
- "ThisFieldIsInvalid.": "This field is invalid.",
- "DisplayName:Abp.Localization.DefaultLanguage": "Default language",
- "Description:Abp.Localization.DefaultLanguage": "The default language of the application."
+ "ThisFieldIsInvalid.": "This field is invalid."
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/es.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/es.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pl.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pl.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pt-BR.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pt-BR.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/tr.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/tr.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/vi.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json
similarity index 100%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/vi.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json
diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json
similarity index 93%
rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json
index 5e535d5b67..ac0c014967 100644
--- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json
+++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json
@@ -29,8 +29,6 @@
"ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "字段必须是长度为{0}的字符串.",
"ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "字段必须是最小长度为{1}并且最大长度{*}的字符串.",
"ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "字段{0}不是有效的完全限定的http,https或ftp URL.",
- "ThisFieldIsInvalid.": "该字段无效.",
- "DisplayName:Abp.Localization.DefaultLanguage": "默认语言",
- "Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言."
+ "ThisFieldIsInvalid.": "该字段无效."
}
}
\ No newline at end of file
From 88a1c08ee144a1aef7f6bf2b72f8148a5276e2be Mon Sep 17 00:00:00 2001
From: Alper Ebicoglu
Date: Sun, 22 Dec 2019 17:37:57 +0300
Subject: [PATCH 043/105] add login/logout commands.
---
docs/en/CLI.md | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/docs/en/CLI.md b/docs/en/CLI.md
index 57bda25004..a1d3d51138 100644
--- a/docs/en/CLI.md
+++ b/docs/en/CLI.md
@@ -128,6 +128,24 @@ abp update [options]
* `--npm`: Only updates NPM packages.
* `--nuget`: Only updates NuGet packages.
+### login
+
+Some features of the CLI requires to be logged in to abp.io platform. To login with your username write
+
+```bash
+abp login
+```
+
+Notice that, a new login with an already active session, will kill the previous session and creates a new one.
+
+### logout
+
+Logs you out by removing the session token from your computer.
+
+```
+abp logout
+```
+
### help
Writes basic usage information of the CLI.
From 1af300ba18929fa76d5a49edb565d12548ea4127 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Mon, 23 Dec 2019 08:55:50 +0300
Subject: [PATCH 044/105] Add cancellationToken to IPermissionGrantRepository
---
.../IPermissionGrantRepository.cs | 14 +++++++++++--
.../EfCorePermissionGrantRepository.cs | 20 ++++++++++++++-----
.../MongoDb/MongoPermissionGrantRepository.cs | 17 ++++++++++++----
3 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionGrantRepository.cs
index 886d546073..8c0beffd1a 100644
--- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionGrantRepository.cs
+++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionGrantRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@@ -7,8 +8,17 @@ namespace Volo.Abp.PermissionManagement
{
public interface IPermissionGrantRepository : IBasicRepository
{
- Task FindAsync(string name, string providerName, string providerKey);
+ Task FindAsync(
+ string name,
+ string providerName,
+ string providerKey,
+ CancellationToken cancellationToken = default
+ );
- Task> GetListAsync(string providerName, string providerKey);
+ Task> GetListAsync(
+ string providerName,
+ string providerKey,
+ CancellationToken cancellationToken = default
+ );
}
}
\ No newline at end of file
diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs
index 413a960c7c..d8241d6f8f 100644
--- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs
+++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
@@ -8,7 +9,8 @@ using Volo.Abp.EntityFrameworkCore;
namespace Volo.Abp.PermissionManagement.EntityFrameworkCore
{
- public class EfCorePermissionGrantRepository : EfCoreRepository, IPermissionGrantRepository
+ public class EfCorePermissionGrantRepository : EfCoreRepository,
+ IPermissionGrantRepository
{
public EfCorePermissionGrantRepository(IDbContextProvider dbContextProvider)
: base(dbContextProvider)
@@ -16,23 +18,31 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore
}
- public async Task FindAsync(string name, string providerName, string providerKey)
+ public async Task FindAsync(
+ string name,
+ string providerName,
+ string providerKey,
+ CancellationToken cancellationToken = default)
{
return await DbSet
.FirstOrDefaultAsync(s =>
s.Name == name &&
s.ProviderName == providerName &&
- s.ProviderKey == providerKey
+ s.ProviderKey == providerKey,
+ GetCancellationToken(cancellationToken)
);
}
- public async Task> GetListAsync(string providerName, string providerKey)
+ public async Task> GetListAsync(
+ string providerName,
+ string providerKey,
+ CancellationToken cancellationToken = default)
{
return await DbSet
.Where(s =>
s.ProviderName == providerName &&
s.ProviderKey == providerKey
- ).ToListAsync();
+ ).ToListAsync(GetCancellationToken(cancellationToken));
}
}
}
diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs
index 70614c890d..67befaa717 100644
--- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs
+++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
@@ -16,23 +17,31 @@ namespace Volo.Abp.PermissionManagement.MongoDB
}
- public async Task FindAsync(string name, string providerName, string providerKey)
+ public async Task FindAsync(
+ string name,
+ string providerName,
+ string providerKey,
+ CancellationToken cancellationToken = default)
{
return await GetMongoQueryable()
.FirstOrDefaultAsync(s =>
s.Name == name &&
s.ProviderName == providerName &&
- s.ProviderKey == providerKey
+ s.ProviderKey == providerKey,
+ GetCancellationToken(cancellationToken)
);
}
- public async Task> GetListAsync(string providerName, string providerKey)
+ public async Task> GetListAsync(
+ string providerName,
+ string providerKey,
+ CancellationToken cancellationToken = default)
{
return await GetMongoQueryable()
.Where(s =>
s.ProviderName == providerName &&
s.ProviderKey == providerKey
- ).ToListAsync();
+ ).ToListAsync(GetCancellationToken(cancellationToken));
}
}
}
\ No newline at end of file
From 2b2e0be51d9fb37188348f390b56df286de7a6bc Mon Sep 17 00:00:00 2001
From: mehmet-erim
Date: Mon, 23 Dec 2019 10:37:16 +0300
Subject: [PATCH 045/105] fix(core): fix flattedRoutes manipulation
---
npm/ng-packs/packages/core/src/lib/states/config.state.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/npm/ng-packs/packages/core/src/lib/states/config.state.ts b/npm/ng-packs/packages/core/src/lib/states/config.state.ts
index a32a101de2..1e959b3e54 100644
--- a/npm/ng-packs/packages/core/src/lib/states/config.state.ts
+++ b/npm/ng-packs/packages/core/src/lib/states/config.state.ts
@@ -229,7 +229,7 @@ export class ConfigState {
const index = flattedRoutes.findIndex(route => route.name === name);
if (index > -1) {
- flattedRoutes[index] = newValue as ABP.FullRoute;
+ flattedRoutes[index] = { ...flattedRoutes[index], ...newValue } as ABP.FullRoute;
}
return patchState({
From 8dd751bc215b6407a74c69e56229513d5bd56c88 Mon Sep 17 00:00:00 2001
From: mehmet-erim
Date: Mon, 23 Dec 2019 10:41:02 +0300
Subject: [PATCH 046/105] tests(core): add AddRotue tests
---
.../core/src/lib/tests/config.state.spec.ts | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts
index 1fd2e45b35..e811204883 100644
--- a/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts
+++ b/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts
@@ -373,6 +373,59 @@ describe('ConfigState', () => {
url: '/',
children: [{ path: 'dashboard', name: 'Dashboard', url: '/dashboard' }],
});
+ describe('#AddRoute', () => {
+ const newRoute = {
+ name: 'My new page',
+ iconClass: 'fa fa-dashboard',
+ path: 'page',
+ invisible: false,
+ order: 2,
+ requiredPolicy: 'MyProjectName::MyNewPage',
+ } as Omit;
+
+ test('should add a new route', () => {
+ let patchStateArg;
+
+ const patchState = jest.fn(s => (patchStateArg = s));
+ const getState = jest.fn(() => clone(CONFIG_STATE_DATA));
+
+ state.addRoute({ patchState, getState } as any, new AddRoute(newRoute));
+
+ expect(patchStateArg.routes[CONFIG_STATE_DATA.routes.length]).toEqual({
+ ...newRoute,
+ url: '/page',
+ });
+ expect(patchStateArg.flattedRoutes[CONFIG_STATE_DATA.flattedRoutes.length]).toEqual(
+ patchStateArg.routes[CONFIG_STATE_DATA.routes.length],
+ );
+ });
+
+ it('should add a new child route', () => {
+ let patchStateArg;
+
+ const patchState = jest.fn(s => (patchStateArg = s));
+ const getState = jest.fn(() => clone(CONFIG_STATE_DATA));
+
+ state.addRoute(
+ { patchState, getState } as any,
+ new AddRoute({ ...newRoute, parentName: 'AbpAccount::Login' }),
+ );
+
+ expect(patchStateArg.routes[1].children[0].children[0]).toEqual({
+ ...newRoute,
+ parentName: 'AbpAccount::Login',
+ url: '/account/login/page',
+ });
+
+ expect(patchStateArg.flattedRoutes[CONFIG_STATE_DATA.flattedRoutes.length]).toEqual(
+ patchStateArg.routes[1].children[0].children[0],
+ );
+
+ expect(
+ patchStateArg.flattedRoutes[
+ CONFIG_STATE_DATA.flattedRoutes.findIndex(route => route.name === 'AbpAccount::Login')
+ ],
+ ).toEqual(patchStateArg.routes[1].children[0]);
});
});
});
From a7e44b739cf8338843cd2ef6a012150438906a92 Mon Sep 17 00:00:00 2001
From: mehmet-erim
Date: Mon, 23 Dec 2019 10:42:03 +0300
Subject: [PATCH 047/105] tests(core): fix tests in the config.state.spec
---
.../core/src/lib/tests/config.state.spec.ts | 154 +++++++++---------
1 file changed, 76 insertions(+), 78 deletions(-)
diff --git a/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts
index e811204883..635ca1d8b1 100644
--- a/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts
+++ b/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts
@@ -1,17 +1,12 @@
-import {
- createServiceFactory,
- SpectatorService,
- SpyObject,
-} from '@ngneat/spectator/jest';
+import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest';
import { Store } from '@ngxs/store';
import { ReplaySubject, timer, Subject, of } from 'rxjs';
import { Config } from '../models/config';
-import {
- ApplicationConfigurationService,
- ConfigStateService,
-} from '../services';
+import { ApplicationConfigurationService, ConfigStateService } from '../services';
import { ConfigState } from '../states';
-import { SetLanguage, PatchRouteByName } from '../actions';
+import { SetLanguage, PatchRouteByName, AddRoute } from '../actions';
+import clone from 'just-clone';
+import { ABP } from '../models';
export const CONFIG_STATE_DATA = {
environment: {
@@ -55,6 +50,7 @@ export const CONFIG_STATE_DATA = {
name: 'AbpAccount::Login',
order: 1,
url: '/account/login',
+ parentName: 'AbpAccount::Menu:Account',
},
],
url: '/account',
@@ -68,10 +64,27 @@ export const CONFIG_STATE_DATA = {
url: '/',
},
{
- name: '::Menu:Identity',
- path: 'identity',
- children: [],
- url: '/identity',
+ name: 'AbpAccount::Menu:Account',
+ path: 'account',
+ invisible: true,
+ layout: 'application',
+ children: [
+ {
+ path: 'login',
+ name: 'AbpAccount::Login',
+ order: 1,
+ url: '/account/login',
+ parentName: 'AbpAccount::Menu:Account',
+ },
+ ],
+ url: '/account',
+ },
+ {
+ path: 'login',
+ name: 'AbpAccount::Login',
+ order: 1,
+ url: '/account/login',
+ parentName: 'AbpAccount::Menu:Account',
},
],
localization: {
@@ -134,10 +147,7 @@ describe('ConfigState', () => {
store = spectator.get(Store);
service = spectator.service;
appConfigService = spectator.get(ApplicationConfigurationService);
- state = new ConfigState(
- spectator.get(ApplicationConfigurationService),
- store,
- );
+ state = new ConfigState(spectator.get(ApplicationConfigurationService), store);
});
describe('#getAll', () => {
@@ -165,16 +175,12 @@ describe('ConfigState', () => {
describe('#getDeep', () => {
it('should return deeper', () => {
expect(
- ConfigState.getDeep('environment.localization.defaultResourceName')(
- CONFIG_STATE_DATA,
- ),
+ ConfigState.getDeep('environment.localization.defaultResourceName')(CONFIG_STATE_DATA),
).toEqual(CONFIG_STATE_DATA.environment.localization.defaultResourceName);
expect(
- ConfigState.getDeep([
- 'environment',
- 'localization',
- 'defaultResourceName',
- ])(CONFIG_STATE_DATA),
+ ConfigState.getDeep(['environment', 'localization', 'defaultResourceName'])(
+ CONFIG_STATE_DATA,
+ ),
).toEqual(CONFIG_STATE_DATA.environment.localization.defaultResourceName);
expect(ConfigState.getDeep('test')(null)).toBeFalsy();
@@ -183,10 +189,10 @@ describe('ConfigState', () => {
describe('#getRoute', () => {
it('should return route', () => {
- expect(
- ConfigState.getRoute(null, '::Menu:Home')(CONFIG_STATE_DATA),
- ).toEqual(CONFIG_STATE_DATA.flattedRoutes[0]);
- expect(ConfigState.getRoute('identity')(CONFIG_STATE_DATA)).toEqual(
+ expect(ConfigState.getRoute(null, '::Menu:Home')(CONFIG_STATE_DATA)).toEqual(
+ CONFIG_STATE_DATA.flattedRoutes[0],
+ );
+ expect(ConfigState.getRoute('account')(CONFIG_STATE_DATA)).toEqual(
CONFIG_STATE_DATA.flattedRoutes[1],
);
});
@@ -205,11 +211,7 @@ describe('ConfigState', () => {
describe('#getSetting', () => {
it('should return a setting', () => {
- expect(
- ConfigState.getSetting('Abp.Localization.DefaultLanguage')(
- CONFIG_STATE_DATA,
- ),
- ).toEqual(
+ expect(ConfigState.getSetting('Abp.Localization.DefaultLanguage')(CONFIG_STATE_DATA)).toEqual(
CONFIG_STATE_DATA.setting.values['Abp.Localization.DefaultLanguage'],
);
});
@@ -217,9 +219,7 @@ describe('ConfigState', () => {
describe('#getSettings', () => {
it('should return settings', () => {
- expect(
- ConfigState.getSettings('Localization')(CONFIG_STATE_DATA),
- ).toEqual({
+ expect(ConfigState.getSettings('Localization')(CONFIG_STATE_DATA)).toEqual({
'Abp.Localization.DefaultLanguage': 'en',
});
@@ -231,45 +231,31 @@ describe('ConfigState', () => {
describe('#getGrantedPolicy', () => {
it('should return a granted policy', () => {
- expect(
- ConfigState.getGrantedPolicy('Abp.Identity')(CONFIG_STATE_DATA),
- ).toBe(false);
- expect(
- ConfigState.getGrantedPolicy('Abp.Identity || Abp.Account')(
- CONFIG_STATE_DATA,
- ),
- ).toBe(true);
- expect(
- ConfigState.getGrantedPolicy('Abp.Account && Abp.Identity')(
- CONFIG_STATE_DATA,
- ),
- ).toBe(false);
- expect(
- ConfigState.getGrantedPolicy('Abp.Account &&')(CONFIG_STATE_DATA),
- ).toBe(false);
- expect(
- ConfigState.getGrantedPolicy('|| Abp.Account')(CONFIG_STATE_DATA),
- ).toBe(false);
+ expect(ConfigState.getGrantedPolicy('Abp.Identity')(CONFIG_STATE_DATA)).toBe(false);
+ expect(ConfigState.getGrantedPolicy('Abp.Identity || Abp.Account')(CONFIG_STATE_DATA)).toBe(
+ true,
+ );
+ expect(ConfigState.getGrantedPolicy('Abp.Account && Abp.Identity')(CONFIG_STATE_DATA)).toBe(
+ false,
+ );
+ expect(ConfigState.getGrantedPolicy('Abp.Account &&')(CONFIG_STATE_DATA)).toBe(false);
+ expect(ConfigState.getGrantedPolicy('|| Abp.Account')(CONFIG_STATE_DATA)).toBe(false);
expect(ConfigState.getGrantedPolicy('')(CONFIG_STATE_DATA)).toBe(true);
});
});
describe('#getLocalization', () => {
it('should return a localization', () => {
- expect(
- ConfigState.getLocalization('AbpIdentity::Identity')(CONFIG_STATE_DATA),
- ).toBe('identity');
+ expect(ConfigState.getLocalization('AbpIdentity::Identity')(CONFIG_STATE_DATA)).toBe(
+ 'identity',
+ );
- expect(
- ConfigState.getLocalization('AbpIdentity::NoIdentity')(
- CONFIG_STATE_DATA,
- ),
- ).toBe('AbpIdentity::NoIdentity');
+ expect(ConfigState.getLocalization('AbpIdentity::NoIdentity')(CONFIG_STATE_DATA)).toBe(
+ 'AbpIdentity::NoIdentity',
+ );
expect(
- ConfigState.getLocalization({ key: '', defaultValue: 'default' })(
- CONFIG_STATE_DATA,
- ),
+ ConfigState.getLocalization({ key: '', defaultValue: 'default' })(CONFIG_STATE_DATA),
).toBe('default');
expect(
@@ -290,9 +276,7 @@ describe('ConfigState', () => {
});
expect(false).toBeTruthy(); // fail
} catch (error) {
- expect((error as Error).message).toContain(
- 'Please check your environment',
- );
+ expect((error as Error).message).toContain('Please check your environment');
}
});
});
@@ -328,11 +312,11 @@ describe('ConfigState', () => {
});
describe('#PatchRouteByName', () => {
- it('should should patch the route', () => {
+ it('should patch the route', () => {
let patchStateArg;
const patchState = jest.fn(s => (patchStateArg = s));
- const getState = jest.fn(() => CONFIG_STATE_DATA);
+ const getState = jest.fn(() => clone(CONFIG_STATE_DATA));
state.patchRoute(
{ patchState, getState } as any,
@@ -347,17 +331,21 @@ describe('ConfigState', () => {
name: 'Home',
path: 'home',
url: '/home',
- children: [
- { path: 'dashboard', name: 'Dashboard', url: '/home/dashboard' },
- ],
+ children: [{ path: 'dashboard', name: 'Dashboard', url: '/home/dashboard' }],
+ });
+ expect(patchStateArg.flattedRoutes[0]).toEqual({
+ name: 'Home',
+ path: 'home',
+ url: '/home',
+ children: [{ path: 'dashboard', name: 'Dashboard', url: '/home/dashboard' }],
});
});
- it('should should patch the route without path', () => {
+ it('should patch the route without path', () => {
let patchStateArg;
const patchState = jest.fn(s => (patchStateArg = s));
- const getState = jest.fn(() => CONFIG_STATE_DATA);
+ const getState = jest.fn(() => clone(CONFIG_STATE_DATA));
state.patchRoute(
{ patchState, getState } as any,
@@ -373,6 +361,16 @@ describe('ConfigState', () => {
url: '/',
children: [{ path: 'dashboard', name: 'Dashboard', url: '/dashboard' }],
});
+
+ expect(patchStateArg.flattedRoutes[0]).toEqual({
+ name: 'Main',
+ path: '',
+ url: '/',
+ children: [{ path: 'dashboard', name: 'Dashboard', url: '/dashboard' }],
+ });
+ });
+ });
+
describe('#AddRoute', () => {
const newRoute = {
name: 'My new page',
From b124bb9deec4e424dd2480a35b41de2ded211835 Mon Sep 17 00:00:00 2001
From: mehmet-erim
Date: Mon, 23 Dec 2019 10:42:17 +0300
Subject: [PATCH 048/105] tests(core): add date-extensions.spec
---
.../core/src/lib/tests/date-extensions.spec.ts | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 npm/ng-packs/packages/core/src/lib/tests/date-extensions.spec.ts
diff --git a/npm/ng-packs/packages/core/src/lib/tests/date-extensions.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/date-extensions.spec.ts
new file mode 100644
index 0000000000..3d743ae003
--- /dev/null
+++ b/npm/ng-packs/packages/core/src/lib/tests/date-extensions.spec.ts
@@ -0,0 +1,17 @@
+import '../utils/date-extensions';
+
+describe('DateExtensions', () => {
+ describe('#toLocalISOString', () => {
+ test('should able to use as date prototype', () => {
+ new Date().toLocalISOString();
+ });
+
+ test('should return correct value', () => {
+ const now = new Date();
+ const timezoneOffset = now.getTimezoneOffset();
+ expect(now.toLocalISOString()).toEqual(
+ new Date(now.getTime() - timezoneOffset * 60000).toISOString(),
+ );
+ });
+ });
+});
From 7110b49f6cd6ef4c6cc18fd327392e34fa0689f4 Mon Sep 17 00:00:00 2001
From: mehmet-erim
Date: Mon, 23 Dec 2019 11:18:05 +0300
Subject: [PATCH 049/105] ci: update labeler
---
.github/labeler.yml | 8 ++++++++
.github/workflows/labeler.yml | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 2dded9549b..cb0c9cddbd 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -1,7 +1,15 @@
ui-angular:
- npm/ng-packs/*
- npm/ng-packs/**/*
+ - npm/ng-packs/**/**/*
+ - npm/ng-packs/**/**/**/*
+ - npm/ng-packs/**/**/**/**/*
+ - npm/ng-packs/**/**/**/**/**/*
- templates/app/angular/*
- templates/app/angular/**/*
+ - templates/app/angular/**/**/*
+ - templates/app/angular/**/**/**/*
- templates/module/angular/*
- templates/module/angular/**/*
+ - templates/module/angular/**/**/*
+ - templates/module/angular/**/**/**/*
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index a5cb109c96..b1ab143f46 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -1,7 +1,7 @@
name: Pull request labeler
on:
schedule:
- - cron: '0 0 1 1 *'
+ - cron: '0 */2 * * *'
jobs:
labeler:
runs-on: ubuntu-latest
From 6cb06ac0e27dde1cc03395a7635dcba714e71caa Mon Sep 17 00:00:00 2001
From: Mehmet Erim <34455572+mehmet-erim@users.noreply.github.com>
Date: Tue, 24 Dec 2019 09:11:27 +0300
Subject: [PATCH 050/105] Update labeler.yml
---
.github/workflows/labeler.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index b1ab143f46..f24ba57949 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -1,7 +1,7 @@
name: Pull request labeler
on:
schedule:
- - cron: '0 */2 * * *'
+ - cron: '0 12 */1 * *'
jobs:
labeler:
runs-on: ubuntu-latest
From 5449e2475b817ec34174c04c88a38f4060ce562e Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:46:48 +0300
Subject: [PATCH 051/105] refactor(core): change state service method names
according to action names
---
.../packages/core/src/lib/services/config-state.service.ts | 6 +++---
.../packages/core/src/lib/services/profile-state.service.ts | 6 +++---
.../packages/core/src/lib/services/session-state.service.ts | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
index 877fdab0d3..4d555c72fd 100644
--- a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
@@ -50,15 +50,15 @@ export class ConfigStateService {
return this.store.selectSnapshot(ConfigState.getLocalization(...args));
}
- addData() {
+ dispatchGetAppConfiguration() {
return this.store.dispatch(new GetAppConfiguration());
}
- patchRoute(name: string, newValue: Partial) {
+ dispatchPatchRouteByName(name: string, newValue: Partial) {
return this.store.dispatch(new PatchRouteByName(name, newValue));
}
- addRoute(payload: Omit) {
+ dispatchAddRoute(payload: Omit) {
return this.store.dispatch(new AddRoute(payload));
}
}
diff --git a/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
index 372ce40e19..9c7567e11f 100644
--- a/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
@@ -14,15 +14,15 @@ export class ProfileStateService {
return this.store.selectSnapshot(ProfileState.getProfile);
}
- fetchProfile() {
+ dispatchGetProfile() {
return this.store.dispatch(new GetProfile());
}
- updateProfile(payload: Profile.Response) {
+ dispatchUpdateProfile(payload: Profile.Response) {
return this.store.dispatch(new UpdateProfile(payload));
}
- changePassword(payload: Profile.ChangePasswordRequest) {
+ dispatchChangePassword(payload: Profile.ChangePasswordRequest) {
return this.store.dispatch(new ChangePassword(payload));
}
}
diff --git a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
index af7261229e..ccb1de9a12 100644
--- a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
@@ -18,11 +18,11 @@ export class SessionStateService {
return this.store.selectSnapshot(SessionState.getTenant);
}
- setLanguage(payload: string) {
+ dispatchSetLanguage(payload: string) {
return this.store.dispatch(new SetLanguage(payload));
}
- setTenant(payload: ABP.BasicItem) {
+ dispatchSetTenant(payload: ABP.BasicItem) {
return this.store.dispatch(new SetTenant(payload));
}
}
From 2f3c43bb26cf0a3c4763c626bb8f4b441eee7dce Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:47:20 +0300
Subject: [PATCH 052/105] test(core): add missing tests for state services
---
.../lib/tests/config-state.service.spec.ts | 18 ++++++++++++++++++
.../lib/tests/profile-state.service.spec.ts | 19 +++++++++++++++++++
.../lib/tests/session-state.service.spec.ts | 19 +++++++++++++++++++
3 files changed, 56 insertions(+)
diff --git a/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts
index 1b20a2889b..ec8fb3ce67 100644
--- a/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts
+++ b/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts
@@ -3,6 +3,7 @@ import { ConfigStateService } from '../services/config-state.service';
import { ConfigState } from '../states';
import { Store } from '@ngxs/store';
import { Config } from '../models/config';
+import * as ConfigActions from '../actions';
const CONFIG_STATE_DATA = {
environment: {
@@ -140,4 +141,21 @@ describe('ConfigStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every ConfigState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ ConfigStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(ConfigActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(ConfigActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new ConfigActions[fnName](...params));
+ });
+ });
});
diff --git a/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts
index 3732d8000c..10db71f6c6 100644
--- a/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts
+++ b/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts
@@ -2,6 +2,8 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect
import { ProfileStateService } from '../services/profile-state.service';
import { ProfileState } from '../states/profile.state';
import { Store } from '@ngxs/store';
+import * as ProfileActions from '../actions';
+
describe('ProfileStateService', () => {
let service: ProfileStateService;
let spectator: SpectatorService;
@@ -35,4 +37,21 @@ describe('ProfileStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every ProfileState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ ProfileStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(ProfileActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(ProfileActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new ProfileActions[fnName](...params));
+ });
+ });
});
diff --git a/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts
index 40664f29b5..8bca7d1ae3 100644
--- a/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts
+++ b/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts
@@ -2,6 +2,8 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect
import { SessionStateService } from '../services/session-state.service';
import { SessionState } from '../states/session.state';
import { Store } from '@ngxs/store';
+import * as SessionActions from '../actions';
+
describe('SessionStateService', () => {
let service: SessionStateService;
let spectator: SpectatorService;
@@ -35,4 +37,21 @@ describe('SessionStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every sessionState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ SessionStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(SessionActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(SessionActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new SessionActions[fnName](...params));
+ });
+ });
});
From e673e0ddbc2c6647cdf0ab5f76283ace5f7a31a7 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:47:48 +0300
Subject: [PATCH 053/105] refactor(feature-management): change state service
method names according to action names
---
.../src/lib/services/feature-management-state.service.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts b/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
index 94f2f7fc6b..76521dcde1 100644
--- a/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
+++ b/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
@@ -14,11 +14,11 @@ export class FeatureManagementStateService {
return this.store.selectSnapshot(FeatureManagementState.getFeatures);
}
- fetchFeatures(payload: FeatureManagement.Provider) {
+ dispatchGetFeatures(payload: FeatureManagement.Provider) {
return this.store.dispatch(new GetFeatures(payload));
}
- updateFeatures(payload: FeatureManagement.Provider & FeatureManagement.Features) {
+ dispatchUpdateFeatures(payload: FeatureManagement.Provider & FeatureManagement.Features) {
return this.store.dispatch(new UpdateFeatures(payload));
}
}
From c32ee9b66a0b9264834886c639c54b0fa95f6609 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:48:23 +0300
Subject: [PATCH 054/105] test(feature-management): add missing test for state
service
---
.../feature-management-state.service.spec.ts | 23 ++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts b/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts
index 9e04806b7e..59dc3701a2 100644
--- a/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts
+++ b/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts
@@ -2,13 +2,17 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect
import { Store } from '@ngxs/store';
import { FeatureManagementStateService } from '../services/feature-management-state.service';
import { FeatureManagementState } from '../states';
+import * as FeatureManagementActions from '../actions';
describe('FeatureManagementStateService', () => {
let service: FeatureManagementStateService;
let spectator: SpectatorService;
let store: SpyObject;
- const createService = createServiceFactory({ service: FeatureManagementStateService, mocks: [Store] });
+ const createService = createServiceFactory({
+ service: FeatureManagementStateService,
+ mocks: [Store],
+ });
beforeEach(() => {
spectator = createService();
service = spectator.service;
@@ -37,4 +41,21 @@ describe('FeatureManagementStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every FeatureManagementState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ FeatureManagementStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(FeatureManagementActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(FeatureManagementActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new FeatureManagementActions[fnName](...params));
+ });
+ });
});
From 3b2228e30e4d92503d79fadbb6ac3080ff429730 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:48:55 +0300
Subject: [PATCH 055/105] refactor(identity): change state service method names
according to action names
---
.../lib/services/identity-state.service.ts | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
index 9448273c0c..91763a685f 100644
--- a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
+++ b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
@@ -36,47 +36,47 @@ export class IdentityStateService {
return this.store.selectSnapshot(IdentityState.getUsersTotalCount);
}
- fetchRoles(payload?: ABP.PageQueryParams) {
+ dispatchGetRoles(payload?: ABP.PageQueryParams) {
return this.store.dispatch(new GetRoles(payload));
}
- fetchRole(payload: string) {
+ dispatchGetRoleById(payload: string) {
return this.store.dispatch(new GetRoleById(payload));
}
- deleteRole(payload: string) {
+ dispatchDeleteRole(payload: string) {
return this.store.dispatch(new DeleteRole(payload));
}
- createRole(payload: Identity.RoleSaveRequest) {
+ dispatchCreateRole(payload: Identity.RoleSaveRequest) {
return this.store.dispatch(new CreateRole(payload));
}
- updateRole(payload: Identity.RoleItem) {
+ dispatchUpdateRole(payload: Identity.RoleItem) {
return this.store.dispatch(new UpdateRole(payload));
}
- fetchUsers(payload?: ABP.PageQueryParams) {
+ dispatchGetUsers(payload?: ABP.PageQueryParams) {
return this.store.dispatch(new GetUsers(payload));
}
- fetchUser(payload: string) {
+ dispatchGetUserById(payload: string) {
return this.store.dispatch(new GetUserById(payload));
}
- deleteUser(payload: string) {
+ dispatchDeleteUser(payload: string) {
return this.store.dispatch(new DeleteUser(payload));
}
- createUser(payload: Identity.UserSaveRequest) {
+ dispatchCreateUser(payload: Identity.UserSaveRequest) {
return this.store.dispatch(new CreateUser(payload));
}
- updateUser(payload: Identity.UserSaveRequest & { id: string }) {
+ dispatchUpdateUser(payload: Identity.UserSaveRequest & { id: string }) {
return this.store.dispatch(new UpdateUser(payload));
}
- getUserRoles(payload: string) {
+ dispatchGetUserRoles(payload: string) {
return this.store.dispatch(new GetUserRoles(payload));
}
}
From ce6b7e24808570474be32ed97bcd7c8f1587dc38 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:49:32 +0300
Subject: [PATCH 056/105] test(identity): add missing test for state service
---
.../lib/tests/identity-state.service.spec.ts | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts b/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts
index 6d78aa950f..dcf3193eea 100644
--- a/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts
+++ b/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts
@@ -2,6 +2,8 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect
import { IdentityStateService } from '../services/identity-state.service';
import { IdentityState } from '../states/identity.state';
import { Store } from '@ngxs/store';
+import * as IdentityActions from '../actions/identity.actions';
+
describe('IdentityStateService', () => {
let service: IdentityStateService;
let spectator: SpectatorService;
@@ -36,4 +38,21 @@ describe('IdentityStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every IdentityState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ IdentityStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(IdentityActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(IdentityActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new IdentityActions[fnName](...params));
+ });
+ });
});
From 998dba14b4a7ee12c2c0f05902a5e1b4a2042f31 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:49:47 +0300
Subject: [PATCH 057/105] refactor(permisison-management): change state service
method names according to action names
---
.../src/lib/services/permission-management-state.service.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts b/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
index 243926aaea..75cbefa479 100644
--- a/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
+++ b/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
@@ -17,11 +17,11 @@ export class PermissionManagementStateService {
return this.store.selectSnapshot(PermissionManagementState.getEntityDisplayName);
}
- getPermissions(payload: PermissionManagement.GrantedProvider) {
+ dispatchGetPermissions(payload: PermissionManagement.GrantedProvider) {
return this.store.dispatch(new GetPermissions(payload));
}
- updatePermissions(
+ dispatchUpdatePermissions(
payload: PermissionManagement.GrantedProvider & PermissionManagement.UpdateRequest,
) {
return this.store.dispatch(new UpdatePermissions(payload));
From c1189ed8aa13dacf14fc1f054ffef2cf2740078b Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:50:07 +0300
Subject: [PATCH 058/105] test(permission-management): add missing test for
state service
---
...ermission-management-state.service.spec.ts | 23 ++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts b/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts
index 65df916a0f..f1d344c7ac 100644
--- a/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts
+++ b/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts
@@ -2,13 +2,17 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect
import { PermissionManagementStateService } from '../services/permission-management-state.service';
import { PermissionManagementState } from '../states/permission-management.state';
import { Store } from '@ngxs/store';
+import * as PermissionManagementActions from '../actions';
describe('PermissionManagementStateService', () => {
let service: PermissionManagementStateService;
let spectator: SpectatorService;
let store: SpyObject;
- const createService = createServiceFactory({ service: PermissionManagementStateService, mocks: [Store] });
+ const createService = createServiceFactory({
+ service: PermissionManagementStateService,
+ mocks: [Store],
+ });
beforeEach(() => {
spectator = createService();
service = spectator.service;
@@ -36,4 +40,21 @@ describe('PermissionManagementStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every PermissionManagementState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ PermissionManagementStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(PermissionManagementActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(PermissionManagementActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new PermissionManagementActions[fnName](...params));
+ });
+ });
});
From 0adcfef9109c87fb5fd148601e4816e7ffe83ce0 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:50:26 +0300
Subject: [PATCH 059/105] refactor(tenant-management): change state service
method names according to action names
---
.../lib/services/tenant-management-state.service.ts | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
index e27e4b3d67..eafae7c2fb 100644
--- a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
+++ b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
@@ -19,23 +19,23 @@ export class TenantManagementStateService {
return this.store.selectSnapshot(TenantManagementState.getTenantsTotalCount);
}
- getTenants(payload?: ABP.PageQueryParams) {
+ dispatchGetTenants(payload?: ABP.PageQueryParams) {
return this.store.dispatch(new GetTenants(payload));
}
- getTenantById(payload: string) {
+ dispatchGetTenantById(payload: string) {
return this.store.dispatch(new GetTenantById(payload));
}
- createTenant(payload: TenantManagement.AddRequest) {
+ dispatchCreateTenant(payload: TenantManagement.AddRequest) {
return this.store.dispatch(new CreateTenant(payload));
}
- updateTenant(payload: TenantManagement.UpdateRequest) {
+ dispatchUpdateTenant(payload: TenantManagement.UpdateRequest) {
return this.store.dispatch(new UpdateTenant(payload));
}
- deleteTenant(payload: string) {
+ dispatchDeleteTenant(payload: string) {
return this.store.dispatch(new DeleteTenant(payload));
}
}
From e875433a57fe60115efc38eaaef94658014d0440 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:50:45 +0300
Subject: [PATCH 060/105] test(tenant-management): add missing test for state
service
---
.../tenant-management-state.service.spec.ts | 24 ++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts b/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts
index c5b40fb54b..bd9017a2c7 100644
--- a/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts
+++ b/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts
@@ -2,12 +2,17 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect
import { TenantManagementStateService } from '../services/tenant-management-state.service';
import { TenantManagementState } from '../states/tenant-management.state';
import { Store } from '@ngxs/store';
+import * as TenantManagementActions from '../actions';
+
describe('TenantManagementStateService', () => {
let service: TenantManagementStateService;
let spectator: SpectatorService;
let store: SpyObject;
- const createService = createServiceFactory({ service: TenantManagementStateService, mocks: [Store] });
+ const createService = createServiceFactory({
+ service: TenantManagementStateService,
+ mocks: [Store],
+ });
beforeEach(() => {
spectator = createService();
service = spectator.service;
@@ -36,4 +41,21 @@ describe('TenantManagementStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every TenantManagementState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ TenantManagementStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(TenantManagementActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(TenantManagementActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new TenantManagementActions[fnName](...params));
+ });
+ });
});
From f89bade3a61b1e901766e6d1c2d5cbd10ecb2cb2 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:51:57 +0300
Subject: [PATCH 061/105] feature(theme-basic): add state action dispatchers to
state service
---
.../src/lib/services/layout-state.service.ts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts b/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts
index 92ab3d0c59..a68e97c32c 100644
--- a/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts
+++ b/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { LayoutState } from '../states/layout.state';
+import { AddNavigationElement, RemoveNavigationElementByName } from '../actions';
+import { Layout } from '../models/layout';
@Injectable()
export class LayoutStateService {
@@ -9,4 +11,12 @@ export class LayoutStateService {
getNavigationElements() {
return this.store.selectSnapshot(LayoutState.getNavigationElements);
}
+
+ dispatchAddNavigationElement(payload: Layout.NavigationElement | Layout.NavigationElement[]) {
+ return this.store.dispatch(new AddNavigationElement(payload));
+ }
+
+ dispatchRemoveNavigationElementByName(name: string) {
+ return this.store.dispatch(new RemoveNavigationElementByName(name));
+ }
}
From 4b115fb90d29841e2186949ddb264985b9ff487e Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:52:21 +0300
Subject: [PATCH 062/105] test(theme-basic): add missing test for state service
---
.../lib/tests/layout-state.service.spec.ts | 20 ++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts b/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts
index 2a88a93f47..de4f489aaa 100644
--- a/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts
+++ b/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts
@@ -1,7 +1,8 @@
import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest';
+import { Store } from '@ngxs/store';
+import * as LayoutActions from '../actions';
import { LayoutStateService } from '../services/layout-state.service';
import { LayoutState } from '../states/layout.state';
-import { Store } from '@ngxs/store';
describe('LayoutStateService', () => {
let service: LayoutStateService;
let spectator: SpectatorService;
@@ -36,4 +37,21 @@ describe('LayoutStateService', () => {
}
});
});
+
+ test('should have a dispatch method for every LayoutState action', () => {
+ const reg = /(?<=dispatch)(\w+)(?=\()/gm;
+ LayoutStateService.toString()
+ .match(reg)
+ .forEach(fnName => {
+ expect(LayoutActions[fnName]).toBeTruthy();
+
+ const spy = jest.spyOn(store, 'dispatch');
+ spy.mockClear();
+
+ const params = Array.from(new Array(LayoutActions[fnName].length));
+
+ service[`dispatch${fnName}`](...params);
+ expect(spy).toHaveBeenCalledWith(new LayoutActions[fnName](...params));
+ });
+ });
});
From 4459c62029cd8fc31b9d5a6b95513868b3ac3c96 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 10:53:23 +0300
Subject: [PATCH 063/105] style(theme-basic): reorder imports and beautify
method parameters
---
.../theme-basic/src/lib/states/layout.state.ts | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/npm/ng-packs/packages/theme-basic/src/lib/states/layout.state.ts b/npm/ng-packs/packages/theme-basic/src/lib/states/layout.state.ts
index 7fac67a036..1c90803638 100644
--- a/npm/ng-packs/packages/theme-basic/src/lib/states/layout.state.ts
+++ b/npm/ng-packs/packages/theme-basic/src/lib/states/layout.state.ts
@@ -1,8 +1,7 @@
-import { State, Action, StateContext, Selector } from '@ngxs/store';
+import { Action, Selector, State, StateContext } from '@ngxs/store';
+import snq from 'snq';
import { AddNavigationElement, RemoveNavigationElementByName } from '../actions/layout.actions';
import { Layout } from '../models/layout';
-import { TemplateRef } from '@angular/core';
-import snq from 'snq';
@State({
name: 'LayoutState',
@@ -15,7 +14,10 @@ export class LayoutState {
}
@Action(AddNavigationElement)
- layoutAddAction({ getState, patchState }: StateContext, { payload = [] }: AddNavigationElement) {
+ layoutAddAction(
+ { getState, patchState }: StateContext,
+ { payload = [] }: AddNavigationElement,
+ ) {
let { navigationElements } = getState();
if (!Array.isArray(payload)) {
@@ -44,7 +46,10 @@ export class LayoutState {
}
@Action(RemoveNavigationElementByName)
- layoutRemoveAction({ getState, patchState }: StateContext, { name }: RemoveNavigationElementByName) {
+ layoutRemoveAction(
+ { getState, patchState }: StateContext,
+ { name }: RemoveNavigationElementByName,
+ ) {
let { navigationElements } = getState();
const index = navigationElements.findIndex(element => element.name === name);
From d30f5a7af60d6b1dfac16ea61d7d8b6715446e29 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 11:39:20 +0300
Subject: [PATCH 064/105] refactor(core): change state service dispatcher
parameters
---
.../core/src/lib/services/config-state.service.ts | 8 ++++----
.../core/src/lib/services/profile-state.service.ts | 8 ++++----
.../core/src/lib/services/session-state.service.ts | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
index 4d555c72fd..506b278634 100644
--- a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
@@ -54,11 +54,11 @@ export class ConfigStateService {
return this.store.dispatch(new GetAppConfiguration());
}
- dispatchPatchRouteByName(name: string, newValue: Partial) {
- return this.store.dispatch(new PatchRouteByName(name, newValue));
+ dispatchPatchRouteByName(...args: ConstructorParameters) {
+ return this.store.dispatch(new PatchRouteByName(...args));
}
- dispatchAddRoute(payload: Omit) {
- return this.store.dispatch(new AddRoute(payload));
+ dispatchAddRoute(...args: ConstructorParameters) {
+ return this.store.dispatch(new AddRoute(...args));
}
}
diff --git a/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
index 9c7567e11f..cd76c4bf03 100644
--- a/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts
@@ -18,11 +18,11 @@ export class ProfileStateService {
return this.store.dispatch(new GetProfile());
}
- dispatchUpdateProfile(payload: Profile.Response) {
- return this.store.dispatch(new UpdateProfile(payload));
+ dispatchUpdateProfile(...args: ConstructorParameters) {
+ return this.store.dispatch(new UpdateProfile(...args));
}
- dispatchChangePassword(payload: Profile.ChangePasswordRequest) {
- return this.store.dispatch(new ChangePassword(payload));
+ dispatchChangePassword(...args: ConstructorParameters) {
+ return this.store.dispatch(new ChangePassword(...args));
}
}
diff --git a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
index ccb1de9a12..88b8f2df9b 100644
--- a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
+++ b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts
@@ -18,11 +18,11 @@ export class SessionStateService {
return this.store.selectSnapshot(SessionState.getTenant);
}
- dispatchSetLanguage(payload: string) {
- return this.store.dispatch(new SetLanguage(payload));
+ dispatchSetLanguage(...args: ConstructorParameters) {
+ return this.store.dispatch(new SetLanguage(...args));
}
- dispatchSetTenant(payload: ABP.BasicItem) {
- return this.store.dispatch(new SetTenant(payload));
+ dispatchSetTenant(...args: ConstructorParameters) {
+ return this.store.dispatch(new SetTenant(...args));
}
}
From d31474cc28737ad0798ed71c3422eb3b7fae8aa8 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 11:39:31 +0300
Subject: [PATCH 065/105] refactor(feature-management): change state service
dispatcher parameters
---
.../src/lib/services/feature-management-state.service.ts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts b/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
index 76521dcde1..79d7fbef34 100644
--- a/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
+++ b/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts
@@ -14,11 +14,11 @@ export class FeatureManagementStateService {
return this.store.selectSnapshot(FeatureManagementState.getFeatures);
}
- dispatchGetFeatures(payload: FeatureManagement.Provider) {
- return this.store.dispatch(new GetFeatures(payload));
+ dispatchGetFeatures(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetFeatures(...args));
}
- dispatchUpdateFeatures(payload: FeatureManagement.Provider & FeatureManagement.Features) {
- return this.store.dispatch(new UpdateFeatures(payload));
+ dispatchUpdateFeatures(...args: ConstructorParameters) {
+ return this.store.dispatch(new UpdateFeatures(...args));
}
}
From 6f9422d8f254dccaa43fafc1eefe0b2d09b04619 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 11:39:39 +0300
Subject: [PATCH 066/105] refactor(identity): change state service dispatcher
parameters
---
.../lib/services/identity-state.service.ts | 44 +++++++++----------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
index 91763a685f..0fcb6d4014 100644
--- a/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
+++ b/npm/ng-packs/packages/identity/src/lib/services/identity-state.service.ts
@@ -36,47 +36,47 @@ export class IdentityStateService {
return this.store.selectSnapshot(IdentityState.getUsersTotalCount);
}
- dispatchGetRoles(payload?: ABP.PageQueryParams) {
- return this.store.dispatch(new GetRoles(payload));
+ dispatchGetRoles(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetRoles(...args));
}
- dispatchGetRoleById(payload: string) {
- return this.store.dispatch(new GetRoleById(payload));
+ dispatchGetRoleById(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetRoleById(...args));
}
- dispatchDeleteRole(payload: string) {
- return this.store.dispatch(new DeleteRole(payload));
+ dispatchDeleteRole(...args: ConstructorParameters) {
+ return this.store.dispatch(new DeleteRole(...args));
}
- dispatchCreateRole(payload: Identity.RoleSaveRequest) {
- return this.store.dispatch(new CreateRole(payload));
+ dispatchCreateRole(...args: ConstructorParameters) {
+ return this.store.dispatch(new CreateRole(...args));
}
- dispatchUpdateRole(payload: Identity.RoleItem) {
- return this.store.dispatch(new UpdateRole(payload));
+ dispatchUpdateRole(...args: ConstructorParameters) {
+ return this.store.dispatch(new UpdateRole(...args));
}
- dispatchGetUsers(payload?: ABP.PageQueryParams) {
- return this.store.dispatch(new GetUsers(payload));
+ dispatchGetUsers(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetUsers(...args));
}
- dispatchGetUserById(payload: string) {
- return this.store.dispatch(new GetUserById(payload));
+ dispatchGetUserById(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetUserById(...args));
}
- dispatchDeleteUser(payload: string) {
- return this.store.dispatch(new DeleteUser(payload));
+ dispatchDeleteUser(...args: ConstructorParameters) {
+ return this.store.dispatch(new DeleteUser(...args));
}
- dispatchCreateUser(payload: Identity.UserSaveRequest) {
- return this.store.dispatch(new CreateUser(payload));
+ dispatchCreateUser(...args: ConstructorParameters) {
+ return this.store.dispatch(new CreateUser(...args));
}
- dispatchUpdateUser(payload: Identity.UserSaveRequest & { id: string }) {
- return this.store.dispatch(new UpdateUser(payload));
+ dispatchUpdateUser(...args: ConstructorParameters) {
+ return this.store.dispatch(new UpdateUser(...args));
}
- dispatchGetUserRoles(payload: string) {
- return this.store.dispatch(new GetUserRoles(payload));
+ dispatchGetUserRoles(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetUserRoles(...args));
}
}
From e0de527018fec0d2aa5737ce07f4adb42f194a83 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 11:39:51 +0300
Subject: [PATCH 067/105] refactor(permission-management): change state service
dispatcher parameters
---
.../services/permission-management-state.service.ts | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts b/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
index 75cbefa479..1f372224ae 100644
--- a/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
+++ b/npm/ng-packs/packages/permission-management/src/lib/services/permission-management-state.service.ts
@@ -17,13 +17,11 @@ export class PermissionManagementStateService {
return this.store.selectSnapshot(PermissionManagementState.getEntityDisplayName);
}
- dispatchGetPermissions(payload: PermissionManagement.GrantedProvider) {
- return this.store.dispatch(new GetPermissions(payload));
+ dispatchGetPermissions(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetPermissions(...args));
}
- dispatchUpdatePermissions(
- payload: PermissionManagement.GrantedProvider & PermissionManagement.UpdateRequest,
- ) {
- return this.store.dispatch(new UpdatePermissions(payload));
+ dispatchUpdatePermissions(...args: ConstructorParameters) {
+ return this.store.dispatch(new UpdatePermissions(...args));
}
}
From 177f4ffe08876574578fb0abdb6dbc9fcaa0aa91 Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 11:40:11 +0300
Subject: [PATCH 068/105] refactor(tenant-management): change state service
dispatcher parameters
---
.../tenant-management-state.service.ts | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
index eafae7c2fb..4475bef141 100644
--- a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
+++ b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management-state.service.ts
@@ -19,23 +19,23 @@ export class TenantManagementStateService {
return this.store.selectSnapshot(TenantManagementState.getTenantsTotalCount);
}
- dispatchGetTenants(payload?: ABP.PageQueryParams) {
- return this.store.dispatch(new GetTenants(payload));
+ dispatchGetTenants(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetTenants(...args));
}
- dispatchGetTenantById(payload: string) {
- return this.store.dispatch(new GetTenantById(payload));
+ dispatchGetTenantById(...args: ConstructorParameters) {
+ return this.store.dispatch(new GetTenantById(...args));
}
- dispatchCreateTenant(payload: TenantManagement.AddRequest) {
- return this.store.dispatch(new CreateTenant(payload));
+ dispatchCreateTenant(...args: ConstructorParameters) {
+ return this.store.dispatch(new CreateTenant(...args));
}
- dispatchUpdateTenant(payload: TenantManagement.UpdateRequest) {
- return this.store.dispatch(new UpdateTenant(payload));
+ dispatchUpdateTenant(...args: ConstructorParameters) {
+ return this.store.dispatch(new UpdateTenant(...args));
}
- dispatchDeleteTenant(payload: string) {
- return this.store.dispatch(new DeleteTenant(payload));
+ dispatchDeleteTenant(...args: ConstructorParameters) {
+ return this.store.dispatch(new DeleteTenant(...args));
}
}
From fdd73da7854200b92e647fd7349d9d1b2d607a5f Mon Sep 17 00:00:00 2001
From: TheDiaval
Date: Tue, 24 Dec 2019 11:40:26 +0300
Subject: [PATCH 069/105] refactor(theme-basic): change state service
dispatcher parameters
---
.../src/lib/services/layout-state.service.ts | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts b/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts
index a68e97c32c..f38c9c4361 100644
--- a/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts
+++ b/npm/ng-packs/packages/theme-basic/src/lib/services/layout-state.service.ts
@@ -12,11 +12,13 @@ export class LayoutStateService {
return this.store.selectSnapshot(LayoutState.getNavigationElements);
}
- dispatchAddNavigationElement(payload: Layout.NavigationElement | Layout.NavigationElement[]) {
- return this.store.dispatch(new AddNavigationElement(payload));
+ dispatchAddNavigationElement(...args: ConstructorParameters) {
+ return this.store.dispatch(new AddNavigationElement(...args));
}
- dispatchRemoveNavigationElementByName(name: string) {
- return this.store.dispatch(new RemoveNavigationElementByName(name));
+ dispatchRemoveNavigationElementByName(
+ ...args: ConstructorParameters
+ ) {
+ return this.store.dispatch(new RemoveNavigationElementByName(...args));
}
}
From 676a5c61acc01d255605eeffe537d7647b29b07d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Tue, 24 Dec 2019 11:56:14 +0300
Subject: [PATCH 070/105] Removed sync interception and sync repository
methods.
---
.../Volo/Abp/Auditing/AuditingInterceptor.cs | 27 ----
.../Authorization/AuthorizationInterceptor.cs | 7 -
.../CastleAbpInterceptorAdapter.cs | 7 +-
.../CastleAbpMethodInvocationAdapter.cs | 14 +-
.../Volo/Abp/DynamicProxy/AbpInterceptor.cs | 12 +-
.../Volo/Abp/DynamicProxy/IAbpInterceptor.cs | 2 -
.../Abp/DynamicProxy/IAbpMethodInvocation.cs | 2 -
.../Repositories/BasicRepositoryBase.cs | 70 ++--------
.../Domain/Repositories/IBasicRepository.cs | 42 ------
.../Repositories/IReadOnlyBasicRepository.cs | 31 -----
.../Abp/Domain/Repositories/IRepository.cs | 13 --
.../Abp/Domain/Repositories/RepositoryBase.cs | 55 +-------
.../EntityFrameworkCore/EfCoreRepository.cs | 73 +----------
.../Volo/Abp/Features/FeatureInterceptor.cs | 13 --
.../DynamicHttpProxyInterceptor.cs | 25 ----
.../MemoryDb/MemoryDbRepository.cs | 79 ++++++------
.../Repositories/MongoDB/MongoDbRepository.cs | 120 -----------------
.../Volo/Abp/Uow/UnitOfWorkInterceptor.cs | 15 ---
.../Abp/Validation/ValidationInterceptor.cs | 6 -
...ice_Tests.cs => PeopleAppService_Tests.cs} | 18 +--
.../Mvc/Uow/UnitOfWorkTestController.cs | 1 -
.../Mvc/Versioning/App/v1/ITodoAppService.cs | 3 +-
.../Mvc/Versioning/App/v1/TodoAppService.cs | 7 +-
.../Mvc/Versioning/App/v2/ITodoAppService.cs | 3 +-
.../Mvc/Versioning/App/v2/TodoAppService.cs | 7 +-
.../Test/v1/TodoAppService_Tests.cs | 7 +-
.../Test/v2/TodoAppService_Tests.cs | 7 +-
.../Abp/Authorization/Authorization_Tests.cs | 10 +-
.../TestServices/IMyAuthorizedService1.cs | 4 +-
.../TestServices/MyAuthorizedService1.cs | 8 +-
.../DynamicProxy/AbpInterceptionTestBase.cs | 94 ++------------
.../DynamicProxy/SimpleAsyncInterceptor.cs | 9 +-
.../SimpleResultCacheTestInterceptor.cs | 11 +-
.../Abp/DynamicProxy/SimpleSyncInterceptor.cs | 14 --
.../RepositoryRegistration_Tests.cs | 34 ++---
.../AbpEfCoreTestSecondContextModule.cs | 5 +-
.../SecondContextTestDataBuilder.cs | 5 +-
.../DbContext_Replace_Tests.cs | 15 ++-
.../Abp/Features/ClassFeatureTestService.cs | 11 +-
.../Abp/Features/FeatureInterceptor_Tests.cs | 12 +-
...plicationService_FluentValidation_Tests.cs | 45 +------
.../DynamicProxying/IRegularTestController.cs | 2 -
.../PersonAppServiceClientProxy_Tests.cs | 12 +-
.../DynamicProxying/RegularTestController.cs | 7 -
.../RegularTestControllerClientProxy_Tests.cs | 6 -
.../Repositories/Repository_Basic_Tests.cs | 8 +-
.../Repository_Basic_Tests_With_Int_Pk.cs | 7 +-
.../TestApp/Application/PeopleAppService.cs | 6 +-
.../Volo/Abp/TestApp/TestAppModule.cs | 5 +-
.../Volo/Abp/TestApp/TestDataBuilder.cs | 47 +++----
.../Testing/EntityChangeEvents_Tests.cs | 6 +-
.../Repository_Basic_Tests_With_Int_Pk.cs | 7 +-
.../ApplicationService_Validation_Tests.cs | 122 +++++++++---------
53 files changed, 283 insertions(+), 895 deletions(-)
rename framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/{PersonAppService_Tests.cs => PeopleAppService_Tests.cs} (88%)
delete mode 100644 framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs
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 434ddc9d16..5a401a218e 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs
@@ -18,33 +18,6 @@ namespace Volo.Abp.Auditing
_auditingManager = auditingManager;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction))
- {
- invocation.Proceed();
- return;
- }
-
- var stopwatch = Stopwatch.StartNew();
-
- try
- {
- invocation.Proceed();
- }
- catch (Exception ex)
- {
- auditLog.Exceptions.Add(ex);
- throw;
- }
- finally
- {
- stopwatch.Stop();
- auditLogAction.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
- auditLog.Actions.Add(auditLogAction);
- }
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction))
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 74314e815d..44466884dd 100644
--- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs
+++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs
@@ -1,7 +1,6 @@
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
-using Volo.Abp.Threading;
namespace Volo.Abp.Authorization
{
@@ -14,12 +13,6 @@ namespace Volo.Abp.Authorization
_methodInvocationAuthorizationService = methodInvocationAuthorizationService;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- AsyncHelper.RunSync(() => AuthorizeAsync(invocation));
- invocation.Proceed();
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
await AuthorizeAsync(invocation);
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpInterceptorAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpInterceptorAdapter.cs
index edb52aff86..c8ba229979 100644
--- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpInterceptorAdapter.cs
+++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpInterceptorAdapter.cs
@@ -42,15 +42,10 @@ namespace Volo.Abp.Castle.DynamicProxy
}
else
{
- InterceptSyncMethod(invocation, proceedInfo);
+ proceedInfo.Invoke();
}
}
- private void InterceptSyncMethod(IInvocation invocation, IInvocationProceedInfo proceedInfo)
- {
- _abpInterceptor.Intercept(new CastleAbpMethodInvocationAdapter(invocation, proceedInfo));
- }
-
private void InterceptAsyncMethod(IInvocation invocation, IInvocationProceedInfo proceedInfo)
{
if (invocation.Method.ReturnType == typeof(Task))
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 0963da406b..13f59cb0c1 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
@@ -40,25 +40,13 @@ namespace Volo.Abp.Castle.DynamicProxy
_lazyArgumentsDictionary = new Lazy>(GetArgumentsDictionary);
}
- public void Proceed()
- {
- ProceedInfo.Invoke();
-
- if (Invocation.Method.IsAsync())
- {
- AsyncHelper.RunSync(() => (Task)Invocation.ReturnValue);
- }
- }
-
public Task ProceedAsync()
{
ProceedInfo.Invoke();
_actualReturnValue = Invocation.ReturnValue;
- return Invocation.Method.IsAsync()
- ? (Task)_actualReturnValue
- : Task.FromResult(_actualReturnValue);
+ return (Task) _actualReturnValue;
}
private IReadOnlyDictionary GetArgumentsDictionary()
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs
index 8874beafcf..51ab36efc4 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/AbpInterceptor.cs
@@ -3,13 +3,7 @@
namespace Volo.Abp.DynamicProxy
{
public abstract class AbpInterceptor : IAbpInterceptor
- {
- public abstract void Intercept(IAbpMethodInvocation invocation);
-
- public virtual Task InterceptAsync(IAbpMethodInvocation invocation)
- {
- Intercept(invocation);
- return Task.CompletedTask;
- }
- }
+ {
+ public abstract Task InterceptAsync(IAbpMethodInvocation invocation);
+ }
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs
index 0d953d9c73..c20cb01277 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpInterceptor.cs
@@ -4,8 +4,6 @@ namespace Volo.Abp.DynamicProxy
{
public interface IAbpInterceptor
{
- void Intercept(IAbpMethodInvocation invocation);
-
Task InterceptAsync(IAbpMethodInvocation invocation);
}
}
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs
index 37a36ac05f..17a89be467 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/IAbpMethodInvocation.cs
@@ -19,8 +19,6 @@ namespace Volo.Abp.DynamicProxy
object ReturnValue { get; set; }
- void Proceed();
-
Task ProceedAsync();
}
}
\ No newline at end of file
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 05fc760182..d13d52ed97 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
@@ -25,54 +25,28 @@ namespace Volo.Abp.Domain.Repositories
CancellationTokenProvider = NullCancellationTokenProvider.Instance;
}
- public abstract TEntity Insert(TEntity entity, bool autoSave = false);
+ public abstract Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- public virtual Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Insert(entity, autoSave));
- }
+ public abstract Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- public abstract TEntity Update(TEntity entity, bool autoSave = false);
+ public abstract Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- public virtual Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Update(entity));
- }
+ public abstract Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default);
- public abstract void Delete(TEntity entity, bool autoSave = false);
-
- public virtual Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(entity);
- return Task.CompletedTask;
- }
+ public abstract Task GetCountAsync(CancellationToken cancellationToken = default);
- protected virtual CancellationToken GetCancellationToken(CancellationToken prefferedValue = default)
+ protected virtual CancellationToken GetCancellationToken(CancellationToken preferredValue = default)
{
- return CancellationTokenProvider.FallbackToProvider(prefferedValue);
- }
-
- public abstract List GetList(bool includeDetails = false);
-
- public virtual Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(GetList(includeDetails));
- }
-
- public abstract long GetCount();
-
- public virtual Task GetCountAsync(CancellationToken cancellationToken = default)
- {
- return Task.FromResult(GetCount());
+ return CancellationTokenProvider.FallbackToProvider(preferredValue);
}
}
public abstract class BasicRepositoryBase : BasicRepositoryBase, IBasicRepository
where TEntity : class, IEntity
{
- public virtual TEntity Get(TKey id, bool includeDetails = true)
+ public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
- var entity = Find(id, includeDetails);
+ var entity = await FindAsync(id, includeDetails, cancellationToken);
if (entity == null)
{
@@ -82,33 +56,17 @@ namespace Volo.Abp.Domain.Repositories
return entity;
}
- public virtual Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Get(id, includeDetails));
- }
-
- public abstract TEntity Find(TKey id, bool includeDetails = true);
-
- public virtual Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Find(id, includeDetails));
- }
-
- public virtual void Delete(TKey id, bool autoSave = false)
+ public abstract Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
+
+ public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- var entity = Find(id);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
}
- Delete(entity);
- }
-
- public virtual Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(id);
- return Task.CompletedTask;
+ await DeleteAsync(entity, autoSave, cancellationToken);
}
}
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs
index f3644bbe4a..6b62691ed8 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IBasicRepository.cs
@@ -8,17 +8,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IBasicRepository : IReadOnlyBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Inserts a new entity.
- ///
- /// Inserted entity
- ///
- /// Set true to automatically save entity to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- [NotNull]
- TEntity Insert([NotNull] TEntity entity, bool autoSave = false);
-
///
/// Inserts a new entity.
///
@@ -31,17 +20,6 @@ namespace Volo.Abp.Domain.Repositories
[NotNull]
Task InsertAsync([NotNull] TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- ///
- /// Updates an existing entity.
- ///
- /// Entity
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- [NotNull]
- TEntity Update([NotNull] TEntity entity, bool autoSave = false);
-
///
/// Updates an existing entity.
///
@@ -54,16 +32,6 @@ namespace Volo.Abp.Domain.Repositories
[NotNull]
Task UpdateAsync([NotNull] TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
- ///
- /// Deletes an entity.
- ///
- /// Entity to be deleted
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- void Delete([NotNull] TEntity entity, bool autoSave = false);
-
///
/// Deletes an entity.
///
@@ -79,16 +47,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IBasicRepository : IBasicRepository, IReadOnlyBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Deletes an entity by primary key.
- ///
- /// Primary key of the entity
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- void Delete(TKey id, bool autoSave = false); //TODO: Return true if deleted
-
///
/// Deletes an entity by primary key.
///
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs
index c67b35794b..828e305ff8 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs
@@ -9,13 +9,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IReadOnlyBasicRepository : IRepository
where TEntity : class, IEntity
{
- ///
- /// Gets a list of all the entities.
- ///
- /// Set true to include all children of this entity
- /// Entity
- List GetList(bool includeDetails = false);
-
///
/// Gets a list of all the entities.
///
@@ -24,11 +17,6 @@ namespace Volo.Abp.Domain.Repositories
/// Entity
Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default);
- ///
- /// Gets total count of all entities.
- ///
- long GetCount();
-
///
/// Gets total count of all entities.
///
@@ -38,16 +26,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IReadOnlyBasicRepository : IReadOnlyBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Gets an entity with given primary key.
- /// Throws if can not find an entity with given id.
- ///
- /// Primary key of the entity to get
- /// Set true to include all children of this entity
- /// Entity
- [NotNull]
- TEntity Get(TKey id, bool includeDetails = true);
-
///
/// Gets an entity with given primary key.
/// Throws if can not find an entity with given id.
@@ -59,15 +37,6 @@ namespace Volo.Abp.Domain.Repositories
[NotNull]
Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
- ///
- /// Gets an entity with given primary key or null if not found.
- ///
- /// Primary key of the entity to get
- /// Set true to include all children of this entity
- /// Entity or null
- [CanBeNull]
- TEntity Find(TKey id, bool includeDetails = true);
-
///
/// Gets an entity with given primary key or null if not found.
///
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
index a77dc4acb7..2ac16ec229 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
@@ -18,19 +18,6 @@ namespace Volo.Abp.Domain.Repositories
public interface IRepository : IReadOnlyRepository, IBasicRepository
where TEntity : class, IEntity
{
- ///
- /// Deletes many entities by function.
- /// Notice that: All entities fits to given predicate are retrieved and deleted.
- /// This may cause major performance problems if there are too many entities with
- /// given predicate.
- ///
- /// A condition to filter entities
- ///
- /// Set true to automatically save changes to database.
- /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database.
- ///
- void Delete([NotNull] Expression> predicate, bool autoSave = false);
-
///
/// Deletes many entities by function.
/// Notice that: All entities fits to given predicate are retrieved and deleted.
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 139f4ff999..29814f4de6 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
@@ -46,19 +46,7 @@ namespace Volo.Abp.Domain.Repositories
protected abstract IQueryable GetQueryable();
- public virtual void Delete(Expression> predicate, bool autoSave = false)
- {
- foreach (var entity in GetQueryable().Where(predicate).ToList())
- {
- Delete(entity, autoSave);
- }
- }
-
- public virtual Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(predicate, autoSave);
- return Task.CompletedTask;
- }
+ public abstract Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default);
protected virtual TQueryable ApplyDataFilters(TQueryable query)
where TQueryable : IQueryable
@@ -81,50 +69,19 @@ namespace Volo.Abp.Domain.Repositories
public abstract class RepositoryBase : RepositoryBase, IRepository
where TEntity : class, IEntity
{
- public virtual TEntity Find(TKey id, bool includeDetails = true)
- {
- return includeDetails
- ? WithDetails().FirstOrDefault(EntityHelper.CreateEqualityExpressionForId(id))
- : GetQueryable().FirstOrDefault(EntityHelper.CreateEqualityExpressionForId(id));
- }
+ public abstract Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
- public virtual TEntity Get(TKey id, bool includeDetails = true)
- {
- var entity = Find(id, includeDetails);
+ public abstract Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default);
- if (entity == null)
- {
- throw new EntityNotFoundException(typeof(TEntity), id);
- }
-
- return entity;
- }
-
- public virtual Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Get(id, includeDetails));
- }
-
- public virtual Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
+ public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- return Task.FromResult(Find(id, includeDetails));
- }
-
- public virtual void Delete(TKey id, bool autoSave = false)
- {
- var entity = Find(id, includeDetails: false);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
}
- Delete(entity, autoSave);
- }
-
- public virtual Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(id, autoSave);
- return Task.CompletedTask;
+ await DeleteAsync(entity, autoSave, cancellationToken);
}
}
}
\ No newline at end of file
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 bfedcf2d66..4131a774b5 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
@@ -40,18 +40,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
);
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
- {
- var savedEntity = DbSet.Add(entity).Entity;
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
-
- return savedEntity;
- }
-
public override async Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
var savedEntity = DbSet.Add(entity).Entity;
@@ -64,20 +52,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
return savedEntity;
}
- public override TEntity Update(TEntity entity, bool autoSave = false)
- {
- DbContext.Attach(entity);
-
- var updatedEntity = DbContext.Update(entity).Entity;
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
-
- return updatedEntity;
- }
-
public override async Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
DbContext.Attach(entity);
@@ -91,17 +65,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
return updatedEntity;
}
-
- public override void Delete(TEntity entity, bool autoSave = false)
- {
- DbSet.Remove(entity);
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
- }
-
+
public override async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
DbSet.Remove(entity);
@@ -112,13 +76,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
}
}
- public override List GetList(bool includeDetails = false)
- {
- return includeDetails
- ? WithDetails().ToList()
- : DbSet.ToList();
- }
-
public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
return includeDetails
@@ -126,11 +83,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
: await DbSet.ToListAsync(GetCancellationToken(cancellationToken));
}
- public override long GetCount()
- {
- return DbSet.LongCount();
- }
-
public override async Task GetCountAsync(CancellationToken cancellationToken = default)
{
return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken));
@@ -141,16 +93,6 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
return DbSet.AsQueryable();
}
- public override void Delete(Expression> predicate, bool autoSave = false)
- {
- base.Delete(predicate, autoSave);
-
- if (autoSave)
- {
- DbContext.SaveChanges();
- }
- }
-
public override async Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
var entities = await GetQueryable()
@@ -269,20 +211,9 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
: await DbSet.FindAsync(new object[] { id }, GetCancellationToken(cancellationToken));
}
- public virtual void Delete(TKey id, bool autoSave = false)
- {
- var entity = Find(id, includeDetails: false);
- if (entity == null)
- {
- return;
- }
-
- Delete(entity, autoSave);
- }
-
public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- var entity = await FindAsync(id, includeDetails: false, cancellationToken: cancellationToken);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
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 5fb7c54293..9986af6275 100644
--- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs
+++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs
@@ -2,7 +2,6 @@
using Volo.Abp.Aspects;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
-using Volo.Abp.Threading;
namespace Volo.Abp.Features
{
@@ -16,18 +15,6 @@ namespace Volo.Abp.Features
_methodInvocationFeatureCheckerService = methodInvocationFeatureCheckerService;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.FeatureChecking))
- {
- invocation.Proceed();
- return;
- }
-
- AsyncHelper.RunSync(() => CheckFeaturesAsync(invocation));
- invocation.Proceed();
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.FeatureChecking))
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 d2b57d32ef..42fdb0afc3 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
@@ -74,31 +74,6 @@ namespace Volo.Abp.Http.Client.DynamicProxying
Logger = NullLogger>.Instance;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- if (invocation.Method.ReturnType == typeof(void))
- {
- AsyncHelper.RunSync(() => MakeRequestAsync(invocation));
- }
- else
- {
- var responseAsString = AsyncHelper.RunSync(() => MakeRequestAsync(invocation));
-
- //TODO: Think on that
- if (TypeHelper.IsPrimitiveExtended(invocation.Method.ReturnType, true))
- {
- invocation.ReturnValue = Convert.ChangeType(responseAsString, invocation.Method.ReturnType);
- }
- else
- {
- invocation.ReturnValue = JsonSerializer.Deserialize(
- invocation.Method.ReturnType,
- responseAsString
- );
- }
- }
- }
-
public override Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (invocation.Method.ReturnType.GenericTypeArguments.IsNullOrEmpty())
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 68b9beeb6e..b81aa7ae87 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
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
@@ -25,40 +26,52 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
DatabaseProvider = databaseProvider;
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
+ protected override IQueryable GetQueryable()
{
- Collection.Add(entity);
- return entity;
+ return ApplyDataFilters(Collection.AsQueryable());
}
- public override TEntity Update(TEntity entity, bool autoSave = false)
+ public override Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
- Collection.Update(entity);
- return entity;
+ var entities = Collection.AsQueryable().Where(predicate).ToList();
+ foreach (var entity in entities)
+ {
+ Collection.Remove(entity);
+ }
+
+ return Task.CompletedTask;
}
- public override void Delete(TEntity entity, bool autoSave = false)
+ public override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
- Collection.Remove(entity);
+ Collection.Add(entity);
+ return Task.FromResult(entity);
+ }
+
+ public override Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
+ {
+ Collection.Update(entity);
+ return Task.FromResult(entity);
}
- public override List GetList(bool includeDetails = false)
+ public override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
- return Collection.ToList();
+ Collection.Remove(entity);
+ return Task.CompletedTask;
}
- public override long GetCount()
+ public override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
- return Collection.Count();
+ return Task.FromResult(Collection.ToList());
}
- protected override IQueryable GetQueryable()
+ public override Task GetCountAsync(CancellationToken cancellationToken = default)
{
- return ApplyDataFilters(Collection.AsQueryable());
+ return Task.FromResult(Collection.LongCount());
}
}
- public class MemoryDbRepository : MemoryDbRepository, IMemoryDbRepository
+ public class MemoryDbRepository : MemoryDbRepository, IMemoryDbRepository
where TMemoryDbContext : MemoryDbContext
where TEntity : class, IEntity
{
@@ -67,16 +80,16 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
{
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
+ public override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
SetIdIfNeeded(entity);
- return base.Insert(entity, autoSave);
+ return base.InsertAsync(entity, autoSave, cancellationToken);
}
protected virtual void SetIdIfNeeded(TEntity entity)
{
- if (typeof(TKey) == typeof(int) ||
- typeof(TKey) == typeof(long) ||
+ if (typeof(TKey) == typeof(int) ||
+ typeof(TKey) == typeof(long) ||
typeof(TKey) == typeof(Guid))
{
if (EntityHelper.HasDefaultId(entity))
@@ -86,14 +99,9 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
}
}
- public virtual TEntity Find(TKey id, bool includeDetails = true)
- {
- return GetQueryable().FirstOrDefault(e => e.Id.Equals(id));
- }
-
- public virtual TEntity Get(TKey id, bool includeDetails = true)
+ public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
- var entity = Find(id, includeDetails);
+ var entity = await FindAsync(id, includeDetails, cancellationToken);
if (entity == null)
{
@@ -103,31 +111,20 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
return entity;
}
- public virtual Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(Get(id, includeDetails));
- }
-
public virtual Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
- return Task.FromResult(Find(id, includeDetails));
+ return Task.FromResult(GetQueryable().FirstOrDefault(e => e.Id.Equals(id)));
}
- public virtual void Delete(TKey id, bool autoSave = false)
+ public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
- var entity = Find(id);
+ var entity = await FindAsync(id, cancellationToken: cancellationToken);
if (entity == null)
{
return;
}
- Delete(entity);
- }
-
- public virtual Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- Delete(id);
- return Task.CompletedTask;
+ await DeleteAsync(entity, autoSave, cancellationToken);
}
}
}
\ No newline at end of file
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 057f72bbb5..4e8ccaa82e 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
@@ -53,20 +53,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
EntityChangeEventHelper = NullEntityChangeEventHelper.Instance;
}
- public override TEntity Insert(TEntity entity, bool autoSave = false)
- {
- /* EntityCreatedEvent (OnUowCompleted) is triggered as the first because it should be
- * triggered before other events triggered inside an EntityCreating event handler.
- * This is also true for other "ed" & "ing" events.
- */
-
- AsyncHelper.RunSync(() => ApplyAbpConceptsForAddedEntityAsync(entity));
-
- Collection.InsertOne(entity);
-
- return entity;
- }
-
public override async Task InsertAsync(
TEntity entity,
bool autoSave = false,
@@ -82,37 +68,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
return entity;
}
- public override TEntity Update(TEntity entity, bool autoSave = false)
- {
- SetModificationAuditProperties(entity);
-
- if (entity is ISoftDelete softDeleteEntity && softDeleteEntity.IsDeleted)
- {
- SetDeletionAuditProperties(entity);
- AsyncHelper.RunSync(() => TriggerEntityDeleteEventsAsync(entity));
- }
- else
- {
- AsyncHelper.RunSync(() => TriggerEntityUpdateEventsAsync(entity));
- }
-
- AsyncHelper.RunSync(() => TriggerDomainEventsAsync(entity));
-
- var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
-
- var result = Collection.ReplaceOne(
- CreateEntityFilter(entity, true, oldConcurrencyStamp),
- entity
- );
-
- if (result.MatchedCount <= 0)
- {
- ThrowOptimisticConcurrencyException();
- }
-
- return entity;
- }
-
public override async Task UpdateAsync(
TEntity entity,
bool autoSave = false,
@@ -148,37 +103,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
return entity;
}
- public override void Delete(TEntity entity, bool autoSave = false)
- {
- AsyncHelper.RunSync(() => ApplyAbpConceptsForDeletedEntityAsync(entity));
- var oldConcurrencyStamp = SetNewConcurrencyStamp(entity);
-
- if (entity is ISoftDelete softDeleteEntity)
- {
- softDeleteEntity.IsDeleted = true;
- var result = Collection.ReplaceOne(
- CreateEntityFilter(entity, true, oldConcurrencyStamp),
- entity
- );
-
- if (result.MatchedCount <= 0)
- {
- ThrowOptimisticConcurrencyException();
- }
- }
- else
- {
- var result = Collection.DeleteOne(
- CreateEntityFilter(entity, true, oldConcurrencyStamp)
- );
-
- if (result.DeletedCount <= 0)
- {
- ThrowOptimisticConcurrencyException();
- }
- }
- }
-
public override async Task DeleteAsync(
TEntity entity,
bool autoSave = false,
@@ -215,38 +139,16 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
}
}
- public override List GetList(bool includeDetails = false)
- {
- return GetMongoQueryable().ToList();
- }
-
public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken));
}
- public override long GetCount()
- {
- return GetMongoQueryable().LongCount();
- }
-
public override async Task GetCountAsync(CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken));
}
- public override void Delete(Expression> predicate, bool autoSave = false)
- {
- var entities = GetMongoQueryable()
- .Where(predicate)
- .ToList();
-
- foreach (var entity in entities)
- {
- Delete(entity, autoSave);
- }
- }
-
public override async Task DeleteAsync(
Expression> predicate,
bool autoSave = false,
@@ -417,18 +319,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
}
- public virtual TEntity Get(TKey id, bool includeDetails = true)
- {
- var entity = Find(id, includeDetails);
-
- if (entity == null)
- {
- throw new EntityNotFoundException(typeof(TEntity), id);
- }
-
- return entity;
- }
-
public virtual async Task GetAsync(
TKey id,
bool includeDetails = true,
@@ -454,16 +344,6 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
- public virtual TEntity Find(TKey id, bool includeDetails = true)
- {
- return Collection.Find(CreateEntityFilter(id, true)).FirstOrDefault();
- }
-
- public virtual void Delete(TKey id, bool autoSave = false)
- {
- Collection.DeleteOne(CreateEntityFilter(id));
- }
-
public virtual Task DeleteAsync(
TKey id,
bool autoSave = false,
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 1ca6681189..81bd132a5e 100644
--- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs
+++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs
@@ -18,21 +18,6 @@ namespace Volo.Abp.Uow
_defaultOptions = options.Value;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute))
- {
- invocation.Proceed();
- return;
- }
-
- using (var uow = _unitOfWorkManager.Begin(CreateOptions(invocation, unitOfWorkAttribute)))
- {
- invocation.Proceed();
- uow.Complete();
- }
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute))
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 ed8c107005..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,12 +13,6 @@ namespace Volo.Abp.Validation
_methodInvocationValidator = methodInvocationValidator;
}
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- Validate(invocation);
- invocation.Proceed();
- }
-
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
Validate(invocation);
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs
similarity index 88%
rename from framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
rename to framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs
index 8bf86a3ace..96a79d8971 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs
@@ -19,13 +19,13 @@ namespace Volo.Abp.AspNetCore.Mvc
{
//TODO: Refactor to make tests easier.
- public class PersonAppService_Tests : AspNetCoreMvcTestBase
+ public class PeopleAppService_Tests : AspNetCoreMvcTestBase
{
private readonly IRepository _personRepository;
private readonly IJsonSerializer _jsonSerializer;
private readonly IObjectMapper _objectMapper;
- public PersonAppService_Tests()
+ public PeopleAppService_Tests()
{
_personRepository = ServiceProvider.GetRequiredService>();
_jsonSerializer = ServiceProvider.GetRequiredService();
@@ -42,7 +42,7 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task Get_Test()
{
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
var result = await GetResponseAsObjectAsync($"/api/app/people/{firstPerson.Id}");
result.Name.ShouldBe(firstPerson.Name);
@@ -51,7 +51,7 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task Delete_Test()
{
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
await Client.DeleteAsync($"/api/app/people/{firstPerson.Id}");
@@ -89,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc
{
//Arrange
- var firstPerson = _personRepository.First();
+ var firstPerson = (await _personRepository.GetListAsync()).First();
var firstPersonAge = firstPerson.Age; //Persist to a variable since we are using in-memory database which shares same entity.
var updateDto = _objectMapper.Map(firstPerson);
updateDto.Age = updateDto.Age + 1;
@@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc
{
//Arrange
- var personToAddNewPhone = _personRepository.First();
+ var personToAddNewPhone = (await _personRepository.GetListAsync()).First();
var phoneNumberToAdd = RandomHelper.GetRandom(1000000, 9000000).ToString();
//Act
@@ -152,7 +152,7 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task GetPhones_Test()
{
- var douglas = _personRepository.First(p => p.Name == "Douglas");
+ var douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas");
var result = await GetResponseAsObjectAsync>($"/api/app/people/{douglas.Id}/phones");
result.Items.Count.ShouldBe(douglas.Phones.Count);
@@ -161,12 +161,12 @@ namespace Volo.Abp.AspNetCore.Mvc
[Fact]
public async Task DeletePhone_Test()
{
- var douglas = _personRepository.First(p => p.Name == "Douglas");
+ var douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas");
var firstPhone = douglas.Phones.First();
await Client.DeleteAsync($"/api/app/people/{douglas.Id}/phones?number={firstPhone.Number}");
- douglas = _personRepository.First(p => p.Name == "Douglas");
+ douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas");
douglas.Phones.Any(p => p.Number == firstPhone.Number).ShouldBeFalse();
}
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs
index 4d8d51c3c8..705a9a7212 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkTestController.cs
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Shouldly;
-using Volo.Abp.UI;
using Volo.Abp.Uow;
namespace Volo.Abp.AspNetCore.Mvc.Uow
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs
index 3e82da0329..7ed6be1ac2 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/ITodoAppService.cs
@@ -1,9 +1,10 @@
+using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v1
{
public interface ITodoAppService : IApplicationService
{
- string Get(int id);
+ Task GetAsync(int id);
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs
index f3f900148d..eee0248a61 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v1/TodoAppService.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.ApiVersioning;
+using System.Threading.Tasks;
+using Volo.Abp.ApiVersioning;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v1
@@ -12,9 +13,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v1
_requestedApiVersion = requestedApiVersion;
}
- public string Get(int id)
+ public Task GetAsync(int id)
{
- return $"Compat-{id}-{GetVersionOrNone()}";
+ return Task.FromResult($"Compat-{id}-{GetVersionOrNone()}");
}
private string GetVersionOrNone()
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs
index ae4afea6e1..196cc82503 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/ITodoAppService.cs
@@ -1,9 +1,10 @@
+using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v2
{
public interface ITodoAppService : IApplicationService
{
- string Get(int id);
+ Task GetAsync(int id);
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs
index b97af873b7..24f8604227 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/App/v2/TodoAppService.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.ApiVersioning;
+using System.Threading.Tasks;
+using Volo.Abp.ApiVersioning;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v2
@@ -12,9 +13,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.App.v2
_requestedApiVersion = requestedApiVersion;
}
- public string Get(int id)
+ public Task GetAsync(int id)
{
- return id + "-" + GetVersionOrNone();
+ return Task.FromResult(id + "-" + GetVersionOrNone());
}
private string GetVersionOrNone()
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs
index 7b461a3902..f5b86cf7d7 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.AspNetCore.Mvc.Versioning.App.v1;
using Xunit;
@@ -15,9 +16,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v1
}
[Fact]
- public void Get()
+ public async Task GetAsync()
{
- _todoAppService.Get(42).ShouldBe("Compat-42-1.0");
+ (await _todoAppService.GetAsync(42)).ShouldBe("Compat-42-1.0");
}
}
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs
index f4cd122afc..d6b681aa2e 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.AspNetCore.Mvc.Versioning.App.v2;
using Xunit;
@@ -15,9 +16,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v2
}
[Fact]
- public void Get()
+ public async Task GetAsync()
{
- _todoAppService.Get(42).ShouldBe("42-2.0");
+ (await _todoAppService.GetAsync(42)).ShouldBe("42-2.0");
}
}
}
diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs
index fa069348cd..104d75c11b 100644
--- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs
+++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs
@@ -18,11 +18,11 @@ namespace Volo.Abp.Authorization
}
[Fact]
- public void Should_Not_Allow_To_Call_Method_If_Has_No_Permission_ProtectedByClass()
+ public async Task Should_Not_Allow_To_Call_Method_If_Has_No_Permission_ProtectedByClass()
{
- Assert.Throws(() =>
+ await Assert.ThrowsAsync(async () =>
{
- _myAuthorizedService1.ProtectedByClass();
+ await _myAuthorizedService1.ProtectedByClass();
});
}
@@ -36,9 +36,9 @@ namespace Volo.Abp.Authorization
}
[Fact]
- public void Should_Allow_To_Call_Anonymous_Method()
+ public async Task Should_Allow_To_Call_Anonymous_Method()
{
- _myAuthorizedService1.Anonymous().ShouldBe(42);
+ (await _myAuthorizedService1.Anonymous()).ShouldBe(42);
}
[Fact]
diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs
index 0ef6bde8a0..b3841c4fed 100644
--- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs
+++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/IMyAuthorizedService1.cs
@@ -4,11 +4,11 @@ namespace Volo.Abp.Authorization.TestServices
{
public interface IMyAuthorizedService1
{
- int Anonymous();
+ Task Anonymous();
Task AnonymousAsync();
- int ProtectedByClass();
+ Task ProtectedByClass();
Task ProtectedByClassAsync();
}
diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs
index 0b33dd0c98..b1b2a4c43f 100644
--- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs
+++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs
@@ -8,9 +8,9 @@ namespace Volo.Abp.Authorization.TestServices
public class MyAuthorizedService1 : IMyAuthorizedService1, ITransientDependency
{
[AllowAnonymous]
- public virtual int Anonymous()
+ public virtual Task Anonymous()
{
- return 42;
+ return Task.FromResult(42);
}
[AllowAnonymous]
@@ -20,9 +20,9 @@ namespace Volo.Abp.Authorization.TestServices
return 42;
}
- public virtual int ProtectedByClass()
+ public virtual Task ProtectedByClass()
{
- return 42;
+ return Task.FromResult(42);
}
public virtual async Task ProtectedByClassAsync()
diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs
index 27b3bf5d81..c6e9f03927 100644
--- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs
+++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs
@@ -12,7 +12,6 @@ namespace Volo.Abp.DynamicProxy
protected override void BeforeAddApplication(IServiceCollection services)
{
services.AddTransient();
- services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -24,7 +23,6 @@ namespace Volo.Abp.DynamicProxy
if (typeof(SimpleInterceptionTargetClass) == registration.ImplementationType)
{
registration.Interceptors.Add();
- registration.Interceptors.Add();
registration.Interceptors.Add();
}
@@ -48,16 +46,14 @@ namespace Volo.Abp.DynamicProxy
//Assert
- target.Logs.Count.ShouldBe(9);
+ target.Logs.Count.ShouldBe(7);
target.Logs[0].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
- target.Logs[3].ShouldBe("EnterDoItAsync");
- target.Logs[4].ShouldBe("MiddleDoItAsync");
- target.Logs[5].ShouldBe("ExitDoItAsync");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
- target.Logs[7].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[8].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
+ target.Logs[1].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
+ target.Logs[2].ShouldBe("EnterDoItAsync");
+ target.Logs[3].ShouldBe("MiddleDoItAsync");
+ target.Logs[4].ShouldBe("ExitDoItAsync");
+ target.Logs[5].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
+ target.Logs[6].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
}
[Fact]
@@ -73,77 +69,15 @@ namespace Volo.Abp.DynamicProxy
//Assert
- result.ShouldBe(42);
- target.Logs.Count.ShouldBe(9);
- target.Logs[0].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
- target.Logs[3].ShouldBe("EnterGetValueAsync");
- target.Logs[4].ShouldBe("MiddleGetValueAsync");
- target.Logs[5].ShouldBe("ExitGetValueAsync");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
- target.Logs[7].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[8].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
- }
-
- [Fact]
- public void Should_Intercept_Sync_Method_Without_Return_Value()
- {
- //Arrange
-
- var target = ServiceProvider.GetService();
-
- //Act
-
- target.DoIt();
-
- //Assert
- target.Logs.Count.ShouldBe(7);
- target.Logs[0].ShouldBe("SimpleAsyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_Intercept_BeforeInvocation");
- target.Logs[3].ShouldBe("ExecutingDoIt");
- target.Logs[4].ShouldBe("SimpleAsyncInterceptor2_Intercept_AfterInvocation");
- target.Logs[5].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor_Intercept_AfterInvocation");
- }
-
- [Fact]
- public void Should_Intercept_Sync_Method_With_Return_Value()
- {
- //Arrange
-
- var target = ServiceProvider.GetService();
-
- //Act
-
- var result = target.GetValue();
-
- //Assert
-
result.ShouldBe(42);
target.Logs.Count.ShouldBe(7);
- target.Logs[0].ShouldBe("SimpleAsyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[1].ShouldBe("SimpleSyncInterceptor_Intercept_BeforeInvocation");
- target.Logs[2].ShouldBe("SimpleAsyncInterceptor2_Intercept_BeforeInvocation");
- target.Logs[3].ShouldBe("ExecutingGetValue");
- target.Logs[4].ShouldBe("SimpleAsyncInterceptor2_Intercept_AfterInvocation");
- target.Logs[5].ShouldBe("SimpleSyncInterceptor_Intercept_AfterInvocation");
- target.Logs[6].ShouldBe("SimpleAsyncInterceptor_Intercept_AfterInvocation");
- }
-
- [Fact]
- public void Should_Cache_Results()
- {
- //Arrange
-
- var target = ServiceProvider.GetService();
-
- //Act & Assert
-
- target.GetValue(42).ShouldBe(42); //First run, not cached yet
- target.GetValue(43).ShouldBe(42); //First run, cached previous value
- target.GetValue(44).ShouldBe(42); //First run, cached previous value
+ target.Logs[0].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_BeforeInvocation");
+ target.Logs[1].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_BeforeInvocation");
+ target.Logs[2].ShouldBe("EnterGetValueAsync");
+ target.Logs[3].ShouldBe("MiddleGetValueAsync");
+ target.Logs[4].ShouldBe("ExitGetValueAsync");
+ target.Logs[5].ShouldBe("SimpleAsyncInterceptor2_InterceptAsync_AfterInvocation");
+ target.Logs[6].ShouldBe("SimpleAsyncInterceptor_InterceptAsync_AfterInvocation");
}
[Fact]
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 f1f868700a..9427298e62 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,14 +5,7 @@ namespace Volo.Abp.DynamicProxy
{
public class SimpleAsyncInterceptor : AbpInterceptor
{
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_BeforeInvocation");
- invocation.ProceedAsync();
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_AfterInvocation");
- }
-
- public override async 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 1712d316a8..e5e4d39790 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
@@ -12,16 +12,7 @@ namespace Volo.Abp.DynamicProxy
{
_cache = new ConcurrentDictionary();
}
-
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- invocation.ReturnValue = _cache.GetOrAdd(invocation.Method, m =>
- {
- invocation.Proceed();
- return invocation.ReturnValue;
- });
- }
-
+
public override async Task InterceptAsync(IAbpMethodInvocation invocation)
{
if (_cache.ContainsKey(invocation.Method))
diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs
deleted file mode 100644
index fc43e31525..0000000000
--- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Volo.Abp.TestBase.Logging;
-
-namespace Volo.Abp.DynamicProxy
-{
- public class SimpleSyncInterceptor : AbpInterceptor
- {
- public override void Intercept(IAbpMethodInvocation invocation)
- {
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_BeforeInvocation");
- invocation.Proceed();
- (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_Intercept_AfterInvocation");
- }
- }
-}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
index 820a62892e..7e1dd24ae6 100644
--- a/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
+++ b/framework/test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
@@ -239,51 +240,47 @@ namespace Volo.Abp.Domain.Repositories
public class MyTestDefaultRepository : RepositoryBase
where TEntity : class, IEntity
{
- public override TEntity Insert(TEntity entity, bool autoSave = false)
- {
- throw new NotImplementedException();
- }
- public override TEntity Update(TEntity entity, bool autoSave = false)
+ protected override IQueryable GetQueryable()
{
throw new NotImplementedException();
}
- public override void Delete(TEntity entity, bool autoSave = false)
+ public override Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- public override List GetList(bool includeDetails = false)
+ public override Task InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- public override long GetCount()
+ public override Task UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- protected override IQueryable GetQueryable()
+ public override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- }
- public class MyTestDefaultRepository : MyTestDefaultRepository, IRepository
- where TEntity : class, IEntity
- {
- public TEntity Get(TKey id, bool includeDetails = true)
+ public override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
- public Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
+ public override Task GetCountAsync(CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
+ }
- public TEntity Find(TKey id, bool includeDetails = true)
+ public class MyTestDefaultRepository : MyTestDefaultRepository, IRepository
+ where TEntity : class, IEntity
+ {
+ public Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
@@ -293,11 +290,6 @@ namespace Volo.Abp.Domain.Repositories
throw new NotImplementedException();
}
- public void Delete(TKey id, bool autoSave = false)
- {
- throw new NotImplementedException();
- }
-
public Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs
index 02142f06d9..80ece93c07 100644
--- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs
+++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/AbpEfCoreTestSecondContextModule.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore.TestApp.ThirdDbContext;
using Volo.Abp.Modularity;
+using Volo.Abp.Threading;
namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
{
@@ -29,9 +30,9 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
{
using (var scope = context.ServiceProvider.CreateScope())
{
- scope.ServiceProvider
+ AsyncHelper.RunSync(() => scope.ServiceProvider
.GetRequiredService()
- .Build();
+ .BuildAsync());
}
}
}
diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs
index 0b89576f34..c65cd8d7f4 100644
--- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs
+++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
@@ -16,9 +17,9 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
_guidGenerator = guidGenerator;
}
- public void Build()
+ public async Task BuildAsync()
{
- _bookRepository.Insert(
+ await _bookRepository.InsertAsync(
new BookInSecondDbContext(
_guidGenerator.Create(),
"TestBook1"
diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs
index 8ada582fa6..7bc4af2e31 100644
--- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs
+++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs
@@ -1,9 +1,11 @@
using System;
+using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EntityFrameworkCore.TestApp.ThirdDbContext;
using Volo.Abp.TestApp.EntityFrameworkCore;
+using Volo.Abp.Uow;
using Xunit;
namespace Volo.Abp.EntityFrameworkCore
@@ -11,19 +13,26 @@ namespace Volo.Abp.EntityFrameworkCore
public class DbContext_Replace_Tests : EntityFrameworkCoreTestBase
{
private readonly IBasicRepository _dummyRepository;
+ private readonly IUnitOfWorkManager _unitOfWorkManager;
public DbContext_Replace_Tests()
{
_dummyRepository = ServiceProvider.GetRequiredService>();
+ _unitOfWorkManager = ServiceProvider.GetRequiredService();
}
[Fact]
- public void Should_Replace_DbContext()
+ public async Task Should_Replace_DbContext()
{
(ServiceProvider.GetRequiredService |