diff --git a/docs/en/Caching.md b/docs/en/Caching.md index 378e5885e6..8aa9f00657 100644 --- a/docs/en/Caching.md +++ b/docs/en/Caching.md @@ -19,7 +19,7 @@ See [ASP.NET Core's distributed caching document](https://docs.microsoft.com/en- ## `IDistributedCache` Interface -ABP framework defines the generic `IDistributedCache` interface in the [Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching/) package. `TCacheItem` is the type of the object stored in the cache. +ABP framework defines the generic `IDistributedCache` interface in the [Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching/) package. `TCacheItem` is the type of the object stored in the cache. `IDistributedCache` solves the difficulties explained above; @@ -80,6 +80,93 @@ public class BookService : ITransientDependency Other methods of the `IDistributedCache` are same as ASP.NET Core's `IDistributedCache` interface, so you can refer [it's documentation](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed). +## `IDistributedCache` Interface + +`IDistributedCache` interface assumes that the type of your cache key is `string` (so, you need to manually convert your key to string if you need to use a different kind of cache key). `IDistributedCache` can be used when your cache key type is not `string`. + +### Usage + +An example class to store an item in the cache: + +````csharp +public class BookCacheItem +{ + public string Name { get; set; } + + public float Price { get; set; } +} +```` + +Example usage (assumes that your cache key type is `Guid`): + +````csharp +public class BookService : ITransientDependency +{ + private readonly IDistributedCache _cache; + + public BookService(IDistributedCache cache) + { + _cache = cache; + } + + public async Task GetAsync(Guid bookId) + { + return await _cache.GetOrAddAsync( + bookId, //Guid type used as the cache key + async () => await GetBookFromDatabaseAsync(bookId), + () => new DistributedCacheEntryOptions + { + AbsoluteExpiration = DateTimeOffset.Now.AddHours(1) + } + ); + } + private Task GetBookFromDatabaseAsync(Guid bookId) + { + //TODO: get from database + } +} +```` + +* This sample service uses the `GetOrAddAsync()` method to get a book item from the cache. +* Since cache explicitly implemented as using `Guid` as cache key, `Guid` value passed to `_cache_GetOrAddAsync()` method. + +`IDistributedCache` internally uses `ToString()` method of the key object to convert it to a string. If you need to use a complex object as the cache key, you need to override `ToString` method of your class. + +An example class that is used as a cache key: + +````csharp +public class UserInOrganizationCacheKey +{ + public Guid UserId { get; set; } + + public Guid OrganizationId { get; set; } + + //Builds the cache key + public override string ToString() + { + return $"{UserId}_{OrganizationId}"; + } +} +```` + +Example usage: + +````csharp +public class BookService : ITransientDependency +{ + private readonly IDistributedCache _cache; + + public BookService( + IDistributedCache cache) + { + _cache = cache; + } + + ... +} +```` + ### DistributedCacheOptions TODO + diff --git a/docs/en/Index.md b/docs/en/Index.md index b40efffb9d..48935d70c3 100644 --- a/docs/en/Index.md +++ b/docs/en/Index.md @@ -4,18 +4,12 @@ ABP is an **open source application framework** focused on ASP.NET Core based we Explore the left navigation menu to deep dive in the documentation. -## Project Status - -ABP is the **next generation** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. It's currently in preview stage and not ready to use in production. The documentation is still in progress and it is far from complete. - -For short-term and production level applications, it's suggested to use [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework which has rich feature set, mature, actively maintained and up-to-date. - ## Getting Started Easiest way to start a new project with ABP is to use the startup templates: -* [ASP.NET Core MVC (Razor Pages) UI Template](Getting-Started-AspNetCore-MVC-Template.md) -* [Angular UI Template](Getting-Started-Angular-Template.md) +* [ASP.NET Core MVC (Razor Pages) UI Startup Template](Getting-Started-AspNetCore-MVC-Template.md) +* [Angular UI Startup Template](Getting-Started-Angular-Template.md) If you want to start from scratch (with an empty project) then manually install the ABP Framework and use the following tutorials: diff --git a/docs/zh-Hans/AspNetCore/JavaScript-API/Auth.md b/docs/zh-Hans/AspNetCore/JavaScript-API/Auth.md new file mode 100644 index 0000000000..60c9eb8866 --- /dev/null +++ b/docs/zh-Hans/AspNetCore/JavaScript-API/Auth.md @@ -0,0 +1,3 @@ +# abp.auth JavaScript API + +TODO \ No newline at end of file diff --git a/docs/zh-Hans/AspNetCore/JavaScript-API/Index.md b/docs/zh-Hans/AspNetCore/JavaScript-API/Index.md new file mode 100644 index 0000000000..87d3b3021d --- /dev/null +++ b/docs/zh-Hans/AspNetCore/JavaScript-API/Index.md @@ -0,0 +1,24 @@ +# JavaScript API + +ABP为ASP.NET Core MVC / Razor页面应用程序提供了一些执行客户端常见需求的JavaScrpt Api. + +## APIs + +* abp.ajax +* [abp.auth](Auth.md) +* abp.currentUser +* abp.dom +* abp.event +* abp.features +* abp.localization +* abp.log +* abp.ModalManager +* abp.notify +* abp.security +* abp.setting +* abp.ui +* abp.utils +* abp.ResourceLoader +* abp.WidgetManager +* Other APIs + diff --git a/docs/zh-Hans/Authorization.md b/docs/zh-Hans/Authorization.md new file mode 100644 index 0000000000..0a15f6e2ca --- /dev/null +++ b/docs/zh-Hans/Authorization.md @@ -0,0 +1,370 @@ +# 授权 + +授权用于在应用程序中判断是否允许用户执行某些特定的操作. + +ABP扩展了[ASP.NET Core 授权](https://docs.microsoft.com/zh-cn/aspnet/core/security/authorization/introduction), 将 **权限** 添加为自动[策略](https://docs.microsoft.com/zh-cn/aspnet/core/security/authorization/policies)并且使授权系统在 **[应用服务](Application-Services.md)** 同样可用. + +所以ASP.NET Core授权的功能特性和它的文档在基于ABP的应用程序是可用的. +本文中着重介绍在ASP.NET Core授权功能基础上添加的功能. + +## Authorize Attribute + +ASP.NET Core 定义了 [**Authorize**](https://docs.microsoft.com/zh-cn/aspnet/core/security/authorization/simple) attribute 用于在控制器,控制器方法以及页面上授权. 现在ABP将它带到了[应用服务](Application-Services.md). + +示例: + +````csharp +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Services; + +namespace Acme.BookStore +{ + [Authorize] + public class AuthorAppService : ApplicationService, IAuthorAppService + { + public Task> GetListAsync() + { + ... + } + + [AllowAnonymous] + public Task GetAsync(Guid id) + { + ... + } + + [Authorize("BookStore_Author_Create")] + public Task CreateAsync(CreateAuthorDto input) + { + ... + } + } +} + +```` + +* `Authorize` attribute 使用户必须登陆到应用程序才可以访问 `AuthorAppService` 中的方法. 所以`GetListAsync` 方法仅可用于通过身份验证的用户. +* `AllowAnonymous` 禁用身份验证. 所以 `GetAsync` 方法任何人都可以访问,包括未授权的用户. +* `[Authorize("BookStore_Author_Create")]` 定义了一个策略 (参阅 [基于策略的授权](https://docs.microsoft.com/zh-cn/aspnet/core/security/authorization/policies)),它用于检查当前用户的权限. + +"BookStore_Author_Create" 是一个策略名称. 如果你想要使用策略的授权方式,需要在ASP.NET Core授权系统中预先定义它. + +你可以按照ASP.NET Core文档进行实施策略授权,但对于简单的 `true/false` 条件(比如是否授予了用户策略) ABP定义了权限系统,在下一部分中会进行讲解. + +## 权限系统 + +权限系统是为特定用户,角色或客户端授权或禁止的简单策略. + +### 定义权限 + +创建一个继承自 `PermissionDefinitionProvider` 的类,如下所示: + +````csharp +using Volo.Abp.Authorization.Permissions; + +namespace Acme.BookStore.Permissions +{ + public class BookStorePermissionDefinitionProvider : PermissionDefinitionProvider + { + public override void Define(IPermissionDefinitionContext context) + { + var myGroup = context.AddGroup("BookStore"); + + myGroup.AddPermission("BookStore_Author_Create"); + } + } +} +```` + +> ABP会自动发现这个类,不需要进行配置! + +你需要在 `Define` 方法中添加**权限组**或者获取已存在的权限组,并向权限组中添加**权限**. + +在定义权限后就可以在ASP.NET Core权限系统中当做**策略**名称使用. 在角色的权限管理模态框中同样可以看到: + +![authorization-new-permission-ui](images/authorization-new-permission-ui.png) + +* 左边的选项卡显示了 "BookStore" 权限组. +* 右侧的 "BookStore_Author_Create" 是权限名称,在这里可以为角色授权或禁止. + +保存后更改会持久化到数据库并在授权系统使用. + +> 只有在你安装了identity模块时,才会出现上图中的管理对话框. 该模块用于用户和角色的. 启动模板中已经预装identity模块. + +#### 本地化权限名称 + +"BookStore_Author_Create" 名称对于权限系统来说很适合,但对于UI展示会让操作人员费解. 幸运的是 `AddPermission` 和 `AddGroup` 方法提供了 `LocalizableString` 参数: + +````csharp +var myGroup = context.AddGroup( + "BookStore", + LocalizableString.Create("BookStore") +); + +myGroup.AddPermission( + "BookStore_Author_Create", + LocalizableString.Create("Permission:BookStore_Author_Create") +); +```` + +然后在本地化文档中对 "BookStore" 和 "Permission:BookStore_Author_Create" 键添加本地化语言: + +````json +"BookStore": "Book Store", +"Permission:BookStore_Author_Create": "Creating a new author" +```` + +> 有关更多信息请参阅[本地化系统文档](Localization.md). + +下图展示了本地化后的效果: + +![authorization-new-permission-ui-localized](images/authorization-new-permission-ui-localized.png) + +#### 多租户 + +权限系统同样支持在ABP中做为一等公民的 [多租户](Multi-Tenancy.md). 在定义新权限时可以设置多租户选项. 有下面三个值: + +* **Host**: 权限仅适用于宿主. +* **Tenant**: 权限仅适用于租户. +* **Both** (默认): 权限适用与宿主和租户. + +> 如果你的应用程序不是多租户的,可以忽略这个选项. + +`AddPermission` 方法的第三个参数用于设置多租户选项: + +````csharp +myGroup.AddPermission( + "BookStore_Author_Create", + LocalizableString.Create("Permission:BookStore_Author_Create"), + multiTenancySide: MultiTenancySides.Tenant //set multi-tenancy side! +); +```` + +#### 子权限 + +权限可以具有子权限,当你想要创建一个层次结构的权限树时它特别有用. 在这个树中一个权限可能含有子权限,并且子权限只有在授权父权限时才可用. + +定义示例: + +````csharp +var authorManagement = myGroup.AddPermission("Author_Management"); +authorManagement.AddChild("Author_Management_Create_Books"); +authorManagement.AddChild("Author_Management_Edit_Books"); +authorManagement.AddChild("Author_Management_Delete_Books"); +```` + +在页面上如下所示 (你可能想要本地化权限名称): + +![authorization-new-permission-ui-hierarcy](images/authorization-new-permission-ui-hierarcy.png) + +下面的示例代码是一个典型的应用服务: + +````csharp +[Authorize("Author_Management")] +public class AuthorAppService : ApplicationService, IAuthorAppService +{ + public Task> GetListAsync() + { + ... + } + + public Task GetAsync(Guid id) + { + ... + } + + [Authorize("Author_Management_Create_Books")] + public Task CreateAsync(CreateAuthorDto input) + { + ... + } + + [Authorize("Author_Management_Edit_Books")] + public Task UpdateAsync(CreateAuthorDto input) + { + ... + } + + [Authorize("Author_Management_Delete_Books")] + public Task DeleteAsync(CreateAuthorDto input) + { + ... + } +} +```` + +* 拥有`Author_Management`权限的用户可以访问`GetListAsync`和 `GetAsync`方法. +* 示例中的其他方法需要额外的权限. + +### 自定义策略覆盖已有权限 + +有时我们需要扩展扩展应用程序中预构建模块的权限,可以定义并注册一个与权限名称相同的策略到ASP.Net Core授权系统,策略会覆盖已有权限. + +参阅 [基于策略的授权](https://docs.microsoft.com/zh-cn/aspnet/core/security/authorization/policies) 文档了解如何自定义策略. + +## IAuthorizationService + +ASP.NET Core 提供了 `IAuthorizationService` 用于检查权限. 注入后使用它进行条件控制权限. + +示例: + +````csharp +public async Task CreateAsync(CreateAuthorDto input) +{ + var result = await AuthorizationService + .AuthorizeAsync("Author_Management_Create_Books"); + if (result.Succeeded == false) + { + //throw exception + throw new AbpAuthorizationException("..."); + } + + //continue to the normal flow... +} +```` + +> 因为应用服务会经常检查权限,`ApplicationService` 已经属性注入了`AuthorizationService`, 所有继承自 `ApplicationService` 的类都可以直接使用. 你也可以直接 [注入](Dependency-Injection.md)到类中. + +上面的示例代码是检查权限的标准代码,ABP提供了一种简化的方式来编写它. + +示例: + +````csharp +public async Task CreateAsync(CreateAuthorDto input) +{ + await AuthorizationService.CheckAsync("Author_Management_Create_Books"); + + //continue to the normal flow... +} +```` + +如果未授权 `CheckAsync` 扩展方法会抛出 `AbpAuthorizationException` 异常. 还有一个 `IsGrantedAsync` 扩展方法会返回 `true` 或 `false`. + +`IAuthorizationService` 中有多个 `AuthorizeAsync` 方法重载. [ASP.NET Core 授权文档](https://docs.microsoft.com/zh-cn/aspnet/core/security/authorization/introduction)中有详细的解释. + +> 提示: 尽可能使用声明式的 `Authorize` attribute,因为它比较简单不会侵入方法内部. 如果你需要在业务代码中有条件的检查权限,那么请使用 `IAuthorizationService`. + +### 在JavaScript中检查权限 + +有时你会需要在客户端检查策略/权限. 在ASP.NET Core MVC/Razor页面应用程序可以使用 `abp.auth` API. 示例: + +````js +abp.auth.isGranted('MyPermissionName'); +```` + +参阅 [abp.auth](AspNetCore/JavaScript-API/Auth.md) API 文档了解详情. + +## 权限管理 + +通常权限管理是管理员用户使用权限管理模态框进行授权: + +![authorization-new-permission-ui-localized](images/authorization-new-permission-ui-localized.png) + +如果你想要通过代码管理权限, 可以注入使用 `IPermissionManager`. 如下所示: + +````csharp +public class MyService : ITransientDependency +{ + private readonly IPermissionManager _permissionManager; + + public MyService(IPermissionManager permissionManager) + { + _permissionManager = permissionManager; + } + + public async Task GrantPermissionForUserAsync(Guid userId, string permissionName) + { + await _permissionManager.SetForUserAsync(userId, permissionName, true); + } + + public async Task ProhibitPermissionForUserAsync(Guid userId, string permissionName) + { + await _permissionManager.SetForUserAsync(userId, permissionName, false); + } +} +```` + +`SetForUserAsync` 方法用于设置用户的权限 (true/false). 类似的还有 `SetForRoleAsync` 和 `SetForClientAsync` 扩展方法. + +`IPermissionManager` 由权限管理模块定义, 更多信息请参阅 [权限管理模块文档](Modules/Permission-Management.md). + +## 高级主题 + +### Permission Value Providers + +权限检查是可扩展的. 继承自 `PermissionValueProvider` (或实现 `IPermissionValueProvider`) 的任何类都可以参与权限检查. 有三个预定义的Provider: + +* `UserPermissionValueProvider` 从当前的声明中拿到当前用户ID并检查用户授权. 用户声明由 `AbpClaimTypes.UserId` 静态属性定义. +* `RolePermissionValueProvider` 从当前的声明中拿到授予当前用户的角色集合并且判断角色是否具有指定的权限. 角色声明由 `AbpClaimTypes.Role` 静态属性定义. +* `ClientPermissionValueProvider` 从当前声明中拿到当前客户端并检查客户端是否具有指定的权限. 这在没有当前登录用户的客户端交互特别有用. 客户端声明由 `AbpClaimTypes.ClientId` 静态属性定义. + +你可以定义自己的`PermissionValueProvider`扩展权限检查系统. + +示例: + +````csharp +public class SystemAdminPermissionValueProvider : PermissionValueProvider +{ + public SystemAdminPermissionValueProvider(IPermissionStore permissionStore) + : base(permissionStore) + { + } + + public override string Name => "SystemAdmin"; + + public override async Task + CheckAsync(PermissionValueCheckContext context) + { + if (context.Principal?.FindFirst("User_Type")?.Value == "SystemAdmin") + { + return PermissionGrantResult.Granted; + } + + return PermissionGrantResult.Undefined; + } +} +```` + +示例`SystemAdminPermissionValueProvider`允许声明`User_Type`值为`SystemAdmin`的用户授予所有权限. 通常在`Provider`中使用当前声明和 `IPermissionStore`. + +`PermissionValueProvider` 的 `CheckAsync` 应该返回下面三个值之一: + +* `PermissionGrantResult.Granted` 授予用户权限,如果没有其他的授权值提供程序返回 `Prohibited`, 那么最后会返回 `Granted`. +* `PermissionGrantResult.Prohibited` 禁止授权用户,任何一个授权值提供程序返回了 `Prohibited`, 那么其他的提供程序返回的值都不再重要. +* `PermissionGrantResult.Undefined` 代表当前无法确定是否授予或禁止权限, 返回`UnDefined`由其他权限值提供程序检查权限. + +定义`Provider`后将其添加到 `PermissionOptions`,如下所示: + +````csharp +Configure(options => +{ + options.ValueProviders.Add(); +}); +```` + +### Permission Store + +`IPermissionStore` 是唯一需要从持久化源(通常是数据库)中读取权限值的接口. 它的实现在权限管理模块. 参见 [权限管理模块](Modules/Permission-Management.md) 了解更多信息 + +### AlwaysAllowAuthorizationService + +`AlwaysAllowAuthorizationService` 类可以绕过授权服务. 通常用于在需要禁用授权系统的集成测试中. + +使用 `IServiceCollection.AddAlwaysAllowAuthorization()` 扩展方法将 `AlwaysAllowAuthorizationService` 注册到 [依赖注入](Dependency-Injection.md) 系统中: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + context.Services.AddAlwaysAllowAuthorization(); +} +```` + +启动模板的集成测试已经禁用了授权服务. + +## 接下来 + +* [权限管理模块](Modules/Permission-Management.md) +* [ASP.NET Core MVC / Razor 页面 JavaScript Auth API](AspNetCore/JavaScript-API/Auth.md) diff --git a/docs/zh-Hans/JavaScript/Dynamic-JavaScript-API-Clients.md b/docs/zh-Hans/JavaScript/Dynamic-JavaScript-API-Clients.md new file mode 100644 index 0000000000..539d3ac15a --- /dev/null +++ b/docs/zh-Hans/JavaScript/Dynamic-JavaScript-API-Clients.md @@ -0,0 +1,3 @@ +## Dynamic JavaScript API Clients + +TODO \ No newline at end of file diff --git a/docs/zh-Hans/Modules/Permission-Management.md b/docs/zh-Hans/Modules/Permission-Management.md new file mode 100644 index 0000000000..ac8a9a55a2 --- /dev/null +++ b/docs/zh-Hans/Modules/Permission-Management.md @@ -0,0 +1,3 @@ +# 权限管理模块 + +TODO \ No newline at end of file diff --git a/docs/zh-Hans/images/authorization-new-permission-ui-hierarcy.png b/docs/zh-Hans/images/authorization-new-permission-ui-hierarcy.png new file mode 100644 index 0000000000..078d67d50f Binary files /dev/null and b/docs/zh-Hans/images/authorization-new-permission-ui-hierarcy.png differ diff --git a/docs/zh-Hans/images/authorization-new-permission-ui-localized.png b/docs/zh-Hans/images/authorization-new-permission-ui-localized.png new file mode 100644 index 0000000000..610ce39faf Binary files /dev/null and b/docs/zh-Hans/images/authorization-new-permission-ui-localized.png differ diff --git a/docs/zh-Hans/images/authorization-new-permission-ui.png b/docs/zh-Hans/images/authorization-new-permission-ui.png new file mode 100644 index 0000000000..554f27e78d Binary files /dev/null and b/docs/zh-Hans/images/authorization-new-permission-ui.png differ diff --git a/docs/zh-Hans/images/create-aspnet-core-application.png b/docs/zh-Hans/images/create-aspnet-core-application.png new file mode 100644 index 0000000000..5813cf38e9 Binary files /dev/null and b/docs/zh-Hans/images/create-aspnet-core-application.png differ diff --git a/docs/zh-Hans/images/create-new-aspnet-core-application-v2.png b/docs/zh-Hans/images/create-new-aspnet-core-application-v2.png new file mode 100644 index 0000000000..f8274ae2a4 Binary files /dev/null and b/docs/zh-Hans/images/create-new-aspnet-core-application-v2.png differ diff --git a/docs/zh-Hans/images/select-empty-web-application-v2.png b/docs/zh-Hans/images/select-empty-web-application-v2.png new file mode 100644 index 0000000000..da32f71857 Binary files /dev/null and b/docs/zh-Hans/images/select-empty-web-application-v2.png differ diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerScriptContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerScriptContributor.cs index 241822facf..8de698c723 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerScriptContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerScriptContributor.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Timeago protected virtual bool TryAddCultureFile(BundleConfigurationContext context, string cultureName) { - var filePath = $"/libs/bootstrap-datepicker/locales/bootstrap-datepicker.{cultureName}.js"; + var filePath = $"/libs/bootstrap-datepicker/locales/bootstrap-datepicker.{cultureName}.min.js"; if (!context.FileProvider.GetFileInfo(filePath).Exists) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FontAwesome/FontAwesomeStyleContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FontAwesome/FontAwesomeStyleContributor.cs index 7f01e15859..a3270f8d70 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FontAwesome/FontAwesomeStyleContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FontAwesome/FontAwesomeStyleContributor.cs @@ -7,7 +7,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.FontAwesome { public override void ConfigureBundle(BundleConfigurationContext context) { - context.Files.AddIfNotContains("/libs/font-awesome/css/font-awesome.css"); + context.Files.AddIfNotContains("/libs/@fortawesome/fontawesome-free/css/all.css"); + context.Files.AddIfNotContains("/libs/@fortawesome/fontawesome-free/css/v4-shims.css"); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml index 7e855834da..7b43c6d969 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml @@ -14,7 +14,7 @@ @using Volo.Abp.MultiTenancy @inject IAbpAntiForgeryManager AbpAntiForgeryManager @inject IBrandingProvider BrandingProvider -@inject IOptions MultiTenancyOptions +@inject IOptions MultiTenancyOptions @inject ICurrentTenant CurrentTenant @inject IStringLocalizer MultiTenancyStringLocalizer @inject ITenantResolveResultAccessor TenantResolveResultAccessor diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs index a300e40968..ca87f2b962 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs @@ -26,11 +26,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation return; } - using (AbpCrossCuttingConcerns.Applying(context.Controller, AbpCrossCuttingConcerns.Validation)) - { - _validator.Validate(context.ModelState); - await next(); - } + _validator.Validate(context.ModelState); + await next(); } } } diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs index ecb641df34..33e685ac4e 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs @@ -1,6 +1,4 @@ -using System; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; +using Microsoft.AspNetCore.Hosting; namespace Microsoft.Extensions.DependencyInjection { @@ -10,19 +8,5 @@ namespace Microsoft.Extensions.DependencyInjection { return services.GetSingletonInstance(); } - - [Obsolete] - public static IConfigurationRoot BuildConfiguration(this IServiceCollection services, AbpConfigurationBuilderOptions options = null) - { - return services.GetHostingEnvironment().BuildConfiguration(options); - } - - [Obsolete] - public static IConfigurationRoot AddConfiguration(this IServiceCollection services, AbpConfigurationBuilderOptions options = null) - { - var configuration = services.BuildConfiguration(options); - services.SetConfiguration(configuration); - return configuration; - } } } diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs index f7cc0710e7..298fffd20e 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs @@ -29,11 +29,6 @@ namespace Volo.Abp.AspNetCore )] public class AbpAspNetCoreModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddConfiguration(); - } - public override void ConfigureServices(ServiceConfigurationContext context) { Configure(options => 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 45cb2ec39d..74314e815d 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.DynamicProxy; using Volo.Abp.Threading; @@ -17,24 +16,12 @@ namespace Volo.Abp.Authorization public override void Intercept(IAbpMethodInvocation invocation) { - if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.Authorization)) - { - invocation.Proceed(); - return; - } - AsyncHelper.RunSync(() => AuthorizeAsync(invocation)); invocation.Proceed(); } public override async Task InterceptAsync(IAbpMethodInvocation invocation) { - if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.Authorization)) - { - await invocation.ProceedAsync(); - return; - } - await AuthorizeAsync(invocation); await invocation.ProceedAsync(); } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs index 87b391443d..d6975e38ec 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Authorization.Permissions { public class ClientPermissionValueProvider : PermissionValueProvider { - public const string ProviderName = "Client"; + public const string ProviderName = "C"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs index 314e88411a..b98867a78e 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs @@ -6,7 +6,7 @@ namespace Volo.Abp.Authorization.Permissions { public class RolePermissionValueProvider : PermissionValueProvider { - public const string ProviderName = "Role"; + public const string ProviderName = "R"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs index f04a85910f..c7f327c40c 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Authorization.Permissions { public class UserPermissionValueProvider : PermissionValueProvider { - public const string ProviderName = "User"; + public const string ProviderName = "U"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCacheOptions.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCacheOptions.cs deleted file mode 100644 index 09e319c551..0000000000 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCacheOptions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.Extensions.Caching.Distributed; -using System; -using System.Collections.Generic; - -namespace Volo.Abp.Caching -{ - public class AbpCacheOptions - { - /// - /// Cache key prefix. - /// - public string KeyPrefix { get; set; } - - /// - /// Global Cache entry options. - /// - public DistributedCacheEntryOptions GlobalCacheEntryOptions { get; set; } - - /// - /// List of all cache configurators. - /// (func argument:Name of cache) - /// - public List> CacheConfigurators { get; set; } //TODO list item use a configurator interface instead? - - public AbpCacheOptions() - { - CacheConfigurators = new List>(); - GlobalCacheEntryOptions = new DistributedCacheEntryOptions(); - KeyPrefix = ""; - } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs index 04a29d5fb2..ba59bf039e 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs @@ -21,8 +21,9 @@ namespace Volo.Abp.Caching context.Services.AddDistributedMemoryCache(); context.Services.AddSingleton(typeof(IDistributedCache<>), typeof(DistributedCache<>)); + context.Services.AddSingleton(typeof(IDistributedCache<,>), typeof(DistributedCache<,>)); - context.Services.Configure(cacheOptions => + context.Services.Configure(cacheOptions => { cacheOptions.GlobalCacheEntryOptions.SlidingExpiration = TimeSpan.FromMinutes(20); }); diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpDistributedCacheOptions.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpDistributedCacheOptions.cs index 7f79d0f001..1ba432c959 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpDistributedCacheOptions.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpDistributedCacheOptions.cs @@ -1,4 +1,8 @@ -namespace Volo.Abp.Caching +using System; +using System.Collections.Generic; +using Microsoft.Extensions.Caching.Distributed; + +namespace Volo.Abp.Caching { public class AbpDistributedCacheOptions { @@ -6,5 +10,28 @@ /// Throw or hide exceptions for the distributed cache. /// public bool HideErrors { get; set; } = true; + + /// + /// Cache key prefix. + /// + public string KeyPrefix { get; set; } + + /// + /// Global Cache entry options. + /// + public DistributedCacheEntryOptions GlobalCacheEntryOptions { get; set; } + + /// + /// List of all cache configurators. + /// (func argument:Name of cache) + /// + public List> CacheConfigurators { get; set; } //TODO: use a configurator interface instead? + + public AbpDistributedCacheOptions() + { + CacheConfigurators = new List>(); + GlobalCacheEntryOptions = new DistributedCacheEntryOptions(); + KeyPrefix = ""; + } } } diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs index 990d4e4ef7..4140cceeb3 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs @@ -15,10 +15,34 @@ namespace Volo.Abp.Caching /// Represents a distributed cache of type. /// /// The type of cache item being cached. - public class DistributedCache : IDistributedCache + public class DistributedCache : DistributedCache, IDistributedCache where TCacheItem : class { - public ILogger> Logger { get; set; } + public DistributedCache( + IOptions distributedCacheOption, + IDistributedCache cache, + ICancellationTokenProvider cancellationTokenProvider, + IDistributedCacheSerializer serializer, + ICurrentTenant currentTenant) : base( + distributedCacheOption: distributedCacheOption, + cache: cache, + cancellationTokenProvider: cancellationTokenProvider, + serializer: serializer, + currentTenant: currentTenant) + { + } + + } + /// + /// Represents a distributed cache of type. + /// Uses a generic cache key type of type. + /// + /// The type of cache item being cached. + /// The type of cache key being used. + public class DistributedCache : IDistributedCache + where TCacheItem : class + { + public ILogger> Logger { get; set; } protected string CacheName { get; set; } @@ -36,12 +60,9 @@ namespace Volo.Abp.Caching protected DistributedCacheEntryOptions DefaultCacheOptions; - private readonly AbpCacheOptions _cacheOption; - private readonly AbpDistributedCacheOptions _distributedCacheOption; public DistributedCache( - IOptions cacheOption, IOptions distributedCacheOption, IDistributedCache cache, ICancellationTokenProvider cancellationTokenProvider, @@ -49,10 +70,9 @@ namespace Volo.Abp.Caching ICurrentTenant currentTenant) { _distributedCacheOption = distributedCacheOption.Value; - _cacheOption = cacheOption.Value; Cache = cache; CancellationTokenProvider = cancellationTokenProvider; - Logger = NullLogger>.Instance; + Logger = NullLogger>.Instance; Serializer = serializer; CurrentTenant = currentTenant; @@ -60,7 +80,41 @@ namespace Volo.Abp.Caching SetDefaultOptions(); } + protected virtual string NormalizeKey(TCacheKey key) + { + var normalizedKey = "c:" + CacheName + ",k:" + _distributedCacheOption.KeyPrefix + key.ToString(); + if (!IgnoreMultiTenancy && CurrentTenant.Id.HasValue) + { + normalizedKey = "t:" + CurrentTenant.Id.Value + "," + normalizedKey; + } + + return normalizedKey; + } + + protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions() + { + foreach (var configure in _distributedCacheOption.CacheConfigurators) + { + var options = configure.Invoke(CacheName); + if (options != null) + { + return options; + } + } + return _distributedCacheOption.GlobalCacheEntryOptions; + } + + protected virtual void SetDefaultOptions() + { + CacheName = CacheNameAttribute.GetCacheName(typeof(TCacheItem)); + + //IgnoreMultiTenancy + IgnoreMultiTenancy = typeof(TCacheItem).IsDefined(typeof(IgnoreMultiTenancyAttribute), true); + + //Configure default cache entry options + DefaultCacheOptions = GetDefaultCacheEntryOptions(); + } /// /// Gets a cache item with the given key. If no cache item is found for the given key then returns null. /// @@ -68,7 +122,7 @@ namespace Volo.Abp.Caching /// Indicates to throw or hide the exceptions for the distributed cache. /// The cache item, or null. public virtual TCacheItem Get( - string key, + TCacheKey key, bool? hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -106,8 +160,8 @@ namespace Volo.Abp.Caching /// The for the task. /// The cache item, or null. public virtual async Task GetAsync( - string key, - bool? hideErrors = null, + TCacheKey key, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -131,7 +185,7 @@ namespace Volo.Abp.Caching throw; } - + if (cachedBytes == null) { return null; @@ -139,7 +193,6 @@ namespace Volo.Abp.Caching return Serializer.Deserialize(cachedBytes); } - /// /// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item /// provided by delegate and returns the provided cache item. @@ -149,10 +202,10 @@ namespace Volo.Abp.Caching /// The cache options for the factory delegate. /// Indicates to throw or hide the exceptions for the distributed cache. /// The cache item. - public TCacheItem GetOrAdd( - string key, - Func factory, - Func optionsFactory = null, + public virtual TCacheItem GetOrAdd( + TCacheKey key, + Func factory, + Func optionsFactory = null, bool? hideErrors = null) { var value = Get(key, hideErrors); @@ -175,7 +228,6 @@ namespace Volo.Abp.Caching return value; } - /// /// Gets or Adds a cache item with the given key. If no cache item is found for the given key then adds a cache item /// provided by delegate and returns the provided cache item. @@ -186,11 +238,11 @@ namespace Volo.Abp.Caching /// Indicates to throw or hide the exceptions for the distributed cache. /// The for the task. /// The cache item. - public async Task GetOrAddAsync( - string key, - Func> factory, - Func optionsFactory = null, - bool? hideErrors = null, + public virtual async Task GetOrAddAsync( + TCacheKey key, + Func> factory, + Func optionsFactory = null, + bool? hideErrors = null, CancellationToken token = default) { token = CancellationTokenProvider.FallbackToProvider(token); @@ -214,7 +266,6 @@ namespace Volo.Abp.Caching return value; } - /// /// Sets the cache item value for the provided key. /// @@ -223,9 +274,9 @@ namespace Volo.Abp.Caching /// The cache options for the value. /// Indicates to throw or hide the exceptions for the distributed cache. public virtual void Set( - string key, - TCacheItem value, - DistributedCacheEntryOptions options = null, + TCacheKey key, + TCacheItem value, + DistributedCacheEntryOptions options = null, bool? hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -249,7 +300,6 @@ namespace Volo.Abp.Caching throw; } } - /// /// Sets the cache item value for the provided key. /// @@ -260,10 +310,10 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. public virtual async Task SetAsync( - string key, - TCacheItem value, - DistributedCacheEntryOptions options = null, - bool? hideErrors = null, + TCacheKey key, + TCacheItem value, + DistributedCacheEntryOptions options = null, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -288,15 +338,14 @@ namespace Volo.Abp.Caching throw; } } - /// /// Refreshes the cache value of the given key, and resets its sliding expiration timeout. /// /// The key of cached item to be retrieved from the cache. /// Indicates to throw or hide the exceptions for the distributed cache. public virtual void Refresh( - string key, - bool? hideErrors = null) + TCacheKey key, bool? + hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -315,7 +364,6 @@ namespace Volo.Abp.Caching throw; } } - /// /// Refreshes the cache value of the given key, and resets its sliding expiration timeout. /// @@ -324,8 +372,8 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. public virtual async Task RefreshAsync( - string key, - bool? hideErrors = null, + TCacheKey key, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -345,15 +393,13 @@ namespace Volo.Abp.Caching throw; } } - - /// /// Removes the cache item for given key from cache. /// /// The key of cached item to be retrieved from the cache. /// Indicates to throw or hide the exceptions for the distributed cache. public virtual void Remove( - string key, + TCacheKey key, bool? hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -372,7 +418,6 @@ namespace Volo.Abp.Caching throw; } } - /// /// Removes the cache item for given key from cache. /// @@ -381,8 +426,8 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. public virtual async Task RemoveAsync( - string key, - bool? hideErrors = null, + TCacheKey key, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -401,42 +446,8 @@ namespace Volo.Abp.Caching throw; } - } - - protected virtual string NormalizeKey(string key) - { - var normalizedKey = "c:" + CacheName + ",k:" + _cacheOption.KeyPrefix + key; - - if (!IgnoreMultiTenancy && CurrentTenant.Id.HasValue) - { - normalizedKey = "t:" + CurrentTenant.Id.Value + "," + normalizedKey; - } - - return normalizedKey; - } - - protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions() - { - foreach (var configure in _cacheOption.CacheConfigurators) - { - var options = configure.Invoke(CacheName); - if (options != null) - { - return options; - } - } - return _cacheOption.GlobalCacheEntryOptions; - } - - protected virtual void SetDefaultOptions() - { - CacheName = CacheNameAttribute.GetCacheName(typeof(TCacheItem)); - - //IgnoreMultiTenancy - IgnoreMultiTenancy = typeof(TCacheItem).IsDefined(typeof(IgnoreMultiTenancyAttribute), true); - - //Configure default cache entry options - DefaultCacheOptions = GetDefaultCacheEntryOptions(); - } - } + } + + } + } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs index 23bd6f4cf2..163da05632 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs @@ -10,7 +10,18 @@ namespace Volo.Abp.Caching /// Represents a distributed cache of type. /// /// The type of cache item being cached. - public interface IDistributedCache + public interface IDistributedCache : IDistributedCache + where TCacheItem : class + { + + } + /// + /// Represents a distributed cache of type. + /// Uses a generic cache key type of type. + /// + /// The type of cache item being cached. + /// The type of cache key being used. + public interface IDistributedCache where TCacheItem : class { /// @@ -20,7 +31,7 @@ namespace Volo.Abp.Caching /// Indicates to throw or hide the exceptions for the distributed cache. /// The cache item, or null. TCacheItem Get( - string key, + TCacheKey key, bool? hideErrors = null ); @@ -32,7 +43,7 @@ namespace Volo.Abp.Caching /// The for the task. /// The cache item, or null. Task GetAsync( - [NotNull] string key, + [NotNull] TCacheKey key, bool? hideErrors = null, CancellationToken token = default ); @@ -47,7 +58,7 @@ namespace Volo.Abp.Caching /// Indicates to throw or hide the exceptions for the distributed cache. /// The cache item. TCacheItem GetOrAdd( - string key, + TCacheKey key, Func factory, Func optionsFactory = null, bool? hideErrors = null @@ -64,7 +75,7 @@ namespace Volo.Abp.Caching /// The for the task. /// The cache item. Task GetOrAddAsync( - [NotNull] string key, + [NotNull] TCacheKey key, Func> factory, Func optionsFactory = null, bool? hideErrors = null, @@ -79,7 +90,7 @@ namespace Volo.Abp.Caching /// The cache options for the value. /// Indicates to throw or hide the exceptions for the distributed cache. void Set( - string key, + TCacheKey key, TCacheItem value, DistributedCacheEntryOptions options = null, bool? hideErrors = null @@ -95,7 +106,7 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. Task SetAsync( - [NotNull] string key, + [NotNull] TCacheKey key, [NotNull] TCacheItem value, [CanBeNull] DistributedCacheEntryOptions options = null, bool? hideErrors = null, @@ -108,7 +119,7 @@ namespace Volo.Abp.Caching /// The key of cached item to be retrieved from the cache. /// Indicates to throw or hide the exceptions for the distributed cache. void Refresh( - string key, + TCacheKey key, bool? hideErrors = null ); @@ -120,7 +131,7 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. Task RefreshAsync( - string key, + TCacheKey key, bool? hideErrors = null, CancellationToken token = default ); @@ -131,7 +142,7 @@ namespace Volo.Abp.Caching /// The key of cached item to be retrieved from the cache. /// Indicates to throw or hide the exceptions for the distributed cache. void Remove( - string key, + TCacheKey key, bool? hideErrors = null ); @@ -143,7 +154,7 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. Task RemoveAsync( - string key, + TCacheKey key, bool? hideErrors = null, CancellationToken token = default ); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj index df991857dc..eacd952e35 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj +++ b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj @@ -15,10 +15,10 @@ - - - - + + + + diff --git a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj index 01d1a210ef..5f16964cef 100644 --- a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj +++ b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationBuilderOptions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationBuilderOptions.cs index b9ca026791..93c9fe26c1 100644 --- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationBuilderOptions.cs +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationBuilderOptions.cs @@ -35,5 +35,10 @@ namespace Microsoft.Extensions.Configuration /// Prefix for the environment variables. /// public string EnvironmentVariablesPrefix { get; set; } + + /// + /// Command line arguments. + /// + public string[] CommandLineArgs { get; set; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs index 6c0fe12b15..44b75d1adb 100644 --- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs @@ -5,7 +5,8 @@ namespace Microsoft.Extensions.Configuration { public static class ConfigurationHelper { - public static IConfigurationRoot BuildConfiguration(AbpConfigurationBuilderOptions options = null) + public static IConfigurationRoot BuildConfiguration( + AbpConfigurationBuilderOptions options = null) { options = options ?? new AbpConfigurationBuilderOptions(); @@ -22,8 +23,6 @@ namespace Microsoft.Extensions.Configuration { builder = builder.AddJsonFile($"{options.FileName}.{options.EnvironmentName}.json", optional: true, reloadOnChange: true); } - - builder = builder.AddEnvironmentVariables(options.EnvironmentVariablesPrefix); if (options.EnvironmentName == "Development") { @@ -37,6 +36,13 @@ namespace Microsoft.Extensions.Configuration } } + builder = builder.AddEnvironmentVariables(options.EnvironmentVariablesPrefix); + + if (options.CommandLineArgs != null) + { + builder = builder.AddCommandLine(options.CommandLineArgs); + } + return builder.Build(); } } diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionConfigurationExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionConfigurationExtensions.cs index 97a6ed4189..bcd3892e87 100644 --- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionConfigurationExtensions.cs +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionConfigurationExtensions.cs @@ -1,20 +1,17 @@ -using System; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; -using Volo.Abp.Configuration; namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionConfigurationExtensions { - [Obsolete] - public static IServiceCollection SetConfiguration(this IServiceCollection services, IConfigurationRoot configurationRoot) + public static IServiceCollection ReplaceConfiguration(this IServiceCollection services, IConfiguration configuration) { - return services.Replace(ServiceDescriptor.Singleton(new DefaultConfigurationAccessor(configurationRoot))); + return services.Replace(ServiceDescriptor.Singleton(configuration)); } - public static IConfigurationRoot GetConfiguration(this IServiceCollection services) + public static IConfiguration GetConfiguration(this IServiceCollection services) { var hostBuilderContext = services.GetSingletonInstanceOrNull(); if (hostBuilderContext?.Configuration != null) @@ -22,7 +19,7 @@ namespace Microsoft.Extensions.DependencyInjection return hostBuilderContext.Configuration as IConfigurationRoot; } - return services.GetSingletonInstance().Configuration; + return services.GetSingletonInstance(); } } } diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj index 7d6562e478..475525c41d 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -17,6 +17,7 @@ + diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Aspects/AbpCrossCuttingConcerns.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Aspects/AbpCrossCuttingConcerns.cs index 4c8033a0cf..8c861884e8 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Aspects/AbpCrossCuttingConcerns.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Aspects/AbpCrossCuttingConcerns.cs @@ -9,9 +9,7 @@ namespace Volo.Abp.Aspects //TODO: Move these constants to their own assemblies! public const string Auditing = "AbpAuditing"; - public const string Validation = "AbpValidation"; public const string UnitOfWork = "AbpUnitOfWork"; - public const string Authorization = "AbpAuthorization"; public const string FeatureChecking = "AbpFeatureChecking"; public static void AddApplied(object obj, params string[] concerns) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/DefaultConfigurationAccessor.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/DefaultConfigurationAccessor.cs deleted file mode 100644 index 318972f549..0000000000 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/DefaultConfigurationAccessor.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.Extensions.Configuration; - -namespace Volo.Abp.Configuration -{ - public class DefaultConfigurationAccessor : IConfigurationAccessor - { - public static DefaultConfigurationAccessor Empty { get; } - - public virtual IConfigurationRoot Configuration { get; } - - static DefaultConfigurationAccessor() - { - Empty = new DefaultConfigurationAccessor( - new ConfigurationBuilder().Build() - ); - } - - public DefaultConfigurationAccessor(IConfigurationRoot configuration) - { - Configuration = configuration; - } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs deleted file mode 100644 index 34e5d96692..0000000000 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using Microsoft.Extensions.Configuration; - -namespace Volo.Abp.Configuration -{ - [Obsolete("IConfigurationAccessor will be removed in v1.0. Use IConfiguration instead (be use that you are using generic host just like the startup templates).")] - public interface IConfigurationAccessor - { - IConfigurationRoot Configuration { get; } - } -} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs index 7407f67bd6..83a7ec163e 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Volo.Abp.Configuration; using Volo.Abp.Modularity; using Volo.Abp.Reflection; @@ -24,17 +23,13 @@ namespace Volo.Abp.Internal var assemblyFinder = new AssemblyFinder(abpApplication); var typeFinder = new TypeFinder(assemblyFinder); - var configurationAccessor = new DefaultConfigurationAccessor( - ConfigurationHelper.BuildConfiguration( - applicationCreationOptions.Configuration - ) - ); - - services.TryAddSingleton(configurationAccessor); - if (!services.IsAdded()) { - services.AddSingleton(configurationAccessor.Configuration); + services.ReplaceConfiguration( + ConfigurationHelper.BuildConfiguration( + applicationCreationOptions.Configuration + ) + ); } services.TryAddSingleton(moduleLoader); diff --git a/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj b/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj index 0b9ba3f9a9..f7b9d76169 100644 --- a/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj +++ b/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/DefaultValueSettingValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/DefaultValueSettingValueProvider.cs index 275be89af2..48b01f0299 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/DefaultValueSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/DefaultValueSettingValueProvider.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.Features { public class DefaultValueFeatureValueProvider : FeatureValueProvider //TODO: Directly implement IFeatureValueProvider { - public const string ProviderName = "Default"; + public const string ProviderName = "D"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs index ef22197f8a..ee6150d403 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs @@ -6,7 +6,7 @@ namespace Volo.Abp.Features { public class EditionFeatureValueProvider : FeatureValueProvider { - public const string ProviderName = "Edition"; + public const string ProviderName = "E"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs index 211174516c..d403acb993 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Features { public class TenantFeatureValueProvider : FeatureValueProvider { - public const string ProviderName = "Tenant"; + public const string ProviderName = "T"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj b/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj index f92af19e56..ffd81d0789 100644 --- a/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj +++ b/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj b/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj index 90a5fdafcc..118e60d31c 100644 --- a/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj +++ b/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj index b15ea6378c..9f07fb9346 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj +++ b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj b/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj index 7194a29ee3..2f268c964b 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj +++ b/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/DefaultValueSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/DefaultValueSettingValueProvider.cs index f6e1229cee..201e4f26c4 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/DefaultValueSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/DefaultValueSettingValueProvider.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.Settings { public class DefaultValueSettingValueProvider : SettingValueProvider { - public const string ProviderName = "Default"; + public const string ProviderName = "D"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/GlobalSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/GlobalSettingValueProvider.cs index c8d2e38542..1a69a4ba90 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/GlobalSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/GlobalSettingValueProvider.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.Settings { public class GlobalSettingValueProvider : SettingValueProvider { - public const string ProviderName = "Global"; + public const string ProviderName = "G"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs index 7d8177a8e9..eab23b7258 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Settings { public class TenantSettingValueProvider : SettingValueProvider { - public const string ProviderName = "Tenant"; + public const string ProviderName = "T"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs index 4a98dcee62..01125f3201 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Settings { public class UserSettingValueProvider : SettingValueProvider { - public const string ProviderName = "User"; + public const string ProviderName = "U"; public override string Name => ProviderName; diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.cs index b7ef822669..584f787a6e 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.cs @@ -96,7 +96,13 @@ namespace Volo.Abp.Validation parameterInfo.IsOut || TypeHelper.IsPrimitiveExtended(parameterInfo.ParameterType, includeEnums: true); - context.Errors.AddRange(_objectValidator.GetErrors(parameterValue, parameterInfo.Name, allowNulls)); + context.Errors.AddRange( + _objectValidator.GetErrors( + parameterValue, + parameterInfo.Name, + allowNulls + ) + ); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs index 8ff3998f7e..784c211061 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs @@ -56,7 +56,8 @@ namespace Volo.Abp.Validation { foreach (var contributorType in Options.ObjectValidationContributors) { - var contributor = (IObjectValidationContributor) scope.ServiceProvider.GetRequiredService(contributorType); + var contributor = (IObjectValidationContributor) + scope.ServiceProvider.GetRequiredService(contributorType); contributor.AddErrors(context); } } 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 594a19535e..ed8c107005 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; using Volo.Abp.DynamicProxy; @@ -16,27 +15,13 @@ namespace Volo.Abp.Validation public override void Intercept(IAbpMethodInvocation invocation) { - if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.Validation)) - { - invocation.Proceed(); - return; - } - Validate(invocation); - invocation.Proceed(); } public override async Task InterceptAsync(IAbpMethodInvocation invocation) { - if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.Validation)) - { - await invocation.ProceedAsync(); - return; - } - Validate(invocation); - await invocation.ProceedAsync(); } diff --git a/framework/test/AbpTestBase/AbpTestBase.csproj b/framework/test/AbpTestBase/AbpTestBase.csproj index c6d5b71672..6547230b39 100644 --- a/framework/test/AbpTestBase/AbpTestBase.csproj +++ b/framework/test/AbpTestBase/AbpTestBase.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/test/SimpleConsoleDemo/Program.cs b/framework/test/SimpleConsoleDemo/Program.cs index 08c6371bfb..82e6d0a660 100644 --- a/framework/test/SimpleConsoleDemo/Program.cs +++ b/framework/test/SimpleConsoleDemo/Program.cs @@ -1,4 +1,6 @@ using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.DependencyInjection; @@ -8,16 +10,31 @@ namespace SimpleConsoleDemo { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { using (var application = AbpApplicationFactory.Create(options => { - + options.Configuration.CommandLineArgs = args; + options.UseAutofac(); })) { + Console.WriteLine("Initializing the application..."); application.Initialize(); + Console.WriteLine("Initializing the application... OK"); - Console.WriteLine("ABP initialized... Press ENTER to exit!"); + Console.WriteLine("Checking configuration..."); + + var configuration = application.ServiceProvider.GetRequiredService(); + if (configuration["AppSettingKey1"] != "AppSettingValue1") + { + Console.WriteLine("ERROR: Could not read the configuration!"); + Console.WriteLine("Press ENTER to exit!"); + Console.ReadLine(); + return; + } + + Console.WriteLine(); + Console.WriteLine("Checking configuration... OK"); var writers = application.ServiceProvider.GetServices(); foreach (var writer in writers) @@ -25,6 +42,9 @@ namespace SimpleConsoleDemo writer.Write(); } + + Console.WriteLine(); + Console.WriteLine("Press ENTER to exit!"); Console.ReadLine(); } } diff --git a/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj b/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj index 371e2374f9..6138532877 100644 --- a/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj +++ b/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj @@ -1,4 +1,4 @@ - + Exe @@ -6,7 +6,23 @@ - + + + + + + PreserveNewest + true + PreserveNewest + + + + + + + + + diff --git a/framework/test/SimpleConsoleDemo/appsettings.json b/framework/test/SimpleConsoleDemo/appsettings.json new file mode 100644 index 0000000000..8a16cf34c3 --- /dev/null +++ b/framework/test/SimpleConsoleDemo/appsettings.json @@ -0,0 +1,3 @@ +{ + "AppSettingKey1": "AppSettingValue1" +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj index d1eadf276d..e7f6b3b985 100644 --- a/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj @@ -17,7 +17,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj index 61d430d984..c997e76b13 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj @@ -12,7 +12,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj index 93143bfbe0..56499edf0a 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj @@ -20,7 +20,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj index 7b58c9c738..e0f67c68eb 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj @@ -19,7 +19,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj index f798e90627..0675a67f58 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj index b63efadfda..2936cfb847 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj @@ -15,7 +15,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj index 8d954b0b2a..27b0913457 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj @@ -15,7 +15,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj index 061e1640ce..f00a809174 100644 --- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj @@ -25,7 +25,7 @@ - + diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj b/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj index ee1e2441a6..1dbc542b85 100644 --- a/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj b/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj index 817533079b..9e3aaa958b 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj b/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj index d8e2e5ec2b..5a70b9c23a 100644 --- a/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj +++ b/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj @@ -12,7 +12,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj b/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj index 96088ec3e4..ff48454a8b 100644 --- a/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj +++ b/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj index f8a27d020b..758a6187ea 100644 --- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj +++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj @@ -13,7 +13,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj b/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj index 1c4818159b..b4ebdbc8bb 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj +++ b/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj @@ -12,7 +12,7 @@ - + diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs index 4202736b03..be003431f2 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs +++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Caching { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(option => + Configure(option => { option.CacheConfigurators.Add(cacheName => { diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs index fc6b443893..927448463a 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs +++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs @@ -122,5 +122,192 @@ namespace Volo.Abp.Caching cacheItem1.ShouldNotBeNull(); } + + [Fact] + public async Task Should_Set_Get_And_Remove_Cache_Items_With_Integer_Type_CacheKey() + { + var personCache = GetRequiredService>(); + + var cacheKey = 42; + const string personName = "john nash"; + + //Get (not exists yet) + var cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldBeNull(); + + //Set + cacheItem = new PersonCacheItem(personName); + await personCache.SetAsync(cacheKey, cacheItem); + + //Get (it should be available now + cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldNotBeNull(); + cacheItem.Name.ShouldBe(personName); + + //Remove + await personCache.RemoveAsync(cacheKey); + + //Get (not exists since removed) + cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldBeNull(); + } + + [Fact] + public async Task GetOrAddAsync_With_Integer_Type_CacheKey() + { + var personCache = GetRequiredService>(); + + var cacheKey = 42; + const string personName = "john nash"; + + //Will execute the factory method to create the cache item + + bool factoryExecuted = false; + + var cacheItem = await personCache.GetOrAddAsync(cacheKey, + async () => + { + factoryExecuted = true; + return new PersonCacheItem(personName); + }); + + factoryExecuted.ShouldBeTrue(); + cacheItem.Name.ShouldBe(personName); + + //This time, it will not execute the factory + + factoryExecuted = false; + + cacheItem = await personCache.GetOrAddAsync(cacheKey, + async () => + { + factoryExecuted = true; + return new PersonCacheItem(personName); + }); + + factoryExecuted.ShouldBeFalse(); + cacheItem.Name.ShouldBe(personName); + } + + [Fact] + public async Task SameClassName_But_DiffNamespace_Should_Not_Use_Same_Cache_With_Integer_CacheKey() + { + var personCache = GetRequiredService>(); + var otherPersonCache = GetRequiredService>(); + + + var cacheKey = 42; + const string personName = "john nash"; + + //Get (not exists yet) + var cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldBeNull(); + + var cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1.ShouldBeNull(); + + //Set + cacheItem = new PersonCacheItem(personName); + await personCache.SetAsync(cacheKey, cacheItem); + + //Get (it should be available now, but otherPersonCache not exists now. + cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldNotBeNull(); + cacheItem.Name.ShouldBe(personName); + + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1.ShouldBeNull(); + + //set other person cache + cacheItem1 = new Sail.Testing.Caching.PersonCacheItem(personName); + await otherPersonCache.SetAsync(cacheKey, cacheItem1); + + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1.ShouldNotBeNull(); + cacheItem1.Name.ShouldBe(personName); + + //Remove + await personCache.RemoveAsync(cacheKey); + + + //Get (not exists since removed) + cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldBeNull(); + + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); + cacheItem1.ShouldNotBeNull(); + + } + + [Fact] + public async Task Should_Set_Get_And_Remove_Cache_Items_With_Object_Type_CacheKey() + { + var personCache = GetRequiredService>(); + + var cacheKey = new ComplexObjectAsCacheKey { Name = "DummyData", Age = 42 }; + const string personName = "john nash"; + + //Get (not exists yet) + var cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldBeNull(); + + //Set + cacheItem = new PersonCacheItem(personName); + await personCache.SetAsync(cacheKey, cacheItem); + + //Get (it should be available now + cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldNotBeNull(); + cacheItem.Name.ShouldBe(personName); + + //Remove + await personCache.RemoveAsync(cacheKey); + + //Get (not exists since removed) + cacheItem = await personCache.GetAsync(cacheKey); + cacheItem.ShouldBeNull(); + } + + [Fact] + public async Task Should_Set_Get_And_Remove_Cache_Items_For_Same_Object_Type_With_Different_CacheKeys() + { + var personCache = GetRequiredService>(); + + var cache1Key = new ComplexObjectAsCacheKey { Name = "John", Age = 42 }; + var cache2Key = new ComplexObjectAsCacheKey { Name = "Jenny", Age = 24 }; + const string personName = "john nash"; + + //Get (not exists yet) + var cacheItem1 = await personCache.GetAsync(cache1Key); + var cacheItem2 = await personCache.GetAsync(cache2Key); + cacheItem1.ShouldBeNull(); + cacheItem2.ShouldBeNull(); + + //Set + cacheItem1 = new PersonCacheItem(personName); + cacheItem2 = new PersonCacheItem(personName); + await personCache.SetAsync(cache1Key, cacheItem1); + await personCache.SetAsync(cache2Key, cacheItem2); + + //Get (it should be available now + cacheItem1 = await personCache.GetAsync(cache1Key); + cacheItem1.ShouldNotBeNull(); + cacheItem1.Name.ShouldBe(personName); + + cacheItem2 = await personCache.GetAsync(cache2Key); + cacheItem2.ShouldNotBeNull(); + cacheItem2.Name.ShouldBe(personName); + + //Remove + await personCache.RemoveAsync(cache1Key); + await personCache.RemoveAsync(cache2Key); + + //Get (not exists since removed) + cacheItem1 = await personCache.GetAsync(cache1Key); + cacheItem1.ShouldBeNull(); + cacheItem2 = await personCache.GetAsync(cache2Key); + cacheItem2.ShouldBeNull(); + } + } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/PersonCacheItem.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/PersonCacheItem.cs index b6c6f1dd0a..7ea37ffd26 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/PersonCacheItem.cs +++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/PersonCacheItem.cs @@ -1,5 +1,6 @@ using System; - +using System.Linq; + namespace Volo.Abp.Caching { [Serializable] @@ -17,7 +18,33 @@ namespace Volo.Abp.Caching Name = name; } } + + public class ComplexObjectAsCacheKey + { + public string Name { get; set; } + public int Age { get; set; } + + public override string ToString() + { + // Return selective fields + //return $"{Name}_{Age}"; + // Return all the fields concatenated + var sb = new System.Text.StringBuilder(); + var properties = this.GetType().GetProperties() + .Where(prop => prop.CanRead && prop.CanWrite); + foreach (var prop in properties) + { + var value = prop.GetValue(this, null); + if (value != null) + { + sb.Append(value.ToString()); + } + } + return sb.ToString(); + } + } } + namespace Sail.Testing.Caching { [Serializable] diff --git a/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj b/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj index 97988f8b3f..7be716ebcc 100644 --- a/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj +++ b/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj @@ -10,7 +10,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj b/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj index ba75eb73ca..257818f611 100644 --- a/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj +++ b/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj b/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj index 0812895ae0..d0e9f58e54 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj +++ b/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Configuration/ConfigurationAccessor_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Configuration/ConfigurationAccessor_Tests.cs index a69af199ff..3cb08d3924 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Configuration/ConfigurationAccessor_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Configuration/ConfigurationAccessor_Tests.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.Configuration using (var application = AbpApplicationFactory.Create()) { var myConfiguration = new ConfigurationBuilder().Build(); - application.Services.SetConfiguration(myConfiguration); + application.Services.ReplaceConfiguration(myConfiguration); application.Services.GetConfiguration().ShouldBe(myConfiguration); application.Initialize(); @@ -41,12 +41,11 @@ namespace Volo.Abp.Configuration } } - private static IConfigurationRoot ResolveConfiguration(IAbpApplication application) + private static IConfiguration ResolveConfiguration(IAbpApplication application) { return application .ServiceProvider - .GetRequiredService() - .Configuration; + .GetRequiredService(); } } } diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj b/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj index 31f56a6144..b4fd6fcae5 100644 --- a/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj +++ b/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj @@ -13,7 +13,7 @@ - + diff --git a/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj b/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj index 65b50126bd..36a3199bf6 100644 --- a/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj +++ b/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj b/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj index 1ed24ead80..af8fbd8e37 100644 --- a/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj +++ b/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj b/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj index bc1296cbc8..38198cf1bd 100644 --- a/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj +++ b/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj @@ -18,7 +18,7 @@ - + diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj index b79bfa3b4e..38b82aca84 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj @@ -17,7 +17,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj b/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj index a58e10af2d..21c743d4e9 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj @@ -12,7 +12,7 @@ - + diff --git a/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj b/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj index d7b28568f3..f9c04ed5c4 100644 --- a/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj +++ b/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj b/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj index e3e95e182b..cdcb8b0b25 100644 --- a/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj +++ b/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj b/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj index a4bcae448b..7e84f08807 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj b/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj index 6f16b2499e..086aba2bc6 100644 --- a/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj +++ b/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj b/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj index 68cc2bdb83..c380bfaafe 100644 --- a/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj +++ b/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj b/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj index 11a2ac7673..df995f0bd1 100644 --- a/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj +++ b/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj b/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj index e7d0eec2fc..2301d45fcf 100644 --- a/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj +++ b/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj @@ -12,7 +12,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj b/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj index bbad58f4fa..65dace823e 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj @@ -15,8 +15,8 @@ - - + + \ No newline at end of file diff --git a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj index 17ce3073c5..2d870fdc1d 100644 --- a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj +++ b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj index 7af0ec54b6..b4153300f6 100644 --- a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj +++ b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj b/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj index 1534cb28f4..6af4ddbac9 100644 --- a/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj +++ b/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj b/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj index 65bb49d57a..3831500779 100644 --- a/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj +++ b/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj b/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj index ef91443b2a..8c460d0b74 100644 --- a/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj +++ b/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj b/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj index 0594067fa5..9dc2245b22 100644 --- a/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj +++ b/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj @@ -10,7 +10,7 @@ - + \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj b/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj index 90dbb56a8e..19d8be4d2e 100644 --- a/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj +++ b/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj b/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj index d72d42e48a..f1c2b2107f 100644 --- a/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj +++ b/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj @@ -14,7 +14,7 @@ - + diff --git a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj index 7937d99580..4ef9291f5e 100644 --- a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj +++ b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj b/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj index 6ec5ddac26..827c34823d 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj +++ b/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj b/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj index b1f30e3ea5..1c18850d00 100644 --- a/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj +++ b/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj index 440525bc9e..f54dff4005 100644 --- a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj +++ b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj @@ -14,7 +14,7 @@ - + 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 f5167f51f2..bc507158b1 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 @@ -14,6 +14,8 @@ "Login": "Login", "Cancel": "Cancel", "Register": "Register", + "AreYouANewUser": "Are you a new user?", + "AlreadyRegistered": "Already registered?", "InvalidLoginRequest": "Invalid login request", "ThereAreNoLoginSchemesConfiguredForThisClient": "There are no login schemes configured for this client.", "LogInUsingYourProviderAccount": "Log in using your {0} account", 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 6aee740de6..cc616961f1 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 @@ -14,6 +14,8 @@ "Login": "登录", "Cancel": "取消", "Register": "注册", + "AreYouANewUser": "你是新用户吗?", + "AlreadyRegistered": "已经注册过了?", "InvalidLoginRequest": "登录请求无效", "ThereAreNoLoginSchemesConfiguredForThisClient": "没有为此客户端配置登录方案.", "LogInUsingYourProviderAccount": "使用你的{0}帐户登录" diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml index 1703042d42..cba1fec431 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml @@ -11,7 +11,7 @@ @if (string.Equals(await SettingProvider.GetOrNullAsync(AccountSettingNames.IsSelfRegistrationEnabled), "true", StringComparison.OrdinalIgnoreCase)) { - Are you new user? + @L["AreYouANewUser"] @L["Register"] } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml index 7b6f090d7f..44d352153c 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml @@ -6,7 +6,7 @@

@L["Register"]

- Already registered? + @L["AlreadyRegistered"] @L["Login"]
diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/DemoAppHangfireModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/DemoAppHangfireModule.cs index 1afe3f594c..ed3639bce0 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/DemoAppHangfireModule.cs +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/DemoAppHangfireModule.cs @@ -4,7 +4,6 @@ using Volo.Abp.Autofac; using Volo.Abp.BackgroundJobs.DemoApp.Shared; using Volo.Abp.Modularity; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; using Volo.Abp.BackgroundJobs.Hangfire; namespace Volo.Abp.BackgroundJobs.DemoApp.HangFire @@ -18,8 +17,7 @@ namespace Volo.Abp.BackgroundJobs.DemoApp.HangFire { public override void PreConfigureServices(ServiceConfigurationContext context) { - var configuration = ConfigurationHelper.BuildConfiguration(); - context.Services.SetConfiguration(configuration); + var configuration = context.Services.GetConfiguration(); context.Services.PreConfigure(hangfireConfiguration => { diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/DemoAppModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/DemoAppModule.cs index 5308053e83..f64191ea3f 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/DemoAppModule.cs +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/DemoAppModule.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.BackgroundJobs.DemoApp { [DependsOn( typeof(DemoAppSharedModule), - typeof(BackgroundJobsEntityFrameworkCoreModule), + typeof(AbpBackgroundJobsEntityFrameworkCoreModule), typeof(AbpAutofacModule), typeof(AbpEntityFrameworkCoreSqlServerModule) )] diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobsDomainSharedModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainSharedModule.cs similarity index 58% rename from modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobsDomainSharedModule.cs rename to modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainSharedModule.cs index 2012620f3a..26565fde78 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobsDomainSharedModule.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainSharedModule.cs @@ -2,7 +2,7 @@ namespace Volo.Abp.BackgroundJobs { - public class BackgroundJobsDomainSharedModule : AbpModule + public class AbpBackgroundJobsDomainSharedModule : AbpModule { } diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainModule.cs similarity index 69% rename from modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainModule.cs rename to modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainModule.cs index 261051958c..a373fd883b 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainModule.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainModule.cs @@ -5,15 +5,15 @@ using Volo.Abp.Modularity; namespace Volo.Abp.BackgroundJobs { [DependsOn( - typeof(BackgroundJobsDomainSharedModule), + typeof(AbpBackgroundJobsDomainSharedModule), typeof(AbpBackgroundJobsModule), typeof(AbpAutoMapperModule) )] - public class BackgroundJobsDomainModule : AbpModule //TODO: Rename to AbpBackgroundJobsDomainModule + public class AbpBackgroundJobsDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs index dce8a31600..2b796d9eaf 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs @@ -10,11 +10,11 @@ namespace Volo.Abp.BackgroundJobs { protected IBackgroundJobRepository BackgroundJobRepository { get; } - protected IObjectMapper ObjectMapper { get; } + protected IObjectMapper ObjectMapper { get; } public BackgroundJobStore( IBackgroundJobRepository backgroundJobRepository, - IObjectMapper objectMapper) + IObjectMapper objectMapper) { ObjectMapper = objectMapper; BackgroundJobRepository = backgroundJobRepository; diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/AbpBackgroundJobsEntityFrameworkCoreModule.cs similarity index 82% rename from modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreModule.cs rename to modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/AbpBackgroundJobsEntityFrameworkCoreModule.cs index 9661dd7646..1c4e6278a5 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreModule.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/AbpBackgroundJobsEntityFrameworkCoreModule.cs @@ -5,10 +5,10 @@ using Volo.Abp.Modularity; namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { [DependsOn( - typeof(BackgroundJobsDomainModule), + typeof(AbpBackgroundJobsDomainModule), typeof(AbpEntityFrameworkCoreModule) )] - public class BackgroundJobsEntityFrameworkCoreModule : AbpModule + public class AbpBackgroundJobsEntityFrameworkCoreModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbModule.cs similarity index 83% rename from modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbModule.cs rename to modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbModule.cs index 6ace195fa5..3e98ea6bc2 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbModule.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbModule.cs @@ -5,10 +5,10 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.BackgroundJobs.MongoDB { [DependsOn( - typeof(BackgroundJobsDomainModule), + typeof(AbpBackgroundJobsDomainModule), typeof(AbpMongoDbModule) )] - public class BackgroundJobsMongoDbModule : AbpModule + public class AbpBackgroundJobsMongoDbModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsDomainTestModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainTestModule.cs similarity index 57% rename from modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsDomainTestModule.cs rename to modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainTestModule.cs index d4c861b24c..a9a4bff069 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsDomainTestModule.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/AbpBackgroundJobsDomainTestModule.cs @@ -4,9 +4,9 @@ using Volo.Abp.Modularity; namespace Volo.Abp.BackgroundJobs { [DependsOn( - typeof(BackgroundJobsEntityFrameworkCoreTestModule) + typeof(AbpBackgroundJobsEntityFrameworkCoreTestModule) )] - public class BackgroundJobsDomainTestModule : AbpModule + public class AbpBackgroundJobsDomainTestModule : AbpModule { } diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs index 259fbf1929..ae1a2064d3 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobsDomainTestBase.cs @@ -1,6 +1,6 @@ namespace Volo.Abp.BackgroundJobs { - public abstract class BackgroundJobsDomainTestBase : BackgroundJobsTestBase + public abstract class BackgroundJobsDomainTestBase : BackgroundJobsTestBase { } diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreTestModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/AbpBackgroundJobsEntityFrameworkCoreTestModule.cs similarity index 87% rename from modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreTestModule.cs rename to modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/AbpBackgroundJobsEntityFrameworkCoreTestModule.cs index 70318c1e7a..65ed1194cf 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsEntityFrameworkCoreTestModule.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/AbpBackgroundJobsEntityFrameworkCoreTestModule.cs @@ -9,10 +9,10 @@ using Volo.Abp.Modularity; namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { [DependsOn( - typeof(BackgroundJobsTestBaseModule), - typeof(BackgroundJobsEntityFrameworkCoreModule) + typeof(AbpBackgroundJobsTestBaseModule), + typeof(AbpBackgroundJobsEntityFrameworkCoreModule) )] - public class BackgroundJobsEntityFrameworkCoreTestModule : AbpModule + public class AbpBackgroundJobsEntityFrameworkCoreTestModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobRepositoryTests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobRepositoryTests.cs index e2f4f22476..42c412037e 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobRepositoryTests.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobRepositoryTests.cs @@ -1,6 +1,6 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { - public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests + public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests { } diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbTestModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbTestModule.cs similarity index 82% rename from modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbTestModule.cs rename to modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbTestModule.cs index e8eba4eb12..4147917829 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbTestModule.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbTestModule.cs @@ -7,10 +7,10 @@ using Volo.Abp.Modularity; namespace Volo.Abp.BackgroundJobs.MongoDB { [DependsOn( - typeof(BackgroundJobsTestBaseModule), - typeof(BackgroundJobsMongoDbModule) + typeof(AbpBackgroundJobsTestBaseModule), + typeof(AbpBackgroundJobsMongoDbModule) )] - public class BackgroundJobsMongoDbTestModule : AbpModule + public class AbpBackgroundJobsMongoDbTestModule : AbpModule { private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start(); diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobRepositoryTests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobRepositoryTests.cs index c6106e777a..429cf4821f 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobRepositoryTests.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobRepositoryTests.cs @@ -1,6 +1,6 @@ namespace Volo.Abp.BackgroundJobs.MongoDB { - public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests + public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests { } diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestBaseModule.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestBaseModule.cs similarity index 90% rename from modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestBaseModule.cs rename to modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestBaseModule.cs index 5af07bd6dc..0c1a681eeb 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestBaseModule.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/AbpBackgroundJobsTestBaseModule.cs @@ -7,9 +7,9 @@ namespace Volo.Abp.BackgroundJobs [DependsOn( typeof(AbpAutofacModule), typeof(AbpTestBaseModule), - typeof(BackgroundJobsDomainModule) + typeof(AbpBackgroundJobsDomainModule) )] - public class BackgroundJobsTestBaseModule : AbpModule + public class AbpBackgroundJobsTestBaseModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/modules/docs/app/VoloDocs.Web/Branding/VoloDocsBrandingProvider.cs b/modules/docs/app/VoloDocs.Web/Branding/VoloDocsBrandingProvider.cs index 8ae314ab05..9c906767aa 100644 --- a/modules/docs/app/VoloDocs.Web/Branding/VoloDocsBrandingProvider.cs +++ b/modules/docs/app/VoloDocs.Web/Branding/VoloDocsBrandingProvider.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components; -using Volo.Abp.Configuration; using Volo.Abp.DependencyInjection; using Volo.Docs.Localization; diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js index cde584cf20..6127dfe9c1 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js @@ -37,7 +37,7 @@ visible: abp.auth.isGranted('AbpIdentity.Roles.ManagePermissions'), action: function (data) { _permissionsModal.open({ - providerName: 'Role', + providerName: 'R', providerKey: data.record.name }); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js index 63e79c4bb8..4d8486d256 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js @@ -36,7 +36,7 @@ visible: abp.auth.isGranted('AbpIdentity.Users.ManagePermissions'), action: function (data) { _permissionsModal.open({ - providerName: 'User', + providerName: 'U', providerKey: data.record.id }); } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs index ea52e4458c..5dad99a0ca 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.SettingManagement (await SettingRepository.FindAsync( "MySetting2", - "User", + UserSettingValueProvider.ProviderName, TestData.User1Id.ToString() )).Value.ShouldBe("user1-store-value"); diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs index a66a4fe253..6843d6257e 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs @@ -45,7 +45,7 @@ namespace Volo.Abp.SettingManagement _guidGenerator.Create(), "MySetting2", "user1-store-value", - "User", + UserSettingValueProvider.ProviderName, _testData.User1Id.ToString() ) ); @@ -55,7 +55,7 @@ namespace Volo.Abp.SettingManagement _guidGenerator.Create(), "MySetting2", "user2-store-value", - "User", + UserSettingValueProvider.ProviderName, _testData.User2Id.ToString() ) ); @@ -74,7 +74,7 @@ namespace Volo.Abp.SettingManagement _guidGenerator.Create(), "MySettingWithoutInherit", "user1-store-value", - "User", + UserSettingValueProvider.ProviderName, _testData.User1Id.ToString() ) ); diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs index de956d0202..2a458a1739 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs @@ -29,9 +29,9 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNullAsync_Should_Cached() { // Act - (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", "User", _testData.User1Id.ToString()))).ShouldBeNull(); - await _settingManagementStore.GetOrNullAsync("MySetting2", "User", _testData.User1Id.ToString()); - (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", "User", _testData.User1Id.ToString()))).ShouldNotBeNull(); + (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldBeNull(); + await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); + (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldNotBeNull(); } [Fact] @@ -39,15 +39,15 @@ namespace Volo.Abp.SettingManagement { // Arrange // GetOrNullAsync will cache language. - await _settingManagementStore.GetOrNullAsync("MySetting2", "User", _testData.User1Id.ToString()); + await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); // Act - var lang = await _settingRepository.FindAsync("MySetting2", "User", _testData.User1Id.ToString()); + var lang = await _settingRepository.FindAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); await _settingRepository.DeleteAsync(lang); // Assert (await _cache.GetAsync( - SettingCacheItem.CalculateCacheKey("MySetting2", "User", _testData.User1Id.ToString()))).ShouldBeNull(); + SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldBeNull(); } } } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js index 18d0cceafc..4583cd616a 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js @@ -46,7 +46,7 @@ visible: abp.auth.isGranted('AbpTenantManagement.Tenants.ManageFeatures'), action: function (data) { _featuresModal.open({ - providerName: 'Tenant', + providerName: 'T', providerKey: data.record.id }); } diff --git a/npm/ng-packs/.vscode/settings.json b/npm/ng-packs/.vscode/settings.json index ba819b4f57..0e7b4b1be1 100644 --- a/npm/ng-packs/.vscode/settings.json +++ b/npm/ng-packs/.vscode/settings.json @@ -5,18 +5,18 @@ "tslint.rulesDirectory": "../node_modules/codelyzer", "typescript.tsdk": "../node_modules/typescript/lib", "workbench.colorCustomizations": { - "activityBar.background": "#df7fa2", - "activityBar.foreground": "#15202b", - "activityBar.inactiveForeground": "#15202b99", - "activityBarBadge.background": "#c7ecb3", - "activityBarBadge.foreground": "#15202b", - "titleBar.activeBackground": "#d55685", - "titleBar.inactiveBackground": "#d5568599", - "titleBar.activeForeground": "#15202b", - "titleBar.inactiveForeground": "#15202b99", - "statusBar.background": "#d55685", - "statusBarItem.hoverBackground": "#c73169", - "statusBar.foreground": "#15202b" + "activityBar.background": "#90164b", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#0e1c04", + "activityBarBadge.foreground": "#e7e7e7", + "titleBar.activeBackground": "#640f34", + "titleBar.inactiveBackground": "#640f3499", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveForeground": "#e7e7e799", + "statusBar.background": "#640f34", + "statusBarItem.hoverBackground": "#90164b", + "statusBar.foreground": "#e7e7e7" }, - "peacock.color": "#d55685" + "peacock.color": "#640f34" } diff --git a/npm/ng-packs/angular.json b/npm/ng-packs/angular.json index f1c7d18a46..cfa01cf43f 100644 --- a/npm/ng-packs/angular.json +++ b/npm/ng-packs/angular.json @@ -435,9 +435,14 @@ "apps/dev-app/src/styles.scss", "node_modules/bootstrap/dist/css/bootstrap.min.css", { - "input": "node_modules/font-awesome/css/font-awesome.min.css", + "input": "node_modules/@fortawesome/fontawesome-free/css/all.min.css", "lazy": true, - "bundleName": "font-awesome.min" + "bundleName": "fontawesome-all.min" + }, + { + "input": "node_modules/@fortawesome/fontawesome-free/css/v4-shims.min.css", + "lazy": true, + "bundleName": "fontawesome-v4-shims.min" }, { "input": "node_modules/primeng/resources/themes/nova-light/theme.css", diff --git a/npm/ng-packs/apps/dev-app/src/app/app.component.ts b/npm/ng-packs/apps/dev-app/src/app/app.component.ts index e89c73184d..4780afbfd5 100644 --- a/npm/ng-packs/apps/dev-app/src/app/app.component.ts +++ b/npm/ng-packs/apps/dev-app/src/app/app.component.ts @@ -14,7 +14,13 @@ export class AppComponent implements OnInit { ngOnInit() { this.lazyLoadService .load( - ['primeng.min.css', 'primeicons.css', 'primeng-nova-light-theme.css', 'font-awesome.min.css'], + [ + 'primeng.min.css', + 'primeicons.css', + 'primeng-nova-light-theme.css', + 'fontawesome-all.min.css', + 'fontawesome-v4-shims.min.css', + ], 'style', null, 'head', diff --git a/npm/ng-packs/apps/dev-app/src/app/home/home.component.html b/npm/ng-packs/apps/dev-app/src/app/home/home.component.html index 4fafc67398..79220d16c4 100644 --- a/npm/ng-packs/apps/dev-app/src/app/home/home.component.html +++ b/npm/ng-packs/apps/dev-app/src/app/home/home.component.html @@ -6,7 +6,7 @@

{{ 'AbpIdentity::Login' | abpLocalization }}{{ 'AbpIdentity::Login' | abpLocalization }}


diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 3774a5705d..abee172af0 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -7,13 +7,17 @@ "abpng": "abpng", "commit": "git-cz && node scripts/push.js", "lint": "ng lint --fix", - "build:scripts": "cd scripts && npm install && npm run build" + "scripts:build": "cd scripts && npm install && npm run build" }, "devDependencies": { - "@abp/ng.core": "^0.9.0", - "@abp/ng.feature-management": "^0.9.0", - "@abp/ng.permission-management": "^0.9.0", - "@abp/ng.theme.shared": "^0.9.0", + "@abp/ng.account.config": "0.9.2", + "@abp/ng.core": "0.9.2", + "@abp/ng.feature-management": "0.9.2", + "@abp/ng.identity.config": "0.9.2", + "@abp/ng.permission-management": "0.9.2", + "@abp/ng.setting-management.config": "0.9.2", + "@abp/ng.tenant-management.config": "0.9.2", + "@abp/ng.theme.shared": "0.9.2", "@angular-builders/jest": "^8.2.0", "@angular-devkit/build-angular": "~0.803.6", "@angular-devkit/build-ng-packagr": "~0.803.6", @@ -29,6 +33,7 @@ "@angular/platform-browser": "~8.2.8", "@angular/platform-browser-dynamic": "~8.2.8", "@angular/router": "~8.1.2", + "@fortawesome/fontawesome-free": "^5.11.2", "@ng-bootstrap/ng-bootstrap": "^5.1.0", "@ngneat/spectator": "^4.4.0", "@ngx-validate/core": "^0.0.7", @@ -64,11 +69,7 @@ "tsickle": "^0.37.0", "tslint": "~5.20.0", "typescript": "~3.5.3", - "zone.js": "~0.9.1", - "@abp/ng.account.config": "^0.9.0", - "@abp/ng.identity.config": "0.9.0", - "@abp/ng.tenant-management.config": "^0.9.0", - "@abp/ng.setting-management.config": "^0.9.0" + "zone.js": "~0.9.1" }, "dependencies": { "tslib": "^1.10.0" diff --git a/npm/ng-packs/packages/core/src/lib/services/config.service.ts b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts similarity index 94% rename from npm/ng-packs/packages/core/src/lib/services/config.service.ts rename to npm/ng-packs/packages/core/src/lib/services/config-state.service.ts index 21050f2b79..0efa55c179 100644 --- a/npm/ng-packs/packages/core/src/lib/services/config.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts @@ -5,7 +5,7 @@ import { ConfigState } from '../states'; @Injectable({ providedIn: 'root', }) -export class ConfigService { +export class ConfigStateService { constructor(private store: Store) {} getAll() { diff --git a/npm/ng-packs/packages/core/src/lib/services/index.ts b/npm/ng-packs/packages/core/src/lib/services/index.ts index 8ae05cabaa..6b90b997cc 100644 --- a/npm/ng-packs/packages/core/src/lib/services/index.ts +++ b/npm/ng-packs/packages/core/src/lib/services/index.ts @@ -1,6 +1,8 @@ export * from './application-configuration.service'; -export * from './config.service'; +export * from './config-state.service'; export * from './lazy-load.service'; export * from './localization.service'; export * from './profile.service'; export * from './rest.service'; +export * from './profile-state.service'; +export * from './session-state.service'; 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 new file mode 100644 index 0000000000..7dea8de2ea --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/services/profile-state.service.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { Store } from '@ngxs/store'; +import { ProfileState } from '../states'; + +@Injectable({ + providedIn: 'root', +}) +export class ProfileStateService { + constructor(private store: Store) {} + + getProfile() { + return this.store.selectSnapshot(ProfileState.getProfile); + } +} 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 new file mode 100644 index 0000000000..03076e2eeb --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts @@ -0,0 +1,16 @@ +import { Injectable } from '@angular/core'; +import { Store } from '@ngxs/store'; +import { SessionState } from '../states'; + +@Injectable() +export class SessionStateService { + constructor(private store: Store) {} + + getLanguage() { + return this.store.selectSnapshot(SessionState.getLanguage); + } + + getTenant() { + return this.store.selectSnapshot(SessionState.getTenant); + } +} diff --git a/npm/ng-packs/packages/core/src/lib/states/profile.state.ts b/npm/ng-packs/packages/core/src/lib/states/profile.state.ts index cce9788f09..c19b120e1b 100644 --- a/npm/ng-packs/packages/core/src/lib/states/profile.state.ts +++ b/npm/ng-packs/packages/core/src/lib/states/profile.state.ts @@ -17,7 +17,7 @@ export class ProfileState { constructor(private profileService: ProfileService) {} @Action(GetProfile) - profileGet({ patchState }: StateContext) { + getProfile({ patchState }: StateContext) { return this.profileService.get().pipe( tap(profile => patchState({ @@ -28,7 +28,7 @@ export class ProfileState { } @Action(UpdateProfile) - profileUpdate({ patchState }: StateContext, { payload }: UpdateProfile) { + updateProfile({ patchState }: StateContext, { payload }: UpdateProfile) { return this.profileService.update(payload).pipe( tap(profile => patchState({ 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 c01064152e..a7bae167b1 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 @@ -2,7 +2,7 @@ import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spect import { Store } from '@ngxs/store'; import { ReplaySubject, timer, Subject, of } from 'rxjs'; import { Config } from '../models/config'; -import { ApplicationConfigurationService, ConfigService } from '../services'; +import { ApplicationConfigurationService, ConfigStateService } from '../services'; import { ConfigState } from '../states'; import { SetLanguage, PatchRouteByName } from '../actions'; @@ -110,14 +110,14 @@ export const CONFIG_STATE_DATA = { } as Config.State; describe('ConfigState', () => { - let spectator: SpectatorService; + let spectator: SpectatorService; let store: SpyObject; - let service: ConfigService; + let service: ConfigStateService; let state: ConfigState; let appConfigService: SpyObject; const createService = createServiceFactory({ - service: ConfigService, + service: ConfigStateService, mocks: [ApplicationConfigurationService, Store], }); diff --git a/npm/ng-packs/packages/core/src/lib/tests/profile.state.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/profile.state.spec.ts index 1ebdda217a..380ea53b1c 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/profile.state.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/profile.state.spec.ts @@ -42,7 +42,7 @@ describe('ProfileState', () => { const spy = jest.spyOn(profileService, 'get'); spy.mockReturnValue(of(mockData as any)); - state.profileGet({ patchState } as any).subscribe(); + state.getProfile({ patchState } as any).subscribe(); expect(patchedData).toEqual({ profile: mockData }); }); @@ -54,7 +54,7 @@ describe('ProfileState', () => { const spy = jest.spyOn(profileService, 'update'); spy.mockReturnValue(of(mockData as any)); - state.profileUpdate({ patchState } as any, { payload: mockData as any }).subscribe(); + state.updateProfile({ patchState } as any, { payload: mockData as any }).subscribe(); expect(patchedData).toEqual({ profile: mockData }); }); 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 new file mode 100644 index 0000000000..a40d0f6186 --- /dev/null +++ b/npm/ng-packs/packages/feature-management/src/lib/services/feature-management-state.service.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { Store } from '@ngxs/store'; +import { FeatureManagementState } from '../states'; + +@Injectable({ + providedIn: 'root', +}) +export class FeatureManagementStateService { + constructor(private store: Store) {} + + getFeatures() { + return this.store.selectSnapshot(FeatureManagementState.getFeatures); + } +} diff --git a/npm/ng-packs/packages/feature-management/src/lib/services/index.ts b/npm/ng-packs/packages/feature-management/src/lib/services/index.ts index 10fceceafe..1243410ea6 100644 --- a/npm/ng-packs/packages/feature-management/src/lib/services/index.ts +++ b/npm/ng-packs/packages/feature-management/src/lib/services/index.ts @@ -1 +1,2 @@ export * from './feature-management.service'; +export * from './feature-management-state.service'; diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html index 822c5a9576..887c16042c 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html @@ -23,7 +23,7 @@ />
- + @@ -65,7 +65,7 @@ - +
- + @@ -76,7 +76,7 @@
- +
- + @@ -68,7 +68,7 @@ - +