Browse Source

Merge branch 'dev' into pr/1942

pull/1942/head
Yunus Emre Kalkan 7 years ago
parent
commit
98f203858c
  1. 89
      docs/en/Caching.md
  2. 10
      docs/en/Index.md
  3. 3
      docs/zh-Hans/AspNetCore/JavaScript-API/Auth.md
  4. 24
      docs/zh-Hans/AspNetCore/JavaScript-API/Index.md
  5. 370
      docs/zh-Hans/Authorization.md
  6. 3
      docs/zh-Hans/JavaScript/Dynamic-JavaScript-API-Clients.md
  7. 3
      docs/zh-Hans/Modules/Permission-Management.md
  8. BIN
      docs/zh-Hans/images/authorization-new-permission-ui-hierarcy.png
  9. BIN
      docs/zh-Hans/images/authorization-new-permission-ui-localized.png
  10. BIN
      docs/zh-Hans/images/authorization-new-permission-ui.png
  11. BIN
      docs/zh-Hans/images/create-aspnet-core-application.png
  12. BIN
      docs/zh-Hans/images/create-new-aspnet-core-application-v2.png
  13. BIN
      docs/zh-Hans/images/select-empty-web-application-v2.png
  14. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/BootstrapDatepicker/BootstrapDatepickerScriptContributor.cs
  15. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/FontAwesome/FontAwesomeStyleContributor.cs
  16. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
  17. 7
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs
  18. 18
      framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs
  19. 5
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
  20. 13
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs
  21. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs
  22. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs
  23. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs
  24. 32
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCacheOptions.cs
  25. 3
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs
  26. 29
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpDistributedCacheOptions.cs
  27. 173
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
  28. 33
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs
  29. 8
      framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
  30. 4
      framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
  31. 5
      framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationBuilderOptions.cs
  32. 12
      framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs
  33. 13
      framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionConfigurationExtensions.cs
  34. 1
      framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
  35. 2
      framework/src/Volo.Abp.Core/Volo/Abp/Aspects/AbpCrossCuttingConcerns.cs
  36. 23
      framework/src/Volo.Abp.Core/Volo/Abp/Configuration/DefaultConfigurationAccessor.cs
  37. 11
      framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs
  38. 15
      framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs
  39. 2
      framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj
  40. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/DefaultValueSettingValueProvider.cs
  41. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs
  42. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs
  43. 2
      framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj
  44. 2
      framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj
  45. 2
      framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj
  46. 2
      framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj
  47. 2
      framework/src/Volo.Abp.Settings/Volo/Abp/Settings/DefaultValueSettingValueProvider.cs
  48. 2
      framework/src/Volo.Abp.Settings/Volo/Abp/Settings/GlobalSettingValueProvider.cs
  49. 2
      framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs
  50. 2
      framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs
  51. 8
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.cs
  52. 3
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs
  53. 15
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs
  54. 2
      framework/test/AbpTestBase/AbpTestBase.csproj
  55. 26
      framework/test/SimpleConsoleDemo/Program.cs
  56. 20
      framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj
  57. 3
      framework/test/SimpleConsoleDemo/appsettings.json
  58. 2
      framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj
  59. 2
      framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj
  60. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
  61. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj
  62. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj
  63. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj
  64. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj
  65. 2
      framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj
  66. 2
      framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj
  67. 2
      framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj
  68. 2
      framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj
  69. 2
      framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj
  70. 2
      framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj
  71. 2
      framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj
  72. 2
      framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs
  73. 187
      framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs
  74. 29
      framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/PersonCacheItem.cs
  75. 2
      framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj
  76. 2
      framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj
  77. 2
      framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj
  78. 7
      framework/test/Volo.Abp.Core.Tests/Volo/Abp/Configuration/ConfigurationAccessor_Tests.cs
  79. 2
      framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj
  80. 2
      framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj
  81. 2
      framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj
  82. 2
      framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj
  83. 2
      framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj
  84. 2
      framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj
  85. 2
      framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj
  86. 2
      framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj
  87. 2
      framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj
  88. 2
      framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj
  89. 2
      framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj
  90. 2
      framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj
  91. 2
      framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj
  92. 4
      framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj
  93. 2
      framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj
  94. 2
      framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj
  95. 2
      framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj
  96. 2
      framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj
  97. 2
      framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj
  98. 2
      framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj
  99. 2
      framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj
  100. 2
      framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj

