Browse Source

Merge branch 'dev' into extra-properties

pull/3834/head
Halil İbrahim Kalkan 6 years ago
parent
commit
21c81e787b
  1. 17
      abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
  2. 4
      docs/en/Tutorials/Part-3.md
  3. 4
      docs/zh-Hans/Tutorials/Part-1.md
  4. 1350
      docs/zh-Hans/Tutorials/Part-2.md
  5. 199
      docs/zh-Hans/Tutorials/Part-3.md
  6. 9
      docs/zh-Hans/UI/Angular/Config-State.md
  7. 197
      docs/zh-Hans/UI/Angular/Modifying-the-Menu.md
  8. BIN
      docs/zh-Hans/UI/Angular/images/navigation-menu-after-patching.png
  9. BIN
      docs/zh-Hans/UI/Angular/images/navigation-menu-search-input.png
  10. BIN
      docs/zh-Hans/UI/Angular/images/navigation-menu-via-app-routing.png
  11. BIN
      docs/zh-Hans/UI/Angular/images/navigation-menu-via-config-state.png
  12. 4
      docs/zh-Hans/docs-nav.json
  13. 56
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs
  14. 39
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs
  15. 97
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs
  16. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/MyGetPackageListFinder.cs
  17. 62
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
  18. 27
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs
  19. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json
  20. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json
  21. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json
  22. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl-PL.json
  23. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json
  24. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/ru.json
  25. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json
  26. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json
  27. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json
  28. 2
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hant.json

17
abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json

@ -13,8 +13,9 @@
"Permission:Edit": "Edit",
"Permission:Delete": "Delete",
"Permission:Create": "Create",
"Permission:Accounting": "Accounting",
"Permission:Accounting:Quotation": "Quotation",
"Permission:Accounting": "Accounting",
"Permission:Accounting:Quotation": "Quotation",
"Permission:Accounting:Invoice": "Invoice",
"Menu:Organizations": "Organizations",
"Menu:Accounting": "Accounting",
"Menu:Packages": "Packages",
@ -101,13 +102,10 @@
"CompanyName": "Company name",
"CompanyAddress": "Company address",
"Price": "Price",
<<<<<<< Updated upstream
"DiscountText": "Discount text",
"DiscountQuantity": "Discount quantity",
"DiscountPrice": "Discount price",
"DiscountPrice": "Discount price",
"Quotation": "Quotation",
"Generate": "Generate"
=======
"ExtraText": "Extra Text",
"ExtraAmount": "Extra Amount",
"DownloadQuotation": "Download Quotation",
@ -117,9 +115,10 @@
"InvoiceDate": "Invoice Date",
"Quantity": "Quantity",
"AddProduct": "Add Product",
"NeedToAddProduct": "Need to add product to generate invoice !",
"AddProductWarning": "You need to add product!",
"TotalPrice": "Total Price",
"Generate": "Generate"
>>>>>>> Stashed changes
"Generate": "Generate",
"MissingQuantityField": "The quantity field is required!",
"MissingPriceField": "The Price field is required!"
}
}

4
docs/en/Tutorials/Part-3.md