89
docs/en/Caching.md

@ -19,7 +19,7 @@ See [ASP.NET Core's distributed caching document](https://docs.microsoft.com/en-
## `IDistributedCache<TCacheItem>` Interface
ABP framework defines the generic `IDistributedCache<TCacheItem>` 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<TCacheItem>` 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<TCacheItem>` solves the difficulties explained above;
@ -80,6 +80,93 @@ public class BookService : ITransientDependency
Other methods of the `IDistributedCache<BookCacheItem>` 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<TCacheItem, TCacheKey>` Interface
`IDistributedCache<TCacheItem>` 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<TCacheItem, TCacheKey>` 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<BookCacheItem, Guid> _cache;
public BookService(IDistributedCache<BookCacheItem, Guid> cache)
{
_cache = cache;
}
public async Task<BookCacheItem> 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<BookCacheItem> 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<TCacheItem, TCacheKey>` 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<UserCacheItem, UserInOrganizationCacheKey> _cache;
public BookService(
IDistributedCache<UserCacheItem, UserInOrganizationCacheKey> cache)
{
_cache = cache;
}
...
}
````
### DistributedCacheOptions
TODO

10
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:

3
docs/zh-Hans/AspNetCore/JavaScript-API/Auth.md

@ -0,0 +1,3 @@
# abp.auth JavaScript API
TODO

24
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

370
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<List<AuthorDto>> GetListAsync()
{
...
}
[AllowAnonymous]
public Task<AuthorDto> 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<BookStoreResource>("BookStore")
);
myGroup.AddPermission(
"BookStore_Author_Create",
LocalizableString.Create<BookStoreResource>("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<BookStoreResource>("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<List<AuthorDto>> GetListAsync()
{
...
}
public Task<AuthorDto> 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<PermissionGrantResult>
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<PermissionOptions>(options =>
{
options.ValueProviders.Add<SystemAdminPermissionValueProvider>();
});
````
### 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)

3
docs/zh-Hans/JavaScript/Dynamic-JavaScript-API-Clients.md

@ -0,0 +1,3 @@
## Dynamic JavaScript API Clients
TODO

3
docs/zh-Hans/Modules/Permission-Management.md

@ -0,0 +1,3 @@
# 权限管理模块
TODO

BIN
docs/zh-Hans/images/authorization-new-permission-ui-hierarcy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
docs/zh-Hans/images/authorization-new-permission-ui-localized.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
docs/zh-Hans/images/authorization-new-permission-ui.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
docs/zh-Hans/images/create-aspnet-core-application.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
docs/zh-Hans/images/create-new-aspnet-core-application-v2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
docs/zh-Hans/images/select-empty-web-application-v2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

2
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)
{

3
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");
}
}
}

2
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> MultiTenancyOptions
@inject IOptions<AbpMultiTenancyOptions> MultiTenancyOptions
@inject ICurrentTenant CurrentTenant
@inject IStringLocalizer<AbpUiMultiTenancyResource> MultiTenancyStringLocalizer
@inject ITenantResolveResultAccessor TenantResolveResultAccessor

7
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();
}
}
}

18
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<IWebHostEnvironment>();
}
[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;
}
}
}

5
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<AbpAuditingOptions>(options =>

13
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();
}

2
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;

2
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;

2
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;

32
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCacheOptions.cs

@ -1,32 +0,0 @@
using Microsoft.Extensions.Caching.Distributed;
using System;
using System.Collections.Generic;
namespace Volo.Abp.Caching
{
public class AbpCacheOptions
{
/// <summary>
/// Cache key prefix.
/// </summary>
public string KeyPrefix { get; set; }
/// <summary>
/// Global Cache entry options.
/// </summary>
public DistributedCacheEntryOptions GlobalCacheEntryOptions { get; set; }
/// <summary>
/// List of all cache configurators.
/// (func argument:Name of cache)
/// </summary>
public List<Func<string, DistributedCacheEntryOptions>> CacheConfigurators { get; set; } //TODO list item use a configurator interface instead?
public AbpCacheOptions()
{
CacheConfigurators = new List<Func<string, DistributedCacheEntryOptions>>();
GlobalCacheEntryOptions = new DistributedCacheEntryOptions();
KeyPrefix = "";
}
}
}

3
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<AbpCacheOptions>(cacheOptions =>
context.Services.Configure<AbpDistributedCacheOptions>(cacheOptions =>
{
cacheOptions.GlobalCacheEntryOptions.SlidingExpiration = TimeSpan.FromMinutes(20);
});

29
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.
/// </summary>
public bool HideErrors { get; set; } = true;
/// <summary>
/// Cache key prefix.
/// </summary>
public string KeyPrefix { get; set; }
/// <summary>
/// Global Cache entry options.
/// </summary>
public DistributedCacheEntryOptions GlobalCacheEntryOptions { get; set; }
/// <summary>
/// List of all cache configurators.
/// (func argument:Name of cache)
/// </summary>
public List<Func<string, DistributedCacheEntryOptions>> CacheConfigurators { get; set; } //TODO: use a configurator interface instead?
public AbpDistributedCacheOptions()
{
CacheConfigurators = new List<Func<string, DistributedCacheEntryOptions>>();
GlobalCacheEntryOptions = new DistributedCacheEntryOptions();
KeyPrefix = "";
}
}
}

173
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs

@ -15,10 +15,34 @@ namespace Volo.Abp.Caching
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
public class DistributedCache<TCacheItem> : IDistributedCache<TCacheItem>
public class DistributedCache<TCacheItem> : DistributedCache<TCacheItem, string>, IDistributedCache<TCacheItem>
where TCacheItem : class
{
public ILogger<DistributedCache<TCacheItem>> Logger { get; set; }
public DistributedCache(
IOptions<AbpDistributedCacheOptions> distributedCacheOption,
IDistributedCache cache,
ICancellationTokenProvider cancellationTokenProvider,
IDistributedCacheSerializer serializer,
ICurrentTenant currentTenant) : base(
distributedCacheOption: distributedCacheOption,
cache: cache,
cancellationTokenProvider: cancellationTokenProvider,
serializer: serializer,
currentTenant: currentTenant)
{
}
}
/// <summary>
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// Uses a generic cache key type of <typeparamref name="TCacheKey" /> type.
/// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
/// <typeparam name="TCacheKey">The type of cache key being used.</typeparam>
public class DistributedCache<TCacheItem, TCacheKey> : IDistributedCache<TCacheItem, TCacheKey>
where TCacheItem : class
{
public ILogger<DistributedCache<TCacheItem, TCacheKey>> 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<AbpCacheOptions> cacheOption,
IOptions<AbpDistributedCacheOptions> 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<DistributedCache<TCacheItem>>.Instance;
Logger = NullLogger<DistributedCache<TCacheItem, TCacheKey>>.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();
}
/// <summary>
/// Gets a cache item with the given key. If no cache item is found for the given key then returns null.
/// </summary>
@ -68,7 +122,7 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item, or null.</returns>
public virtual TCacheItem Get(
string key,
TCacheKey key,
bool? hideErrors = null)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -106,8 +160,8 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item, or null.</returns>
public virtual async Task<TCacheItem> 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<TCacheItem>(cachedBytes);
}
/// <summary>
/// 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 <paramref name="factory" /> delegate and returns the provided cache item.
@ -149,10 +202,10 @@ namespace Volo.Abp.Caching
/// <param name="optionsFactory">The cache options for the factory delegate.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item.</returns>
public TCacheItem GetOrAdd(
string key,
Func<TCacheItem> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null,
public virtual TCacheItem GetOrAdd(
TCacheKey key,
Func<TCacheItem> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null)
{
var value = Get(key, hideErrors);
@ -175,7 +228,6 @@ namespace Volo.Abp.Caching
return value;
}
/// <summary>
/// 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 <paramref name="factory" /> delegate and returns the provided cache item.
@ -186,11 +238,11 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item.</returns>
public async Task<TCacheItem> GetOrAddAsync(
string key,
Func<Task<TCacheItem>> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null,
public virtual async Task<TCacheItem> GetOrAddAsync(
TCacheKey key,
Func<Task<TCacheItem>> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null,
CancellationToken token = default)
{
token = CancellationTokenProvider.FallbackToProvider(token);
@ -214,7 +266,6 @@ namespace Volo.Abp.Caching
return value;
}
/// <summary>
/// Sets the cache item value for the provided key.
/// </summary>
@ -223,9 +274,9 @@ namespace Volo.Abp.Caching
/// <param name="options">The cache options for the value.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
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;
}
}
/// <summary>
/// Sets the cache item value for the provided key.
/// </summary>
@ -260,10 +310,10 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
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;
}
}
/// <summary>
/// Refreshes the cache value of the given key, and resets its sliding expiration timeout.
/// </summary>
/// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
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;
}
}
/// <summary>
/// Refreshes the cache value of the given key, and resets its sliding expiration timeout.
/// </summary>
@ -324,8 +372,8 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
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;
}
}
/// <summary>
/// Removes the cache item for given key from cache.
/// </summary>
/// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
public virtual void Remove(
string key,
TCacheKey key,
bool? hideErrors = null)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -372,7 +418,6 @@ namespace Volo.Abp.Caching
throw;
}
}
/// <summary>
/// Removes the cache item for given key from cache.
/// </summary>
@ -381,8 +426,8 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
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();
}
}
}
}
}

33
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs

@ -10,7 +10,18 @@ namespace Volo.Abp.Caching
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
public interface IDistributedCache<TCacheItem>
public interface IDistributedCache<TCacheItem> : IDistributedCache<TCacheItem, string>
where TCacheItem : class
{
}
/// <summary>
/// Represents a distributed cache of <typeparamref name="TCacheItem" /> type.
/// Uses a generic cache key type of <typeparamref name="TCacheKey" /> type.
/// </summary>
/// <typeparam name="TCacheItem">The type of cache item being cached.</typeparam>
/// <typeparam name="TCacheKey">The type of cache key being used.</typeparam>
public interface IDistributedCache<TCacheItem, TCacheKey>
where TCacheItem : class
{
/// <summary>
@ -20,7 +31,7 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item, or null.</returns>
TCacheItem Get(
string key,
TCacheKey key,
bool? hideErrors = null
);
@ -32,7 +43,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item, or null.</returns>
Task<TCacheItem> GetAsync(
[NotNull] string key,
[NotNull] TCacheKey key,
bool? hideErrors = null,
CancellationToken token = default
);
@ -47,7 +58,7 @@ namespace Volo.Abp.Caching
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
/// <returns>The cache item.</returns>
TCacheItem GetOrAdd(
string key,
TCacheKey key,
Func<TCacheItem> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null
@ -64,7 +75,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The cache item.</returns>
Task<TCacheItem> GetOrAddAsync(
[NotNull] string key,
[NotNull] TCacheKey key,
Func<Task<TCacheItem>> factory,
Func<DistributedCacheEntryOptions> optionsFactory = null,
bool? hideErrors = null,
@ -79,7 +90,7 @@ namespace Volo.Abp.Caching
/// <param name="options">The cache options for the value.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
void Set(
string key,
TCacheKey key,
TCacheItem value,
DistributedCacheEntryOptions options = null,
bool? hideErrors = null
@ -95,7 +106,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
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
/// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
void Refresh(
string key,
TCacheKey key,
bool? hideErrors = null
);
@ -120,7 +131,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
Task RefreshAsync(
string key,
TCacheKey key,
bool? hideErrors = null,
CancellationToken token = default
);
@ -131,7 +142,7 @@ namespace Volo.Abp.Caching
/// <param name="key">The key of cached item to be retrieved from the cache.</param>
/// <param name="hideErrors">Indicates to throw or hide the exceptions for the distributed cache.</param>
void Remove(
string key,
TCacheKey key,
bool? hideErrors = null
);
@ -143,7 +154,7 @@ namespace Volo.Abp.Caching
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> for the task.</param>
/// <returns>The <see cref="T:System.Threading.Tasks.Task" /> indicating that the operation is asynchronous.</returns>
Task RemoveAsync(
string key,
TCacheKey key,
bool? hideErrors = null,
CancellationToken token = default
);

8
framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj

@ -15,10 +15,10 @@
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="HtmlAgilityPack.NetCore" Version="1.5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="NuGet.Versioning" Version="5.2.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.2.1" />
<PackageReference Include="NuGet.Versioning" Version="5.3.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
<PackageReference Include="System.Security.Permissions" Version="4.6.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.3.1" />
</ItemGroup>
<ItemGroup>

4
framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj

@ -12,8 +12,8 @@
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.4" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>

5
framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationBuilderOptions.cs

@ -35,5 +35,10 @@ namespace Microsoft.Extensions.Configuration
/// Prefix for the environment variables.
/// </summary>
public string EnvironmentVariablesPrefix { get; set; }
/// <summary>
/// Command line arguments.
/// </summary>
public string[] CommandLineArgs { get; set; }
}
}

12
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();
}
}

13
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<IConfigurationAccessor>(new DefaultConfigurationAccessor(configurationRoot)));
return services.Replace(ServiceDescriptor.Singleton<IConfiguration>(configuration));
}
public static IConfigurationRoot GetConfiguration(this IServiceCollection services)
public static IConfiguration GetConfiguration(this IServiceCollection services)
{
var hostBuilderContext = services.GetSingletonInstanceOrNull<HostBuilderContext>();
if (hostBuilderContext?.Configuration != null)
@ -22,7 +19,7 @@ namespace Microsoft.Extensions.DependencyInjection
return hostBuilderContext.Configuration as IConfigurationRoot;
}
return services.GetSingletonInstance<IConfigurationAccessor>().Configuration;
return services.GetSingletonInstance<IConfiguration>();
}
}
}

1
framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj

@ -17,6 +17,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />

2
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)

23
framework/src/Volo.Abp.Core/Volo/Abp/Configuration/DefaultConfigurationAccessor.cs

@ -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;
}
}
}

11
framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs

@ -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; }
}
}

15
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<IConfigurationAccessor>(configurationAccessor);
if (!services.IsAdded<IConfiguration>())
{
services.AddSingleton<IConfiguration>(configurationAccessor.Configuration);
services.ReplaceConfiguration(
ConfigurationHelper.BuildConfiguration(
applicationCreationOptions.Configuration
)
);
}
services.TryAddSingleton<IModuleLoader>(moduleLoader);

2
framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj

@ -18,7 +18,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="1.60.6" />
<PackageReference Include="Dapper" Version="2.0.30" />
</ItemGroup>
</Project>

2
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;

2
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;

2
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;

2
framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj

@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="8.4.0" />
<PackageReference Include="FluentValidation" Version="8.5.0" />
</ItemGroup>
<ItemGroup>

2
framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj

@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="2.3.0" />
<PackageReference Include="MailKit" Version="2.3.2" />
</ItemGroup>
<ItemGroup>

2
framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj

@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.9.1" />
<PackageReference Include="MongoDB.Driver" Version="2.9.2" />
</ItemGroup>
<ItemGroup>

2
framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj

@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="5.1.0" />
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" />
<ProjectReference Include="..\Volo.Abp.Json\Volo.Abp.Json.csproj" />
<ProjectReference Include="..\Volo.Abp.Threading\Volo.Abp.Threading.csproj" />
</ItemGroup>

2
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;

2
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;

2
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;

2
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;

8
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
)
);
}
}
}

3
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);
}
}

15
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();
}

2
framework/test/AbpTestBase/AbpTestBase.csproj

@ -14,7 +14,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="NSubstitute" Version="4.2.1" />
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="xunit" Version="2.4.1" />

26
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<MyConsoleModule>(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<IConfiguration>();
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<IMessageWriter>();
foreach (var writer in writers)
@ -25,6 +42,9 @@ namespace SimpleConsoleDemo
writer.Write();
}
Console.WriteLine();
Console.WriteLine("Press ENTER to exit!");
Console.ReadLine();
}
}

20
framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@ -6,7 +6,23 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Core\Volo.Abp.Core.csproj" />
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
</ItemGroup>
</Project>

3
framework/test/SimpleConsoleDemo/appsettings.json

@ -0,0 +1,3 @@
{
"AppSettingKey1": "AppSettingValue1"
}

2
framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj

@ -17,7 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.AspNetCore.Authentication.OAuth\Volo.Abp.AspNetCore.Authentication.OAuth.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj

@ -12,7 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Tests\Volo.Abp.AspNetCore.Tests.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

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

@ -20,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
<ItemGroup>

2
framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj

@ -19,7 +19,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Tests\Volo.Abp.AspNetCore.Tests.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
<!-- Below ItemGroup and Target tags are added according to https://github.com/aspnet/Hosting/issues/959#issuecomment-286351703 -->

2
framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
</ItemGroup>
<ItemGroup>

2
framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
<ItemGroup>

2
framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
<ItemGroup>

2
framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj

@ -25,7 +25,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.AspNetCore.TestBase\Volo.Abp.AspNetCore.TestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj

@ -14,7 +14,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Auditing\Volo.Abp.Auditing.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj

@ -14,7 +14,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Authorization\Volo.Abp.Authorization.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj

@ -12,7 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj

@ -14,7 +14,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\Volo.Abp.Core.Tests\Volo.Abp.Core.Tests.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj

@ -13,7 +13,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.BackgroundJobs\Volo.Abp.BackgroundJobs.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj

@ -12,7 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Caching\Volo.Abp.Caching.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
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<AbpCacheOptions>(option =>
Configure<AbpDistributedCacheOptions>(option =>
{
option.CacheConfigurators.Add(cacheName =>
{

187
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<IDistributedCache<PersonCacheItem, int>>();
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<IDistributedCache<PersonCacheItem, int>>();
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<IDistributedCache<PersonCacheItem, int>>();
var otherPersonCache = GetRequiredService<IDistributedCache<Sail.Testing.Caching.PersonCacheItem, int>>();
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<IDistributedCache<PersonCacheItem, ComplexObjectAsCacheKey>>();
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<IDistributedCache<PersonCacheItem, ComplexObjectAsCacheKey>>();
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();
}
}
}

29
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]

2
framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Castle.Core\Volo.Abp.Castle.Core.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Cli.Core\Volo.Abp.Cli.Core.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Core\Volo.Abp.Core.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

7
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<IndependentEmptyModule>())
{
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<IConfigurationAccessor>()
.Configuration;
.GetRequiredService<IConfiguration>();
}
}
}

2
framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj

@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
</ItemGroup>

2
framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Data\Volo.Abp.Data.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Ddd.Domain\Volo.Abp.Ddd.Domain.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj

@ -18,7 +18,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Emailing\Volo.Abp.Emailing.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj

@ -17,7 +17,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj

@ -12,7 +12,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Ddd.Domain\Volo.Abp.Ddd.Domain.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.EventBus\Volo.Abp.EventBus.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj

@ -11,7 +11,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Features\Volo.Abp.Features.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj

@ -11,7 +11,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.FluentValidation\Volo.Abp.FluentValidation.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj

@ -11,7 +11,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Http.Client\Volo.Abp.Http.Client.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.Tests\Volo.Abp.AspNetCore.Mvc.Tests.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
<ItemGroup>

2
framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj

@ -14,7 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj

@ -11,7 +11,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.MailKit\Volo.Abp.MailKit.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj

@ -12,7 +12,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.MemoryDb\Volo.Abp.MemoryDb.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\Volo.Abp.TestApp\Volo.Abp.TestApp.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

4
framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj

@ -15,8 +15,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Mongo2Go" Version="2.2.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.MultiTenancy\Volo.Abp.MultiTenancy.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.ObjectMapping\Volo.Abp.ObjectMapping.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Security\Volo.Abp.Security.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Serialization\Volo.Abp.Serialization.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj

@ -11,7 +11,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Settings\Volo.Abp.Settings.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj

@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Specifications\Volo.Abp.Specifications.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj

@ -9,7 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.MemoryDb.Tests\Volo.Abp.MemoryDb.Tests.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

2
framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj

@ -14,7 +14,7 @@
<ProjectReference Include="..\..\src\Volo.Abp.TestBase\Volo.Abp.TestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Specifications\Volo.Abp.Specifications.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
</ItemGroup>
</Project>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save