@ -96,9 +96,9 @@ namespace Acme.BookStore
````
* `IRepository<Book, Guid>` is injected and used it in the `SeedAsync` to create two book entities as the test data.
* `IGuidGenerator` is injected to create GUIDs. While `Guid.NewGuid()` would perfectly work for testing, `IGuidGenerator` has additional features especially important while using real databases. Further information, see the [Guid generation document](../Guid-Generation.md).
### Testing the application service BookAppService
* `IGuidGenerator` is injected to create GUIDs. While `Guid.NewGuid()` would perfectly work for testing, `IGuidGenerator` has additional features especially important while using real databases. Further information, see the [Guid generation document](https://docs.abp.io/{{Document_Language_Code}}/abp/{{Document_Version}}/Guid-Generation).
### Testing the application service BookAppService
Create a test class named `BookAppService_Tests` in the `Acme.BookStore.Application.Tests` project:

4
docs/zh-Hans/Tutorials/Part-1.md

@ -27,8 +27,8 @@ end
ASP.NET Core {{UI_Value}} 系列教程包括三个3个部分:
- **Part-1: 创建项目和书籍列表页面(本章)**
- [Part-2: 创建,编辑,删除书籍](Part-II.md)
- [Part-3: 集成测试](Part-III.md)
- [Part-2: 创建,编辑,删除书籍](Part-2.md)
- [Part-3: 集成测试](Part-3.md)
> 你也可以观看由ABP社区成员为本教程录制的[视频课程](https://amazingsolutions.teachable.com/p/lets-build-the-bookstore-application).

1350
docs/zh-Hans/Tutorials/Part-2.md

File diff suppressed because it is too large

199
docs/zh-Hans/Tutorials/Part-3.md

@ -1 +1,198 @@
TODO ....
## ASP.NET Core {{UI_Value}} 教程 - 第三章
````json
//[doc-params]
{
"UI": ["MVC","NG"]
}
````
{{
if UI == "MVC"
DB="ef"
DB_Text="Entity Framework Core"
UI_Text="mvc"
else if UI == "NG"
DB="mongodb"
DB_Text="MongoDB"
UI_Text="angular"
else
DB ="?"
UI_Text="?"
end
}}
### 关于本教程
这是ASP.NET Core{{UI_Value}}系列教程的第二章. 共有三章:
- [Part-1: 创建项目和书籍列表页面](Part-1.md)
- [Part 2: 创建,编辑,删除书籍](Part-2.md)
- **Part-3: 集成测试(本章)**
> 你也可以观看由ABP社区成员为本教程录制的[视频课程](https://amazingsolutions.teachable.com/p/lets-build-the-bookstore-application).
### 解决方案中的测试项目
解决方案中有多个测试项目:
![bookstore-test-projects-v2](./images/bookstore-test-projects-{{UI_Text}}.png)
每个项目用于测试相关的应用程序项目.测试项目使用以下库进行测试:
* [xunit](https://xunit.github.io/) 作为主测试框架.
* [Shoudly](http://shouldly.readthedocs.io/en/latest/) 作为断言库.
* [NSubstitute](http://nsubstitute.github.io/) 作为模拟库.
### 添加测试数据
启动模板包含`Acme.BookStore.TestBase`项目中的`BookStoreTestDataSeedContributor`类,它创建一些数据来运行测试.
更改`BookStoreTestDataSeedContributor`类如下所示:
````csharp
using System;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
namespace Acme.BookStore
{
public class BookStoreTestDataSeedContributor
: IDataSeedContributor, ITransientDependency
{
private readonly IRepository<Book, Guid> _bookRepository;
private readonly IGuidGenerator _guidGenerator;
public BookStoreTestDataSeedContributor(
IRepository<Book, Guid> bookRepository,
IGuidGenerator guidGenerator)
{
_bookRepository = bookRepository;
_guidGenerator = guidGenerator;
}
public async Task SeedAsync(DataSeedContext context)
{
await _bookRepository.InsertAsync(
new Book(id: _guidGenerator.Create(),
name: "Test book 1",
type: BookType.Fantastic,
publishDate: new DateTime(2015, 05, 24),
price: 21
)
);
await _bookRepository.InsertAsync(
new Book(id: _guidGenerator.Create(),
name: "Test book 2",
type: BookType.Science,
publishDate: new DateTime(2014, 02, 11),
price: 15
)
);
}
}
}
````
* 注入`IRepository<Book,Guid>`并在`SeedAsync`中使用它来创建两个书实体作为测试数据.
* 使用`IGuidGenerator`服务创建GUID. 虽然`Guid.NewGuid()`非常适合测试,但`IGuidGenerator`在使用真实数据库时还有其他特别重要的功能(参见[Guid生成文档](../Guid-Generation.md)了解更多信息).
### 测试 BookAppService
在 `Acme.BookStore.Application.Tests` 项目中创建一个名叫 `BookAppService_Tests` 的测试类:
````csharp
using System;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Shouldly;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Validation;
using Microsoft.EntityFrameworkCore.Internal;
namespace Acme.BookStore
{
public class BookAppService_Tests : BookStoreApplicationTestBase
{
private readonly IBookAppService _bookAppService;
public BookAppService_Tests()
{
_bookAppService = GetRequiredService<IBookAppService>();
}
[Fact]
public async Task Should_Get_List_Of_Books()
{
//Act
var result = await _bookAppService.GetListAsync(
new PagedAndSortedResultRequestDto()
);
//Assert
result.TotalCount.ShouldBeGreaterThan(0);
result.Items.ShouldContain(b => b.Name == "Test book 1");
}
}
}
````
* 测试方法 `Should_Get_List_Of_Books` 直接使用 `BookAppService.GetListAsync` 方法来获取用户列表,并执行检查.
新增测试方法,用以测试创建一个合法book实体的场景:
````C#
[Fact]
public async Task Should_Create_A_Valid_Book()
{
//Act
var result = await _bookAppService.CreateAsync(
new CreateUpdateBookDto
{
Name = "New test book 42",
Price = 10,
PublishDate = DateTime.Now,
Type = BookType.ScienceFiction
}
);
//Assert
result.Id.ShouldNotBe(Guid.Empty);
result.Name.ShouldBe("New test book 42");
}
````
新增测试方法,用以测试创建一个非法book实体失败的场景:
````csharp
[Fact]
public async Task Should_Not_Create_A_Book_Without_Name()
{
var exception = await Assert.ThrowsAsync<Volo.Abp.Validation.AbpValidationException>(async () =>
{
await _bookAppService.CreateAsync(
new CreateUpdateBookDto
{
Name = "",
Price = 10,
PublishDate = DateTime.Now,
Type = BookType.ScienceFiction
}
);
});
exception.ValidationErrors
.ShouldContain(err => err.MemberNames.Any(mem => mem == "Name"));
}
````
* 由于 `Name` 是空值, ABP 抛出一个 `AbpValidationException` 异常.
打开**测试资源管理器**(测试 -> Windows -> 测试资源管理器)并**执行**所有测试:
![bookstore-appservice-tests](./images/bookstore-appservice-tests.png)
恭喜, 绿色图标表示测试已成功通过!

9
docs/zh-Hans/UI/Angular/Config-State.md

@ -236,7 +236,7 @@ const newRoute: ABP.Route = {
path: "page",
invisible: false,
order: 2,
requiredPolicy: "MyProjectName::MyNewPage"
requiredPolicy: "MyProjectName.MyNewPage"
};
this.config.dispatchAddRoute(newRoute);
@ -248,16 +248,17 @@ this.config.dispatchAddRoute(newRoute);
如果你想要**添加一个子路由,你可以这样做:**
```js
import { eIdentityRouteNames } from '@abp/ng.identity';
// this.config is instance of ConfigStateService
const newRoute: ABP.Route = {
parentName: "AbpAccount::Login",
parentName: eIdentityRouteNames.IdentityManagement,
name: "My New Page",
iconClass: "fa fa-dashboard",
path: "page",
invisible: false,
order: 2,
requiredPolicy: "MyProjectName::MyNewPage"
requiredPolicy: "MyProjectName.MyNewPage"
};
this.config.dispatchAddRoute(newRoute);
@ -291,4 +292,4 @@ this.config.dispatchSetEnvironment({
## 下一步是什么?
* [组件替换](./Component-Replacement.md)
- [修改菜单](./Modifying-the-Menu.md)

197
docs/zh-Hans/UI/Angular/Modifying-the-Menu.md

@ -0,0 +1,197 @@
# 修改菜单
菜单在 @abp/ng.theme.basic包 `ApplicationLayoutComponent` 内部. 有几种修改菜单的方法,本文档介绍了这些方法. 如果你想完全替换菜单,请参考[组件替换文档]了解如何替换布局.
<!-- TODO: Replace layout replacement document with component replacement. Layout replacement document will be created.-->
## 如何添加Logo
环境变量中的 `logoUrl` 是logo的url.
你可以在 `src/assets` 文件夹下添加logo并设置 `logoUrl`:
```js
export const environment = {
// other configurations
application: {
name: 'MyProjectName',
logoUrl: 'assets/logo.png',
},
// other configurations
};
```
## 如何添加导航元素
### 通过 AppRoutingModule 中的 `routes` 属性
你可以通过在 `app-routing.module` 中将路由作为子属性添加到路由配置的 `data` 属性来定义路由. `@abp/ng.core` 包组织路由并将其存储在 `ConfigState` 中.`ApplicationLayoutComponent` 从存储中获取路由显示在菜单上.
你可以像以下一样添加 `routes` 属性:
```js
{
path: 'your-path',
data: {
routes: {
name: 'Your navigation',
order: 3,
iconClass: 'fas fa-question-circle',
requiredPolicy: 'permission key here',
children: [
{
path: 'child',
name: 'Your child navigation',
order: 1,
requiredPolicy: 'permission key here',
},
],
} as ABP.Route, // can be imported from @abp/ng.core
}
}
```
- `name` 是导航元素的标签,可以传递本地化密钥或本地化对象.
- `order` 排序导航元素.
- `iconClass` 是 `i` 标签的类,在导航标签的左侧.
- `requiredPolicy` 是访问页面所需的权限key. 参阅 [权限管理文档](./Permission-Management.md)
- `children` is an array and is used for declaring child navigation elements. The child navigation element will be placed as a child route which will be available at `'/your-path/child'` based on the given `path` property.
- `children` 是一个数组,用于声明子菜单,它基于给定的 `path` 属性,路径是在`/your-path/child`.
添加了上面描述的route属性后,导航菜单如下图所示:
![navigation-menu-via-app-routing](./images/navigation-menu-via-app-routing.png)
## 通过 ConfigState
`ConfigStateService` 的 `dispatchAddRoute` 方法可以向菜单添加一个新的导航元素.
```js
// this.config is instance of ConfigStateService
const newRoute: ABP.Route = {
name: 'My New Page',
iconClass: 'fa fa-dashboard',
path: 'page',
invisible: false,
order: 2,
requiredPolicy: 'MyProjectName.MyNewPage',
} as Omit<ABP.Route, 'children'>;
this.config.dispatchAddRoute(newRoute);
// returns a state stream which emits after dispatch action is complete
```
`newRoute` 放在根级别,没有任何父路由,url将为`/path`.
如果你想 **添加子路由, 你可以这样做:**
```js
// this.config is instance of ConfigStateService
// eIdentityRouteNames enum can be imported from @abp/ng.identity
const newRoute: ABP.Route = {
parentName: eIdentityRouteNames.IdentityManagement,
name: 'My New Page',
iconClass: 'fa fa-dashboard',
path: 'page',
invisible: false,
order: 3,
requiredPolicy: 'MyProjectName.MyNewPage'
} as Omit<ABP.Route, 'children'>;
this.config.dispatchAddRoute(newRoute);
// returns a state stream which emits after dispatch action is complete
```
`newRoute` 做为 `eIdentityRouteNames.IdentityManagement` 的子路由添加, url 设置为 `'/identity/page'`.
新路由看起来像这样:
![navigation-menu-via-config-state](./images/navigation-menu-via-config-state.png)
## 如何修改一个导航元素
`DispatchPatchRouteByName` 方法通过名称查找路由,并使用二个参数传递的新配置替换存储中的配置.
```js
// this.config is instance of ConfigStateService
// eIdentityRouteNames enum can be imported from @abp/ng.identity
const newRouteConfig: Partial<ABP.Route> = {
iconClass: 'fas fa-home',
parentName: eIdentityRouteNames.Administration,
order: 0,
children: [
{
name: 'Dashboard',
path: 'dashboard',
},
],
};
this.config.dispatchPatchRouteByName('::Menu:Home', newRouteConfig);
// returns a state stream which emits after dispatch action is complete
```
* 根据给定的 `parentName` 将 _Home_ 导航移动到 _Administration_ 下拉框下.
* 添加了 icon.
* 指定了顺序.
* 添加了名为 _Dashboard_ 的子路由.
修改后,导航元素看起来像这样:
![navigation-menu-after-patching](./images/navigation-menu-after-patching.png)
## 如何在菜单的右侧添加元素
右侧的元素存储在 @abp/ng.theme.basic 包的 `LayoutState` 中.
`LayoutStateService` 的 `dispatchAddNavigationElement` 方法添加元素到右侧的菜单.
你可以通过将模板添加到 `app.component` 调用 `dispatchAddNavigationElement` 方法来插入元素:
```js
import { Layout, LayoutStateService } from '@abp/ng.theme.basic'; // added this line
@Component({
selector: 'app-root',
template: `
<!-- Added below content -->
<ng-template #search
><input type="search" placeholder="Search" class="bg-transparent border-0"
/></ng-template>
`,
})
export class AppComponent {
// Added ViewChild
@ViewChild('search', { static: false, read: TemplateRef }) searchElementRef: TemplateRef<any>;
constructor(private layout: LayoutStateService) {} // injected LayoutStateService
// Added ngAfterViewInit
ngAfterViewInit() {
const newElement = {
name: 'Search',
element: this.searchElementRef,
order: 1,
} as Layout.NavigationElement;
this.layout.dispatchAddNavigationElement(newElement);
}
}
```
上面我们在菜单添加了一个搜索输入,最终UI如下:s
![navigation-menu-search-input](./images/navigation-menu-search-input.png)
## 如何删除右侧菜单元素
TODO
## 下一步是什么?
* [组件替换](./Component-Replacement.md)

BIN
docs/zh-Hans/UI/Angular/images/navigation-menu-after-patching.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
docs/zh-Hans/UI/Angular/images/navigation-menu-search-input.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
docs/zh-Hans/UI/Angular/images/navigation-menu-via-app-routing.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
docs/zh-Hans/UI/Angular/images/navigation-menu-via-config-state.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

4
docs/zh-Hans/docs-nav.json

@ -333,6 +333,10 @@
"text": "配置状态",
"path": "UI/Angular/Config-State.md"
},
{
"text": "修改菜单",
"path": "UI/Angular/Modifying-the-Menu.md"
},
{
"text": "替换组件",
"path": "UI/Angular/Component-Replacement.md"

56
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs

@ -1,9 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using IdentityModel.Client;
using Polly;
using Polly.Extensions.Http;
using Volo.Abp.Cli.Auth;
using Microsoft.Extensions.Logging;
namespace Volo.Abp.Cli.Http
{
@ -41,5 +47,55 @@ namespace Volo.Abp.Cli.Http
client.SetBearerToken(accessToken);
}
}
public async Task<HttpResponseMessage> GetHttpResponseMessageWithRetryAsync<T>
(
string url,
CancellationToken? cancellationToken = null,
ILogger<T> logger = null,
IEnumerable<TimeSpan> sleepDurations = null
)
{
if (sleepDurations == null)
{
sleepDurations = new[]
{
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(4),
TimeSpan.FromSeconds(7)
};
}
if (!cancellationToken.HasValue)
{
cancellationToken = CancellationToken.None;
}
return await HttpPolicyExtensions
.HandleTransientHttpError()
.OrResult(msg => !msg.IsSuccessStatusCode)
.WaitAndRetryAsync(sleepDurations,
(responseMessage, timeSpan, retryCount, context) =>
{
if (responseMessage.Exception != null)
{
string httpErrorCode = responseMessage.Result == null ?
httpErrorCode = string.Empty :
"HTTP-" + (int)responseMessage.Result.StatusCode + ", ";
logger?.LogWarning(
$"{retryCount}. HTTP request attempt failed to {url} with an error: {httpErrorCode}{responseMessage.Exception.Message}. " +
$"Waiting {timeSpan.TotalSeconds} secs for the next try...");
}
else if (responseMessage.Result != null)
{
logger?.LogWarning(
$"{retryCount}. HTTP request attempt failed to {url} with an error: {(int)responseMessage.Result.StatusCode}-{responseMessage.Result.ReasonPhrase}. " +
$"Waiting {timeSpan.TotalSeconds} secs for the next try...");
}
})
.ExecuteAsync(async () => await this.GetAsync(url, cancellationToken.Value));
}
}
}

39
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs

@ -13,6 +13,7 @@ using Volo.Abp.Cli.Http;
using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Json;
using Volo.Abp.Threading;
namespace Volo.Abp.Cli.Licensing
{
@ -20,14 +21,21 @@ namespace Volo.Abp.Cli.Licensing
{
protected IJsonSerializer JsonSerializer { get; }
protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; }
protected ICancellationTokenProvider CancellationTokenProvider { get; }
private readonly ILogger<AbpIoApiKeyService> _logger;
private DeveloperApiKeyResult _apiKeyResult = null;
public AbpIoApiKeyService(IJsonSerializer jsonSerializer, IRemoteServiceExceptionHandler remoteServiceExceptionHandler, ILogger<AbpIoApiKeyService> logger)
public AbpIoApiKeyService(
IJsonSerializer jsonSerializer,
ICancellationTokenProvider cancellationTokenProvider,
IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
ILogger<AbpIoApiKeyService> logger)
{
JsonSerializer = jsonSerializer;
RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
_logger = logger;
CancellationTokenProvider = cancellationTokenProvider;
}
public async Task<DeveloperApiKeyResult> GetApiKeyOrNullAsync(bool invalidateCache = false)
@ -51,31 +59,10 @@ namespace Volo.Abp.Cli.Licensing
using (var client = new CliHttpClient())
{
var response = await HttpPolicyExtensions
.HandleTransientHttpError()
.OrResult(msg => !msg.IsSuccessStatusCode)
.WaitAndRetryAsync(new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(3),
TimeSpan.FromSeconds(7)
},
(responseMessage, timeSpan, retryCount, context) =>
{
if (responseMessage.Exception != null)
{
_logger.LogWarning(
$"{retryCount}. request attempt failed to {url} with an error: \"{responseMessage.Exception.Message}\". " +
$"Waiting {timeSpan.TotalSeconds} secs for the next try...");
}
else if (responseMessage.Result != null)
{
_logger.LogWarning(
$"{retryCount}. request attempt failed {url} with {(int)responseMessage.Result.StatusCode}-{responseMessage.Result.ReasonPhrase}. " +
$"Waiting {timeSpan.TotalSeconds} secs for the next try...");
}
})
.ExecuteAsync(async () => await client.GetAsync(url));
var response = await client.GetHttpResponseMessageWithRetryAsync(
url: url,
cancellationToken: CancellationTokenProvider.Token,
logger: _logger);
if (!response.IsSuccessStatusCode)
{

97
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs

@ -1,16 +1,10 @@
using Newtonsoft.Json;
using NuGet.Versioning;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Polly;
using Polly.Extensions.Http;
using Volo.Abp.Cli.Auth;
using Volo.Abp.Cli.Http;
using Volo.Abp.Cli.Licensing;
@ -29,6 +23,8 @@ namespace Volo.Abp.Cli.NuGet
protected ICancellationTokenProvider CancellationTokenProvider { get; }
protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; }
private readonly IApiKeyService _apiKeyService;
private List<string> _proPackageList;
private DeveloperApiKeyResult _apiKeyResult;
public NuGetService(
IJsonSerializer jsonSerializer,
@ -45,20 +41,20 @@ namespace Volo.Abp.Cli.NuGet
public async Task<SemanticVersion> GetLatestVersionOrNullAsync(string packageId, bool includePreviews = false, bool includeNightly = false)
{
List<string> proPackageList = null;
if (AuthService.IsLoggedIn())
{
proPackageList = await GetProPackageListAsync();
if (_proPackageList == null)
{
_proPackageList = await GetProPackageListAsync();
}
}
string url;
if (includeNightly)
{
url =
$"https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/{packageId.ToLowerInvariant()}/index.json";
url = $"https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/{packageId.ToLowerInvariant()}/index.json";
}
else if (proPackageList?.Contains(packageId) ?? false)
else if (_proPackageList?.Contains(packageId) ?? false)
{
url = await GetNuGetUrlForCommercialPackage(packageId);
}
@ -67,15 +63,13 @@ namespace Volo.Abp.Cli.NuGet
url = $"https://api.nuget.org/v3-flatcontainer/{packageId.ToLowerInvariant()}/index.json";
}
using (var client = new CliHttpClient(setBearerToken: false))
{
var responseMessage = await GetHttpResponseMessageWithRetryAsync(client, url);
if (!responseMessage.IsSuccessStatusCode)
{
throw new Exception($"ERROR: Remote server returns '{responseMessage.StatusCode}'");
}
var responseMessage = await client.GetHttpResponseMessageWithRetryAsync(
url,
cancellationToken: CancellationTokenProvider.Token,
logger: Logger
);
await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage);
@ -98,62 +92,41 @@ namespace Volo.Abp.Cli.NuGet
private async Task<string> GetNuGetUrlForCommercialPackage(string packageId)
{
var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync();
return CliUrls.GetNuGetPackageInfoUrl(apiKeyResult.ApiKey, packageId);
}
if (_apiKeyResult == null)
{
_apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync();
}
private async Task<HttpResponseMessage> GetHttpResponseMessageWithRetryAsync(HttpClient client, string url)
{
return await HttpPolicyExtensions
.HandleTransientHttpError()
.OrResult(msg => !msg.IsSuccessStatusCode)
.WaitAndRetryAsync(new[]
{
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(4),
TimeSpan.FromSeconds(7)
},
(responseMessage, timeSpan, retryCount, context) =>
{
if (responseMessage.Exception != null)
{
Logger.LogWarning(
$"{retryCount}. HTTP request attempt failed to {url} with an error: HTTP {(int)responseMessage.Result.StatusCode}-{responseMessage.Exception.Message}. " +
$"Waiting {timeSpan.TotalSeconds} secs for the next try...");
}
else if (responseMessage.Result != null)
{
Logger.LogWarning(
$"{retryCount}. HTTP request attempt failed to {url} with an error: {(int)responseMessage.Result.StatusCode}-{responseMessage.Result.ReasonPhrase}. " +
$"Waiting {timeSpan.TotalSeconds} secs for the next try...");
}
})
.ExecuteAsync(async () => await client.GetAsync(url, CancellationTokenProvider.Token));
return CliUrls.GetNuGetPackageInfoUrl(_apiKeyResult.ApiKey, packageId);
}
private async Task<List<string>> GetProPackageListAsync()
{
using var client = new CliHttpClient();
var responseMessage = await client.GetAsync(
$"{CliUrls.WwwAbpIo}api/app/nugetPackage/proPackageNames",
CancellationTokenProvider.Token
var url = $"{CliUrls.WwwAbpIo}api/app/nugetPackage/proPackageNames";
var responseMessage = await client.GetHttpResponseMessageWithRetryAsync(
url: url,
cancellationToken: CancellationTokenProvider.Token,
logger: Logger
);
if (!responseMessage.IsSuccessStatusCode)
if (responseMessage.IsSuccessStatusCode)
{
var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. ";
var remoteServiceErrorMessage = await RemoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage);
return JsonSerializer.Deserialize<List<string>>(await responseMessage.Content.ReadAsStringAsync());
}
if (remoteServiceErrorMessage != null)
{
exceptionMessage += remoteServiceErrorMessage;
}
Logger.LogInformation(exceptionMessage);
return null;
var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. ";
var remoteServiceErrorMessage = await RemoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage);
if (remoteServiceErrorMessage != null)
{
exceptionMessage += remoteServiceErrorMessage;
}
return JsonSerializer.Deserialize<List<string>>(await responseMessage.Content.ReadAsStringAsync());
Logger.LogError(exceptionMessage);
return null;
}
public class NuGetVersionResultDto

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/MyGetPackageListFinder.cs

@ -20,7 +20,7 @@ namespace Volo.Abp.Cli.ProjectModification
Logger = NullLogger<MyGetPackageListFinder>.Instance;
}
public async Task<MyGetApiResponse> GetPackages()
public async Task<MyGetApiResponse> GetPackagesAsync()
{
if (_response != null)
{

62
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs

@ -13,25 +13,31 @@ using Volo.Abp.Cli.Http;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
using Volo.Abp.IO;
using Volo.Abp.Threading;
namespace Volo.Abp.Cli.ProjectModification
{
public class NpmPackagesUpdater : ITransientDependency
{
public ILogger<NpmPackagesUpdater> Logger { get; set; }
protected ICancellationTokenProvider CancellationTokenProvider { get; }
private readonly PackageJsonFileFinder _packageJsonFileFinder;
private readonly NpmGlobalPackagesChecker _npmGlobalPackagesChecker;
private readonly MyGetPackageListFinder _myGetPackageListFinder;
private readonly Dictionary<string, string> _fileVersionStorage = new Dictionary<string, string>();
private MyGetApiResponse _myGetApiResponse;
public NpmPackagesUpdater(PackageJsonFileFinder packageJsonFileFinder, NpmGlobalPackagesChecker npmGlobalPackagesChecker, MyGetPackageListFinder myGetPackageListFinder)
public NpmPackagesUpdater(
PackageJsonFileFinder packageJsonFileFinder,
NpmGlobalPackagesChecker npmGlobalPackagesChecker,
MyGetPackageListFinder myGetPackageListFinder,
ICancellationTokenProvider cancellationTokenProvider)
{
_packageJsonFileFinder = packageJsonFileFinder;
_npmGlobalPackagesChecker = npmGlobalPackagesChecker;
_myGetPackageListFinder = myGetPackageListFinder;
CancellationTokenProvider = cancellationTokenProvider;
Logger = NullLogger<NpmPackagesUpdater>.Instance;
}
@ -77,7 +83,7 @@ namespace Volo.Abp.Cli.ProjectModification
}
}
private async Task DeleteNpmrcFileAsync(string directoryName)
private static async Task DeleteNpmrcFileAsync(string directoryName)
{
FileHelper.DeleteIfExists(Path.Combine(directoryName, ".npmrc"));
@ -135,11 +141,13 @@ namespace Volo.Abp.Cli.ProjectModification
{
using (var client = new CliHttpClient(TimeSpan.FromMinutes(1)))
{
var responseMessage = await client.GetAsync(
$"{CliUrls.WwwAbpIo}api/myget/apikey/"
var response = await client.GetHttpResponseMessageWithRetryAsync(
url: $"{CliUrls.WwwAbpIo}api/myget/apikey/",
cancellationToken: CancellationTokenProvider.Token,
logger: Logger
);
return Encoding.Default.GetString(await responseMessage.Content.ReadAsByteArrayAsync());
return Encoding.Default.GetString(await response.Content.ReadAsByteArrayAsync());
}
}
catch (Exception)
@ -148,26 +156,26 @@ namespace Volo.Abp.Cli.ProjectModification
}
}
private bool IsAngularProject(string fileDirectory)
private static bool IsAngularProject(string fileDirectory)
{
return File.Exists(Path.Combine(fileDirectory, "angular.json"));
}
protected virtual async Task<bool> UpdatePackagesInFile(string file, bool includePreviews = false, bool switchToStable = false)
protected virtual async Task<bool> UpdatePackagesInFile(string filePath, bool includePreviews = false, bool switchToStable = false)
{
var packagesUpdated = false;
var fileContent = File.ReadAllText(file);
var fileContent = File.ReadAllText(filePath);
var packageJson = JObject.Parse(fileContent);
var abpPackages = GetAbpPackagesFromPackageJson(packageJson);
if (!abpPackages.Any())
{
return packagesUpdated;
return false;
}
foreach (var abpPackage in abpPackages)
{
var updated = await TryUpdatePackage(file, abpPackage, includePreviews, switchToStable);
var updated = await TryUpdatingPackage(filePath, abpPackage, includePreviews, switchToStable);
if (updated)
{
@ -175,15 +183,18 @@ namespace Volo.Abp.Cli.ProjectModification
}
}
var modifiedFileContent = packageJson.ToString(Formatting.Indented);
var updatedContent = packageJson.ToString(Formatting.Indented);
File.WriteAllText(file, modifiedFileContent);
File.WriteAllText(filePath, updatedContent);
return packagesUpdated;
}
protected virtual async Task<bool> TryUpdatePackage(string file, JProperty package,
bool includePreviews = false, bool switchToStable = false)
protected virtual async Task<bool> TryUpdatingPackage(
string filePath,
JProperty package,
bool includePreviews = false,
bool switchToStable = false)
{
var currentVersion = (string)package.Value;
@ -198,23 +209,31 @@ namespace Volo.Abp.Cli.ProjectModification
package.Value.Replace(versionWithPrefix);
Logger.LogInformation($"Updated {package.Name} to {version} in {file.Replace(Directory.GetCurrentDirectory(), "")}.");
Logger.LogInformation($"Updated {package.Name} to {version} in {filePath.Replace(Directory.GetCurrentDirectory(), "")}.");
return true;
}
protected virtual async Task<string> GetLatestVersion(JProperty package, string currentVersion,
bool includePreviews = false, bool switchToStable = false)
protected virtual async Task<string> GetLatestVersion(
JProperty package,
string currentVersion,
bool includePreviews = false,
bool switchToStable = false)
{
if (_fileVersionStorage.ContainsKey(package.Name))
{
return _fileVersionStorage[package.Name];
}
string newVersion = currentVersion;
var newVersion = currentVersion;
if (includePreviews || (!switchToStable && currentVersion.Contains("-preview")))
{
var mygetPackage = (await _myGetPackageListFinder.GetPackages()).Packages.FirstOrDefault(p => p.Id == package.Name);
if (_myGetApiResponse == null)
{
_myGetApiResponse = await _myGetPackageListFinder.GetPackagesAsync();
}
var mygetPackage = _myGetApiResponse.Packages.FirstOrDefault(p => p.Id == package.Name);
if (mygetPackage != null)
{
newVersion = mygetPackage.Versions.Last();
@ -225,7 +244,6 @@ namespace Volo.Abp.Cli.ProjectModification
newVersion = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} version");
}
_fileVersionStorage[package.Name] = newVersion;
return newVersion;

27
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs

@ -42,8 +42,9 @@ namespace Volo.Abp.Cli.ProjectModification
protected virtual async Task UpdateInternalAsync(string projectPath, bool includePreviews = false, bool switchToStable = false)
{
var fileContent = File.ReadAllText(projectPath);
var updatedContent = await UpdateVoloPackagesAsync(fileContent, includePreviews, switchToStable);
File.WriteAllText(projectPath, await UpdateVoloPackagesAsync(fileContent, includePreviews, switchToStable));
File.WriteAllText(projectPath, updatedContent);
}
private async Task<string> UpdateVoloPackagesAsync(string content, bool includePreviews = false, bool switchToStable = false)
@ -74,16 +75,13 @@ namespace Volo.Abp.Cli.ProjectModification
var versionAttribute = package.Attributes["Version"];
var currentVersion = versionAttribute.Value;
var packageVersion = SemanticVersion.Parse(currentVersion);
Logger.LogDebug("Checking package: \"{0}\" - Current version: {1}", packageId, packageVersion);
var currentSemanticVersion = SemanticVersion.Parse(currentVersion);
Logger.LogDebug("Checking package: \"{0}\" - Current version: {1}", packageId, currentSemanticVersion);
if (includePreviews || (currentVersion.Contains("-preview") && !switchToStable))
{
var latestVersion = (await _myGetPackageListFinder.GetPackages()).Packages
.FirstOrDefault(p => p.Id == packageId)
?.Versions.LastOrDefault();
var latestVersion = await GetLatestVersionFromMyGet(packageId);
if (currentVersion != latestVersion)
{
@ -99,14 +97,14 @@ namespace Volo.Abp.Cli.ProjectModification
{
var latestVersion = await _nuGetService.GetLatestVersionOrNullAsync(packageId);
if (latestVersion != null && (currentVersion.Contains("-preview") || packageVersion < latestVersion))
if (latestVersion != null && (currentVersion.Contains("-preview") || currentSemanticVersion < latestVersion))
{
Logger.LogInformation("Updating package \"{0}\" from v{1} to v{2}.", packageId, packageVersion.ToString(), latestVersion.ToString());
Logger.LogInformation("Updating package \"{0}\" from v{1} to v{2}.", packageId, currentSemanticVersion.ToString(), latestVersion.ToString());
versionAttribute.Value = latestVersion.ToString();
}
else
{
Logger.LogInformation("Package: \"{0}-v{1}\" is up to date.", packageId, packageVersion);
Logger.LogInformation("Package: \"{0}-v{1}\" is up to date.", packageId, currentSemanticVersion);
}
}
}
@ -116,11 +114,18 @@ namespace Volo.Abp.Cli.ProjectModification
}
catch (Exception ex)
{
Logger.LogError("Cannot update volo packages! An error occured while updating the package \"{0}\". Error: {1}", packageId, ex.Message);
Logger.LogError("Cannot update Volo.* packages! An error occured while updating the package \"{0}\". Error: {1}", packageId, ex.Message);
Logger.LogException(ex);
}
return await Task.FromResult(content);
}
private async Task<string> GetLatestVersionFromMyGet(string packageId)
{
var myGetPack = await _myGetPackageListFinder.GetPackagesAsync();
return myGetPack.Packages.FirstOrDefault(p => p.Id == packageId)?.Versions.LastOrDefault();
}
}
}

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "V poli {0} musí být řežezec nebo řada o minimální délce '{1}'.",
"The {0} field is not a valid phone number.": "V poli {0} není platné telefonní číslo.",
"The field {0} must be between {1} and {2}.": "Pole {0} musí být mezi {1} a {2}.",
"The field {0} must match the regular expression '{1}'.": "Pole {0} musí odpovídat regulérnímu výrazu '{1}'.",
"The field {0} must match the regular expression '{1}'.": "Pole {0} neodpovídá požadovanému formátu.",
"The {0} field is required.": "Pole {0} je povinné.",
"The field {0} must be a string with a maximum length of {1}.": "Pole {0} musí být řetězec o maximální délce {1}.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "Pole {0} musí být řetězec o minimální délce {2} a maximální délce {1} znaků.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "The field {0} must be a string or array type with a minimum length of '{1}'.",
"The {0} field is not a valid phone number.": "The {0} field is not a valid phone number.",
"The field {0} must be between {1} and {2}.": "The field {0} must be between {1} and {2}.",
"The field {0} must match the regular expression '{1}'.": "The field {0} must match the regular expression '{1}'.",
"The field {0} must match the regular expression '{1}'.": "The field {0} does not match the requested format.",
"The {0} field is required.": "The {0} field is required.",
"The field {0} must be a string with a maximum length of {1}.": "The field {0} must be a string with a maximum length of {1}.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "El campo {0} debe ser una cadena o un array con una longitud mínima de '{1}'.",
"The {0} field is not a valid phone number.": "{0} no es un número de teléfono válido.",
"The field {0} must be between {1} and {2}.": "El campo {0} debe ser entre {1} y {2}.",
"The field {0} must match the regular expression '{1}'.": "El campo {0} debe coincidir con la expresión regular '{1}'.",
"The field {0} must match the regular expression '{1}'.": "El campo {0} no coincide con el formato solicitado.",
"The {0} field is required.": "La {0} campo es obligatorio.",
"The field {0} must be a string with a maximum length of {1}.": "El campo {0} debe ser una cadena con una longitud máxima de {1}.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "El campo {0} debe ser una cadena con una longitud mínima de {2} y una longitud máxima de {1}.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl-PL.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "Pole {0} musi być łańcuchem znaków lub talicą o minimalnej długości '{1}'.",
"The {0} field is not a valid phone number.": "Pole {0} nie jest poprawnym numerem telefonu.",
"The field {0} must be between {1} and {2}.": "Pole {0} musi być pomiędzy {1} i {2}.",
"The field {0} must match the regular expression '{1}'.": "Pole {0} musi pasować do wyrażenia regularnego '{1}'.",
"The field {0} must match the regular expression '{1}'.": "Pole {0} nie pasuje do żądanego formatu.",
"The {0} field is required.": "Pole {0} jest wymagane.",
"The field {0} must be a string with a maximum length of {1}.": "Pole {0} musi być łańcuchem znaków o maksymalnej długości {1}.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "Pole {0} musi być łańcuchem znaków o minimalnej długości {2} i maksymalnej długości {1}.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "O campo {0} deve ser uma palavra ou matriz com o tamanho mínimo de '{1}'.",
"The {0} field is not a valid phone number.": "O campo {0} não é um telefone válido.",
"The field {0} must be between {1} and {2}.": "O campo {0} deve estar entre {1} e {2}.",
"The field {0} must match the regular expression '{1}'.": "O campo {0} deve ser compatível com a expressão regular '{1}'.",
"The field {0} must match the regular expression '{1}'.": "O campo {0} não corresponde ao formato solicitado.",
"The {0} field is required.": "O Campo {0} é obrigatório.",
"The field {0} must be a string with a maximum length of {1}.": "O campo {0} deve ser uma palavra com o tamanho máximo de {1}.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "O campo {0} deve ser uma palavra com o tamanho mínimo de {2} e tamanho máximo de {1}.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/ru.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "Поле {0} должно иметь тип строки или массива с минимальной длиной '{1}'.",
"The {0} field is not a valid phone number.": "Поле {0} не содержит действительный номер телефона.",
"The field {0} must be between {1} and {2}.": "Поле {0} должно находиться между {1} и {2}.",
"The field {0} must match the regular expression '{1}'.": "Поле {0} должно соответствовать регулярному выражению '{1}'.",
"The field {0} must match the regular expression '{1}'.": "Поле {0} не соответствует запрошенному формату.",
"The {0} field is required.": "Поле {0} необходимо заполнить.",
"The field {0} must be a string with a maximum length of {1}.": "Поле {0} должно быть строкой с максимальной длиной {1}.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "Поле {0} должно быть строкой с минимальной длиной {2} и максимальной длиной {1}.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "{0} alanı en az '{1}' uzunluğunda bir metin ya da dizi olmalıdır.",
"The {0} field is not a valid phone number.": "{0} alanı geçerli bir telefon numarası olmalıdır.",
"The field {0} must be between {1} and {2}.": "{0} değeri {1} ile {2} arasında olmalıdır.",
"The field {0} must match the regular expression '{1}'.": "{0} alanı şu düzenli ifadeye uymalıdır: '{1}'.",
"The field {0} must match the regular expression '{1}'.": "{0} alanı istenilen biçimde değil.",
"The {0} field is required.": "{0} alanı zorunludur.",
"The field {0} must be a string with a maximum length of {1}.": "{0} alanı en fazla {1} uzunluğunda bir metin olmalıdır.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "{0} alanı en az {2}, en fazla {1} uzunluğunda bir metin olmalıdır.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json

@ -9,7 +9,7 @@
"The field {0} must be a string or array type with a maximum length of '{1}'.": "Trường {0} phải là một chuỗi hoặc một mảng với độ dài tối đa là '{1}'.",
"The {0} field is not a valid phone number.": "Trường {0} không phải là một số điện thoại hợp lệ",
"The field {0} must be between {1} and {2}.": "Trường {0} phải ở giữa {1} and {2}.",
"The field {0} must match the regular expression '{1}'.": "Trường {0} phải khớp với biểu thức chính quy '{1}'.",
"The field {0} must match the regular expression '{1}'.": "Trường {0} không khớp với định dạng được yêu cầu.",
"The {0} field is required.": "Trường {0} là bắt buộc.",
"The field {0} must be a string with a maximum length of {1}.": "Trường {0} phải là một chuỗi với độ dài tối đa là {1}.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "Trường {0} phải là một chuỗi với độ dài tối thiểu {2} và tối đa là {1}.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "字段{0}必须是最小长度为'{1}'的字符串或数组.",
"The {0} field is not a valid phone number.": "字段{0}不是有效的手机号码.",
"The field {0} must be between {1} and {2}.": "字段{0}值必须在{1}和{2}范围内.",
"The field {0} must match the regular expression '{1}'.": "字段{0}必须匹配正则表达式'{1}'.",
"The field {0} must match the regular expression '{1}'.": "字段{0}与请求的格式不匹配。",
"The {0} field is required.": "字段{0}不可为空.",
"The field {0} must be a string with a maximum length of {1}.": "字段{0}必须是长度为{1}的字符串.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "字段{0}必须是最小长度为{2}并且最大长度{1}的字符串.",

2
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hant.json

@ -10,7 +10,7 @@
"The field {0} must be a string or array type with a minimum length of '{1}'.": "欄位{0}必須是最小長度為'{1}'的字串或陣列.",
"The {0} field is not a valid phone number.": "欄位{0}不是有效的電話號碼.",
"The field {0} must be between {1} and {2}.": "欄位{0}值必須在{1}和{2}範圍內.",
"The field {0} must match the regular expression '{1}'.": "欄位{0}必須匹配正規表示式'{1}'.",
"The field {0} must match the regular expression '{1}'.": "字段{0}与请求的格式不匹配。",
"The {0} field is required.": "欄位{0}不可為空.",
"The field {0} must be a string with a maximum length of {1}.": "欄位{0}必須是長度為{1}的字串.",
"The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "欄位{0}必須是最小長度為{2}並且最大長度{1}的字串.",

Loading…
Cancel
Save