Browse Source

Merge remote-tracking branch 'abpframework/dev' into dev

pull/6659/head
liangshiwei 6 years ago
parent
commit
3e7ca9e8f8
  1. 8
      Directory.Build.props
  2. 5
      abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
  3. 5
      abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json
  4. 4
      abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
  5. 4
      abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json
  6. 10
      common.props
  7. 18
      docs/en/Authorization.md
  8. 79
      docs/en/Blog-Posts/2020-12-18 v4_1_Preview/POST.md
  9. BIN
      docs/en/Blog-Posts/2020-12-18 v4_1_Preview/event-list-ui.png
  10. 1
      docs/en/CLI.md
  11. 48
      docs/en/Community-Articles/2020-04-27-Use-Azure-Active-Directory-Authentication-for-MVC-Razor-Page-Applications/POST.md
  12. 12
      docs/en/Community-Articles/2020-09-16-How-to-Setup-Azure-Active-Directory-and-Integrate-Abp-Angular-Application/POST.md
  13. 110
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/POST.md
  14. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/both-example-result.png
  15. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/cover-image.png
  16. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/data-grid-app-contract.png
  17. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/data-grid-application.png
  18. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/data-grid-blazor.png
  19. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/initial-project.png
  20. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/sample-appointment.gif
  21. 534
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/POST.md
  22. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/automated-nuget-feed-setup.png
  23. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/final-result.jpg
  24. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/sample-application.jpg
  25. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/telerik-blazor-component-1.jpg
  26. BIN
      docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/telerik-progress-bar.gif
  27. 1581
      docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/POST.md
  28. BIN
      docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/author-crud.gif
  29. BIN
      docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/author-with-books.gif
  30. BIN
      docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-create.gif
  31. BIN
      docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-delete.gif
  32. BIN
      docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-edit.gif
  33. BIN
      docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-list.gif
  34. 6
      docs/en/Exception-Handling.md
  35. 392
      docs/en/Module-Entity-Extensions.md
  36. 2
      docs/en/Modules/Identity.md
  37. 3
      docs/en/Tutorials/Part-3.md
  38. 2
      docs/en/Tutorials/Part-4.md
  39. 6
      docs/en/Tutorials/Part-7.md
  40. 2
      docs/en/Tutorials/Part-9.md
  41. 44
      docs/en/UI/Angular/List-Service.md
  42. 161
      docs/en/UI/AspNetCore/Data-Table-Column-Extensions.md
  43. 28
      docs/en/UI/AspNetCore/Data-Tables.md
  44. 108
      docs/en/UI/AspNetCore/Entity-Action-Extensions.md
  45. 2
      docs/en/UI/AspNetCore/Theming.md
  46. 10
      docs/en/UI/Blazor/Authentication.md
  47. 75
      docs/en/UI/Blazor/Authorization.md
  48. 23
      docs/en/UI/Blazor/CurrentTenant.md
  49. 22
      docs/en/UI/Blazor/CurrentUser.md
  50. 62
      docs/en/UI/Blazor/Error-Handling.md
  51. 6
      docs/en/UI/Blazor/Overall.md
  52. 3
      docs/en/UI/Blazor/Page-Header.md
  53. 24
      docs/en/UI/Blazor/Routing.md
  54. 3
      docs/en/UI/Blazor/Testing.md
  55. 79
      docs/en/docs-nav.json
  56. BIN
      docs/en/images/add-new-propert-to-user-database-extra-properties.png
  57. BIN
      docs/en/images/add-new-propert-to-user-database-field.png
  58. BIN
      docs/en/images/add-new-property-enum.png
  59. BIN
      docs/en/images/add-new-property-to-user-form-validation-error-custom.png
  60. BIN
      docs/en/images/add-new-property-to-user-form-validation-error.png
  61. BIN
      docs/en/images/add-new-property-to-user-form.png
  62. BIN
      docs/en/images/add-new-property-to-user-table.png
  63. BIN
      docs/en/images/blazor-generic-exception-message.png
  64. BIN
      docs/en/images/blazor-user-friendly-exception.png
  65. BIN
      docs/en/images/table-column-extension-example.png
  66. BIN
      docs/en/images/user-action-extension-click-me.png
  67. BIN
      docs/en/images/user-action-extension-on-solution.png
  68. 1
      docs/zh-Hans/CLI.md
  69. 2
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/Branding.razor
  70. 41
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs
  71. 11
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
  72. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/tenant-switch.js
  73. 11
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/CmsKit/CmsKitScriptContributor.cs
  74. 11
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/CmsKit/CmsKitStyleContributor.cs
  75. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js
  76. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
  77. 1
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/StandardLayouts.cs
  78. 7
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemeExtensions.cs
  79. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
  80. 3
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpExtraPropertiesDictionaryModelBinderProvider.cs
  81. 19
      framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
  82. 7
      framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
  83. 15
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationErrorCodes.cs
  84. 22
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs
  85. 10
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/AbpAuthorizationResource.cs
  86. 10
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/en.json
  87. 10
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/tr.json
  88. 10
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/zh-Hans.json
  89. 2
      framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
  90. 3
      framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs
  91. 4
      framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
  92. 43
      framework/src/Volo.Abp.Autofac/Volo/Abp/Autofac/AbpAutofacConstructorFinder.cs
  93. 4
      framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs
  94. 2
      framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerAdapter.cs
  95. 25
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs
  96. 6
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs
  97. 15
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
  98. 10
      framework/src/Volo.Abp.BlazoriseUI/Components/SubmitButton.razor
  99. 73
      framework/src/Volo.Abp.BlazoriseUI/Components/SubmitButton.razor.cs
  100. 2
      framework/src/Volo.Abp.BlobStoring.Aliyun/Volo.Abp.BlobStoring.Aliyun.csproj

8
Directory.Build.props

@ -2,16 +2,16 @@
<PropertyGroup>
<!-- All Microsoft packages -->
<MicrosoftPackageVersion>5.0.0</MicrosoftPackageVersion>
<MicrosoftPackageVersion>5.0.*</MicrosoftPackageVersion>
<!-- Microsoft.NET.Test.Sdk https://www.nuget.org/packages/Microsoft.NET.Test.Sdk -->
<MicrosoftNETTestSdkPackageVersion>16.6.1</MicrosoftNETTestSdkPackageVersion>
<MicrosoftNETTestSdkPackageVersion>16.8.3</MicrosoftNETTestSdkPackageVersion>
<!-- NSubstitute https://www.nuget.org/packages/NSubstitute -->
<NSubstitutePackageVersion>4.2.2</NSubstitutePackageVersion>
<!-- Shouldly https://www.nuget.org/packages/Shouldly -->
<ShouldlyPackageVersion>3.0.2</ShouldlyPackageVersion>
<ShouldlyPackageVersion>4.0.1</ShouldlyPackageVersion>
<!-- xunit https://www.nuget.org/packages/xUnit -->
<xUnitPackageVersion>2.4.1</xUnitPackageVersion>
@ -20,7 +20,7 @@
<xUnitExtensibilityExecutionPackageVersion>2.4.1</xUnitExtensibilityExecutionPackageVersion>
<!-- xunit.runner.visualstudio https://www.nuget.org/packages/xunit.runner.visualstudio -->
<xUnitRunnerVisualstudioPackageVersion>2.4.2</xUnitRunnerVisualstudioPackageVersion>
<xUnitRunnerVisualstudioPackageVersion>2.4.3</xUnitRunnerVisualstudioPackageVersion>
<!-- Mongo2Go https://www.nuget.org/packages/Mongo2Go -->
<Mongo2GoPackageVersion>2.2.14</Mongo2GoPackageVersion>

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

@ -194,6 +194,9 @@
"CoverImage": "Cover Image",
"RemoveCacheConfirmationMessage": "Are you sure you remove the cache for \"{0}\" article?",
"SuccessfullyRemoved": "Successfully cleared",
"RemoveCache": "Remove Cache"
"RemoveCache": "Remove Cache",
"Language": "Language",
"Optional": "Optional",
"CreateArticleLanguageInfo": "The language in which the article is written"
}
}

5
abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json

@ -156,6 +156,9 @@
"RemainingQuestionCount": "Kalan soru sayısı",
"TotalQuestionMustBeGreaterWarningMessage": "Toplam soru sayısı kalan soru sayısından büyük olmalıdır!",
"QuestionCountsMustBeGreaterThanZero": "Toplam soru sayısı ve kalan soru sayısı sıfır veya sıfırdan daha büyük olmalıdır!",
"UnlimitedQuestionCount": "Sınırsız soru sayısı"
"UnlimitedQuestionCount": "Sınırsız soru sayısı",
"Language": "Dil",
"Optional": "Opsiyonel",
"CreateArticleLanguageInfo": "Makalenin yazıldığı dil"
}
}

4
abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json

@ -32,6 +32,8 @@
"MyProfile": "My profile",
"EmailNotValid": "Please enter a valid email address.",
"JoinOurMarketingNewsletter": "Join our marketing newsletter",
"WouldLikeToReceiveMarketingMaterials": "I would like to receive marketing materials like product deals & special offers."
"WouldLikeToReceiveMarketingMaterials": "I would like to receive marketing materials like product deals & special offers.",
"StartUsingYourLicenseNow": "Start using your license now!",
"WelcomePage": "Welcome Page"
}
}

4
abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json

@ -99,6 +99,8 @@
"Marketing": "Marketing",
"CommunityPrivacyPolicyConfirmation": "I agree to the Terms & Conditions and <a href=\"https://commercial.abp.io/Privacy\">Privacy Policy</a>.",
"ArticleRequestMessageTitle": "<a href=\"https://github.com/abpframework/abp/issues/new\">Open an issue</a> on the GitHub to request an article/tutorial you want to see on this web site.",
"ArticleRequestMessageBody": "Here, the list of the requested articles by the community. Do you want to write a requested article? Please click to the request and join to the discussion."
"ArticleRequestMessageBody": "Here, the list of the requested articles by the community. Do you want to write a requested article? Please click to the request and join to the discussion.",
"Language": "Language",
"CreateArticleLanguageInfo": "The language in which the article is written"
}
}

10
common.props

@ -9,8 +9,16 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/abpframework/abp/</RepositoryUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- https://github.com/dotnet/sourcelink -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

18
docs/en/Authorization.md

@ -280,21 +280,11 @@ public async Task CreateAsync(CreateAuthorDto input)
## Check a Permission in JavaScript
You may need to check a policy/permission on the client side.
See the following documents to learn how to re-use the authorization system on the client side:
### MVC UI
For ASP.NET Core MVC / Razor Pages applications, you can use the `abp.auth` API.
**Example: Check if a given permission has been granted for the current user**
```js
abp.auth.isGranted('MyPermissionName');
```
### Angular UI
See the [permission management document](UI/Angular/Permission-Management.md) for the Angular UI.
* [ASP.NET Core MVC / Razor Pages UI: Authorization](UI/AspNetCore/JavaScript-API/Auth.md)
* [Angular UI Authorization](UI/Angular/Permission-Management.md)
* [Blazor UI Authorization](UI/Blazor/Authorization.md)
## Permission Management

79
docs/en/Blog-Posts/2020-12-18 v4_1_Preview/POST.md

@ -0,0 +1,79 @@
# ABP Framework 4.1 RC Has Been Published
Today, we have released the [ABP Framework](https://abp.io/) (and the [ABP Commercial](https://commercial.abp.io/)) 4.1.0 RC. This blog post introduces the new features, important changes in the new version.
> **The planned release date for the [4.1.0 final](https://github.com/abpframework/abp/milestone/47) version is January 4, 2021**.
## Get Started with the 4.1 RC
If you want to try the version `4.1.0` today, follow the steps below;
1) **Upgrade** the ABP CLI to the version `4.1.0-rc.1` using a command line terminal:
````bash
dotnet tool update Volo.Abp.Cli -g --version 4.1.0-rc.1
````
**or install** if you haven't installed before:
````bash
dotnet tool install Volo.Abp.Cli -g --version 4.1.0-rc.1
````
2) Create a **new application** with the `--preview` option:
````bash
abp new BookStore --preview
````
See the [ABP CLI documentation](https://docs.abp.io/en/abp/3.3/CLI) for all the available options.
> You can also use the *Direct Download* tab on the [Get Started](https://abp.io/get-started) page by selecting the **Preview checkbox**.
## What's new with the ABP Framework 4.1
TODO
## What's new with the ABP Commercial 4.0
TODO
## Other News
### ABP Community Contents
A lot of new contents have been published in the ABP Community Web Site in the last two weeks:
* [Using DevExpress Blazor UI Components With the ABP Framework](https://community.abp.io/articles/using-devexpress-blazor-ui-components-with-the-abp-framework-wrpoa8rw) by [@berkansasmaz](https://github.com/berkansasmaz)
* [Creating a new UI theme by copying the Basic Theme (for MVC UI)](https://community.abp.io/articles/creating-a-new-ui-theme-by-copying-the-basic-theme-for-mvc-ui-yt9b18io) by [@ebubekirdinc](https://github.com/ebubekirdinc)
* [Using Angular Material Components With the ABP Framework](https://community.abp.io/members/muhammedaltug) by [@muhammedaltug](https://github.com/muhammedaltug)
* [How to export Excel files from the ABP framework](https://community.abp.io/articles/how-to-export-excel-files-from-the-abp-framework-wm7nnw3n) by [bartvanhoey](https://github.com/bartvanhoey)
* [Creating an Event Organizer Application with the ABP Framework & Blazor UI](https://community.abp.io/articles/creating-an-event-organizer-application-with-the-blazor-ui-wbe0sf2z) by [@hikalkan](https://github.com/hikalkan)
Thanks to all of the contributors. We are waiting for your contributions too. If you want to create content for the ABP Community, please visit [community.abp.io](https://community.abp.io/) website and submit your article.
#### Be a Superhero on Day 1 with ABP.IO
Thanks to [@lprichar](http://github.com/lprichar) prepared an awesome introduction video for the ABP.IO Platform: "[Be a Superhero on Day 1 with ABP.IO](https://www.youtube.com/watch?v=ea0Zx9DLcGA)".
#### New Sample Application: Event Organizer
This is a new example application developed using the ABP Framework and the Blazor UI. See [this article](https://community.abp.io/articles/creating-an-event-organizer-application-with-the-blazor-ui-wbe0sf2z) for a step by step implementation guide.
![event-list-ui](event-list-ui.png)
### Github Discussions
We enabled the [GitHub Discussions for the abp repository](https://github.com/abpframework/abp/discussions) as another place to discuss ideas or get help for the ABP Framework. The ABP core team is spending time participating in discussions and answering to questions as much as possible.
## About the Next Release(s)
Beginning from the next version (4.2.0), we are starting to spend more effort on the **CMS Kit module**. The purpose of this module is to provide CMS primitives (e.g. **comments, tags, reactions, contents**...) and features (e.g. **blog, pages, surveys**) as pre-built and reusable components. Current blog module will be a part of the CMS Kit module. We will continue to prepare documents, guides, tutorials and examples. And surely, we will continue to make enhancements and optimizations on the current features.
> The planned preview release date for the version 4.2.0 is January 14, 2021 and the final (stable) version release date is January 28, 2021.
Follow the [GitHub milestones](https://github.com/abpframework/abp/milestones) for all the planned ABP Framework version release dates.
## Feedback
Please check out the ABP Framework 4.1.0 RC and [provide feedback](https://github.com/abpframework/abp/issues/new) to help us to release a more stable version. **The planned release date for the [4.1.0 final](https://github.com/abpframework/abp/milestone/45) version is January 4, 2021.**.

BIN
docs/en/Blog-Posts/2020-12-18 v4_1_Preview/event-list-ui.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 KiB

1
docs/en/CLI.md

@ -129,6 +129,7 @@ abp update [options]
* `--solution-path` or `-sp`: Specify the solution path. Use the current directory by default
* `--solution-name` or `-sn`: Specify the solution name. Search `*.sln` files in the directory by default.
* `--check-all`: Check the new version of each package separately. Default is `false`.
* `--version` or `-v`: Specifies the version to use for update. If not specified, latest version is used.
### add-package

48
docs/en/Community-Articles/2020-04-27-Use-Azure-Active-Directory-Authentication-for-MVC-Razor-Page-Applications/POST.md

@ -6,9 +6,9 @@ Adding Azure Active Directory is pretty straightforward in ABP framework. Couple
Two different **alternative approaches** for AzureAD integration will be demonstrated for better coverage.
1. **AddAzureAD**: This approach uses Microsoft [AzureAD UI nuget package](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.AzureAD.UI/) which is very popular when users search the web about how to integrate AzureAD to their web application.
1. ~~**AddAzureAD**: This approach uses Microsoft [AzureAD UI nuget package](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.AzureAD.UI/) which is very popular when users search the web about how to integrate AzureAD to their web application.~~ Now marked **Obsolete** (see https://github.com/aspnet/Announcements/issues/439).
2. **AddOpenIdConnect**: This approach uses default [OpenIdConnect](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.OpenIdConnect/) which can be used for not only AzureAD but for all OpenId connections.
3. **AddMicrosoftIdentityWebAppAuthentication:** This approach uses newly introduced [Microsoft.Identity.Web nuget package](https://www.nuget.org/packages/Microsoft.Identity.Web/) to replace AddAzureAD.
> There is **no difference** in functionality between these approaches. AddAzureAD is an abstracted way of OpenIdConnection ([source](https://github.com/dotnet/aspnetcore/blob/c56aa320c32ee5429d60647782c91d53ac765865/src/Azure/AzureAD/Authentication.AzureAD.UI/src/AzureADAuthenticationBuilderExtensions.cs#L122)) with predefined cookie settings.
>
@ -134,13 +134,50 @@ private void ConfigureAuthentication(ServiceConfigurationContext context, IConfi
And that's it, integration is completed. Keep on mind that you can connect any other external authentication providers.
## 3. AddMicrosoftIdentityWebAppAuthentication
With .Net 5.0, AzureAd is marked [obsolute](https://github.com/dotnet/aspnetcore/issues/25807) and will not be supported in the near future. However its expanded functionality is available in [microsoft-identity-web](https://github.com/AzureAD/microsoft-identity-web/wiki) packages.
Add (or replace with) the new nuget package Microsoft.Identity.Web nuget package](https://www.nuget.org/packages/Microsoft.Identity.Web/).
In your **.Web** project; you update the `ConfigureAuthentication` method located in your **ApplicationWebModule** with the following while having the AzureAd appsettings section as defined before:
````csharp
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Add("sub", ClaimTypes.NameIdentifier);
context.Services.AddAuthentication()
.AddIdentityServerAuthentication(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = false;
options.ApiName = "Acme.BookStore";
});
context.Services.AddMicrosoftIdentityWebAppAuthentication(
configuration: configuration,
configSectionName: "AzureAd",
openIdConnectScheme:"AzureAD",
cookieScheme:null);
}
````
And that's all to add new Microsoft-Identity-Web.
> **Don't forget to:**
>
> * Pass **cookieScheme** parameter as **null** or your [*GetExternalLoginInfoAsync* method will always return null](https://github.com/AzureAD/microsoft-identity-web/issues/133#).
Keep in mind that [Microsoft-Identity-Web](https://github.com/AzureAD/microsoft-identity-web) is relatively new and keeps getting new enhancements, features and documentation.
## The Source Code
You can find the source code of the completed example [here](https://github.com/abpframework/abp-samples/tree/master/Authentication-Customization).
# FAQ
* Help! `GetExternalLoginInfoAsync` returns `null`!
* Help! `GetExternalLoginInfoAsync` returns `null`! (Using obsolute **AddAzureAD**)
* There can be 2 reasons for this;
@ -158,6 +195,11 @@ You can find the source code of the completed example [here](https://github.com/
````
* Help! `GetExternalLoginInfoAsync` returns `null`! (Using **AddMicrosoftIdentityWebAppAuthentication**)
* Pass cookieScheme parameter as **null**. (See [this issue](https://github.com/AzureAD/microsoft-identity-web/issues/133)).
* Help! I am getting ***System.ArgumentNullException: Value cannot be null. (Parameter 'userName')*** error!

12
docs/en/Community-Articles/2020-09-16-How-to-Setup-Azure-Active-Directory-and-Integrate-Abp-Angular-Application/POST.md

@ -1,22 +1,22 @@
# How to Setup Azure Active Directory and Integrate Abp Angular Application
# How to Setup Azure Active Directory and Integrate ABP Angular Application
This guide demonstrates how to register an application to Azure Active Directory and integrate AzureAD to an ABP angular application that enables users to sign in using OAuth 2.0 with credentials from **Azure Active Directory**.
This guide demonstrates how to register an application to Azure Active Directory and integrate AzureAD to an ABP Angular application that enables users to sign in using OAuth 2.0 with credentials from **Azure Active Directory**.
## Authentication Flow
Abp angular applications use **Authentication Code with PKCE** (specs [here](https://tools.ietf.org/html/rfc7636)) which is the most suitable flow for spa applications by the time this article is written since implicit flow is deprecated.
ABP Angular application uses **Authentication Code with PKCE** (specs [here](https://tools.ietf.org/html/rfc7636)) which is the most suitable flow for SPA applications by the time this article is written since implicit flow is deprecated.
The most common question is;
> Where to put OpenId connection code in angular project?
> Where to put OpenId connection code in the Angular project?
The answer is, **you don't**. Abp angular application is integrated with backend code (HttpApi.Host project) where it loads the configurations, **permissions** etc. For none-tiered angular applications, **HttpApi.Host** project also has IdentityServer4 embedded; also serving as **Authorization Server**. Angular application authentication flow is shown below.
The answer is, **you don't**. ABP Angular application is integrated with the backend (HttpApi.Host project) where it loads the configurations, **permissions** etc. For none-tiered angular applications, **HttpApi.Host** project also has IdentityServer4 embedded; also serving as **Authorization Server**. Angular application authentication flow is shown below.
<img src="auth-diagram.jpeg" alt="auth-diagram" style="zoom:50%;" />
> What if I want Azure AD as my authorization server and not IdentityServer?
This means your application will be using AzureAD user store for authentication. By registering both angular app and HttpApi to AzureAD, authentication might work but **authorization won't**. Users need to be registered to Abp identity system for auditing, permissions etc. So the flow should be 3rd party registration.
This means your application will be using AzureAD user store for authentication. By registering both Angular app and HttpApi to AzureAD, authentication might work but **authorization won't**. Users need to be registered to ABP identity system for auditing, permissions etc. So the flow should be 3rd party registration.
## Setting up OpenId Connection

110
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/POST.md

@ -0,0 +1,110 @@
## Using DevExpress Blazor UI Components With the ABP Framework
Hi, in this step by step article, I will show you how to integrate [DevExpress](https://demos.devexpress.com/blazor/) blazor UI components into ABP Framework-based applications.
![both-example-result](both-example-result.png)
*(A screenshot from the example application developed in this article)*
## Create the Project
> ABP Framework offers startup templates to get into business faster.
In this article, I will create a new startup template with EF Core as a database provider and Blazor for UI framework. But if you already have a project with Blazor UI, you don't need to create a new startup template, you can directly implement the following steps to your existing project.
> If you already have a project with the Blazor UI, you can skip this section.
* Before starting to development, we will create a solution named `DevExpressSample` (or whatever you want). We will create a new startup template with EF Core as a database provider and Blazor for UI framework by using [ABP CLI](https://docs.abp.io/en/abp/latest/CLI):
````bash
abp new DevExpressSample -u blazor
````
![initial-project](initial-project.png)
* Our project boilerplate will be ready after the download is finished. Then, we can open the solution in the Visual Studio (or any other IDE) and run the `DevExpressSample.DbMigrator` to create the database and seed initial data (which creates the admin user, admin role, permissions etc.)
* After database and initial data created,
* Run the `DevExpressSample.HttpApi.Host` to see our server side working and
* Run the `DevExpressSample.Blazor` to see our UI working properly.
> _Default login credentials for admin: username is **admin** and password is **1q2w3E\***_
## Install DevExpress
You can follow [this documentation](https://docs.devexpress.com/Blazor/401986/getting-started/install-components-and-create-an-application/without-devexpress-installer/microsoft-templates) to install DevExpress packages into your computer.
> Don't forget to add _"DevExpress NuGet Feed"_ to your **Nuget Package Sources**.
### Adding DevExpress NuGet Packages
Add the `DevExpress.Blazor` NuGet package to the `DevExpressSample.Blazor` project.
```
Install-Package DevExpress.Blazor
```
### Register DevExpress Resources
1. Add the following line to the HEAD section of the `wwwroot/index.html` file within the `DevExpressSample.Blazor` project:
```Razor
<head>
<!--...-->
<link href="_content/DevExpress.Blazor/dx-blazor.css" rel="stylesheet" />
</head>
```
2. In the `DevExpressSampleBlazorModule` class, call the `AddDevExpressBlazor()` method from your project's `ConfigureServices()` method:
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
var environment = context.Services.GetSingletonInstance<IWebAssemblyHostEnvironment>();
var builder = context.Services.GetSingletonInstance<WebAssemblyHostBuilder>();
// ...
builder.Services.AddDevExpressBlazor();
}
```
3. Register the **DevExpressSample.Blazor** namespace in the `_Imports.razor` file:
```Razor
@using DevExpress.Blazor
```
### Result
The installation step was done. You can use any DevExpress Blazor UI component in your application:
Example: A Scheduler:
![sample-appointment](sample-appointment.gif)
This example has been created by following [this documentation](https://demos.devexpress.com/blazor/SchedulerViewTypes).
## The Sample Application
We have created a sample application with [Data Grid](https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxDataGrid-1) example.
### The Source Code
You can download the source code from [here](https://github.com/abpframework/abp-samples/tree/master/DevExpress-Blazor).
The related files for this example are marked in the following screenshots.
![data-grid-app-contract](data-grid-app-contract.png)
![data-grid-application](data-grid-application.png)
![data-grid-web](data-grid-blazor.png)
### Additional Notes
#### Data Storage
I've used an in-memory list to store data for this example, instead of a real database. Because it is not related to DevExpress usage. There is a `SampleDataService.cs` file in `Data` folder at `DevExpressSample.Application.Contracts` project. All the data is stored here.
## Conclusion
In this article, I've explained how to use [DevExpress](https://www.devexpress.com/blazor/) components in your application. ABP Framework is designed so that it can work with any UI library/framework.

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/both-example-result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/cover-image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/data-grid-app-contract.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/data-grid-application.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/data-grid-blazor.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/initial-project.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-DevExpress-Blazor-Component/sample-appointment.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 KiB

534
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/POST.md

@ -0,0 +1,534 @@
# How to Integrate the Telerik Blazor Components to the ABP Blazor UI?
## Introduction
Hi, in this step by step article, we will see how we can integrate the Telerik Blazor Components to our Blazor UI.
## Creating the Solution
> ABP Framework offers startup templates to get into business faster.
In this article, I will create a new startup template with EF Core as a database provider and Blazor for UI framework. But if you already have a project with Blazor UI, you don't need to create a new startup template, you can directly implement the following steps to your existing project.
> If you already have a project with the Blazor UI, you can skip this section.
* Before starting to development, we will create a solution named `TelerikComponents` (or whatever you want). We will create a new startup template with EF Core as a database provider and Blazor for UI framework by using [ABP CLI](https://docs.abp.io/en/abp/latest/CLI):
```bash
abp new TelerikComponents --ui blazor --database-provider ef
```
* Our project boilerplate will be ready after the download is finished. Then, we can open the solution in the Visual Studio (or any other IDE) and run the `TelerikComponents.DbMigrator` to create the database and seed initial data (which creates the admin user, admin role, permissions, etc.)
* After the database and initial data created,
* Run the `TelerikComponents.HttpApi.Host` to see our server-side working and
* Run the `TelerikComponents.Blazor` to see our UI working.
> _Default login credentials for admin: username is **admin** and password is **1q2w3E\***_
## Starting the Development
### Pre-requisite
* First thing we need to do is downloading the [Progress Control Panel](https://www.telerik.com/download-trial-file/v2/control-panel?_ga=2.212029332.1667119438.1607582144-1944255175.1605161949) to get Telerik Blazor Components on our development machine.
* If you will use the Telerik Blazor Components for the first time or you don't have an active license you can click [here](https://www.telerik.com/login/v2/download-b?ReturnUrl=https%3a%2f%2fwww.telerik.com%2fdownload-trial-file%2fv2-b%2fui-for-blazor%3f_ga%3d2.212029332.1667119438.1607582144-1944255175.1605161949#register) to download free trial.
> You can find the more installation details from [here](https://docs.telerik.com/blazor-ui/getting-started/client-blazor?_ga=2.55603115.1667119438.1607582144-1944255175.1605161949&_gac=1.261851647.1607669357.CjwKCAiAq8f-BRBtEiwAGr3DgUDhBT25rs7hU0EQ8K-AfeUVxs3hSoIuIAuBOZ17CNPI4ZEArORPExoCyd4QAvD_BwE#step-0---download-the-components).
>**Notes:** To download Telerik Blazor packages via NuGet, we need to setup Telerik NuGet package source. We can state it in the installer as below. In this way, we can download the required Telerik Blazor packages via NuGet.
![setup-nuget-package-source](./automated-nuget-feed-setup.png)
### Step 1 (Configurations)
* We need to install the `Telerik.UI.for.Blazor` Nuget package to our Blazor project (`*.Blazor`). We need to choose package source to **telerik.com** for Visual Studio to see this package.
* If you use trial version of Telerik, you can download **Telerik.UI.for.Blazor.Trial** package via NuGet.
* After the installation finished, we need to open **index.html** (it's under *wwwroot* folder) to add css and js files in our application.
* Add the following lines just before the closing head tag (**/head**).
```html
...
<link rel="stylesheet" href="https:unpkg.com/@progress/kendo-theme-default@latest/dist/all.css" />
<script src="_content/Telerik.UI.for.Blazor/js/telerik-blazor.js" defer></script>
<!-- For Trial licenses use
<script src="_content/Telerik.UI.for.Blazor.Trial/js/telerik-blazor.js" defer></script>
-->
</head>
```
* After that, we need to add the Telerik Blazor Components to our application's service collection. So just open the `TelerikComponentsBlazorModule` and update the `ConfigureServices` method with the following content.
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
var environment = context.Services.GetSingletonInstance<IWebAssemblyHostEnvironment>();
var builder = context.Services.GetSingletonInstance<WebAssemblyHostBuilder>();
ConfigureAuthentication(builder);
ConfigureHttpClient(context, environment);
ConfigureBlazorise(context);
ConfigureRouter(context);
ConfigureUI(builder);
ConfigureMenu(context);
ConfigureAutoMapper(context);
//add this line to be able to use the components
builder.Services.AddTelerikBlazor();
}
```
* After the service added we will continue by opening **_Imports.razor** file and add the global using statements as below. This will bring our Telerik components into scope throughout the application.
![telerik-blazor-component-1](./telerik-blazor-component-1.jpg)
* After all of these steps, the Telerik UI Components are ready to be used anywhere in our application. We can use the Telerik Blazor Components by wrapping our components or pages between `<TelerikRootComponent>` and `</TelerikRootComponent>` tags.
### Step 2 - Checking Configurations
* We should check, have we done the right configurations or not. For that, we can open the **Index.razor** file and we can update the component with the following content.
```razor
@page "/"
@using Volo.Abp.MultiTenancy
@inherits TelerikComponentsComponentBase
@inject ICurrentTenant CurrentTenant
@inject AuthenticationStateProvider AuthenticationStateProvider
@using System.Timers
@implements IDisposable
<TelerikRootComponent>
<div class="progress-bar-wrapper">
<h5 class="progress-info-title">Telerik Progress Bar Component</h5>
<TelerikProgressBar Value="@ProgressValue" Max="100"></TelerikProgressBar>
</div>
</TelerikRootComponent>
@code {
private const int TimerInterval = 1000;
private const int TotalTime = 10 * TimerInterval;
private double ProgressValue = 0;
private int ProgressStep = 100 / (TotalTime / TimerInterval);
private Timer Timer { get; set; } = new Timer();
private void Dispose()
{
StopProgress();
Timer?.Close();
}
protected override void OnAfterRender(bool firstRender)
{
if (Timer.Enabled == false)
{
Timer.Interval = TimerInterval;
Timer.Elapsed -= OnTimerElapsed;
Timer.Elapsed += OnTimerElapsed;
Timer.AutoReset = true;
Timer.Start();
}
}
private void OnTimerElapsed(Object source, ElapsedEventArgs e)
{
if (ProgressValue < 100)
{
UpdateProgress();
}
else
{
StopProgress();
}
}
private void UpdateProgress()
{
ProgressValue += ProgressStep;
InvokeAsync(StateHasChanged);
}
private void StopProgress()
{
Timer?.Stop();
}
}
<style>
.progress-info-title {
font-weight: bold;
font-size: 1.4em;
}
</style>
```
* In here, we've just added the `TelerikProgressBar` component to check the integration configured properly.
* When we run `*.HttpApi.Host` and `*.Blazor` projects, we should see that the `TelerikProgressBar` component works and has similar view as the below gif.
![telerik-progress-bar](./telerik-progress-bar.gif)
* If you haven't seen this component like above, you should check the above configurations and be assure every step done as stated.
### Step 3 - Using The Telerik Blazor Components (Sample Application)
* Let's create a sample application for use other Telerik Blazor Components (like DataGrid).
* We will use [jsonplaceholder](https://jsonplaceholder.typicode.com/) as **mock data** to the listing, adding, updating and deleting posts.
* Firstly, we can create a folder named `Posts` and inside this folder, we can create the classes which are highlighted in the following screenshot.
![sample-application](./sample-application.jpg)
* After classes created we can fill the classes with the following contents.
**Post.cs**
```csharp
using System;
namespace TelerikComponents.Posts
{
[Serializable]
public class Post
{
public int Id { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public int UserId { get; set; }
}
}
```
**Comment.cs**
```csharp
using System;
namespace TelerikComponents.Posts
{
[Serializable]
public class Comment
{
public int PostId { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string Body { get; set; }
}
}
```
**IPostAppService.cs**
```csharp
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace TelerikComponents.Posts
{
public interface IPostAppService : IApplicationService
{
Task<List<Post>> GetPostsAsync();
Task<Post> AddPostAsync(Post post);
Task<Post> UpdatePostAsync(int postId, Post post);
Task DeletePostAsync(int postId);
Task<Comment> GetFirstCommentByPostIdAsync(int postId);
}
}
```
* In here, we basically created two class (which are **Post** and **Comment**). These classes are used to hold data returned as JSON.
* After that, we need to implement `IPostAppService`. For achieve this, we can create a folder named `Posts` in **\*.Application** layer and inside this folder we can create a class named `PostAppService` with the following content.
**PostAppService.cs**
```csharp
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace TelerikComponents.Posts
{
public class PostAppService : ApplicationService, IPostAppService
{
private JsonSerializerOptions _options = new JsonSerializerOptions
{
IncludeFields = true,
PropertyNameCaseInsensitive = true
};
public async Task<List<Post>> GetPostsAsync()
{
var url = "https://jsonplaceholder.typicode.com/posts";
List<Post> _posts = new List<Post>();
using (var client = new HttpClient())
{
var result = await client.GetAsync(url);
if (result.IsSuccessStatusCode)
{
var content = await result.Content.ReadAsStringAsync();
var deserializedPosts = JsonSerializer.Deserialize<List<Post>>(content, _options);
_posts = deserializedPosts;
}
}
return _posts;
}
public async Task<Post> AddPostAsync(Post post)
{
var url = "https://jsonplaceholder.typicode.com/posts";
Post addedPost = null;
using (var client = new HttpClient())
{
var serializePost = JsonSerializer.Serialize(post);
var content = new StringContent(serializePost, Encoding.UTF8, "application/json");
var result = await client.PostAsync(url, content);
if (result.IsSuccessStatusCode)
{
var response = await result.Content.ReadAsStringAsync();
addedPost = JsonSerializer.Deserialize<Post>(response);
}
}
return addedPost;
}
public async Task<Post> UpdatePostAsync(int postId, Post post)
{
var url = $"https://jsonplaceholder.typicode.com/posts/{postId}";
Post updatedPost = null;
using (var client = new HttpClient())
{
var serializePost = JsonSerializer.Serialize(post);
var content = new StringContent(serializePost, Encoding.UTF8, "application/json");
var result = await client.PutAsync(url, content);
if (result.IsSuccessStatusCode)
{
var response = await result.Content.ReadAsStringAsync();
updatedPost = JsonSerializer.Deserialize<Post>(response);
}
}
return updatedPost;
}
public async Task DeletePostAsync(int postId)
{
var url = $"https://jsonplaceholder.typicode.com/posts/{postId}";
using (var client = new HttpClient())
{
await client.DeleteAsync(url);
}
}
public async Task<Comment> GetFirstCommentByPostIdAsync(int postId)
{
var url = $"https://jsonplaceholder.typicode.com/posts/{postId}/comments";
List<Comment> _comments = new List<Comment>();
using (var client = new HttpClient())
{
var result = await client.GetAsync(url);
if (result.IsSuccessStatusCode)
{
var content = await result.Content.ReadAsStringAsync();
var deserializedPosts = JsonSerializer.Deserialize<List<Comment>>(content, _options);
_comments = deserializedPosts;
}
}
return _comments[0];
}
}
}
```
* In here, we've implemented `IPostAppService` methods by using [jsonplaceholder](https://jsonplaceholder.typicode.co) API. These endpoints provide us basic crud functionallity.
* After the implemenation, we can start to create the user interface.
#### Blazor UI
* We can create **/Posts** page for listing, updating, deleting and creating our posts. So, create a razor page named `Posts.razor` under **Pages** folder in `*.Blazor` project.
**Posts.razor**
```razor
@page "/Posts"
@using TelerikComponents.Posts
@using IconName = Telerik.Blazor.IconName
@inject IPostAppService PostAppService
<h3>Posts</h3>
<TelerikRootComponent>
<TelerikGrid Data="@GridData"
OnUpdate="@UpdateHandler"
OnDelete="@DeleteHandler"
OnCreate="@CreateHandler"
@ref="@Grid"
Pageable="true"
Groupable="true"
Sortable="true"
FilterMode="GridFilterMode.FilterMenu"
Resizable="true"
Reorderable="true"
EditMode="GridEditMode.Popup"
SelectionMode="GridSelectionMode.Single"
PageSize="5"
Navigable="true">
<GridColumns>
<GridColumn Field="@nameof(Post.Title)"/>
<GridColumn Field="@nameof(Post.Body)"/>
<GridCommandColumn Width="190px">
<GridCommandButton Command="Save" Icon="save" ShowInEdit="true">Update</GridCommandButton>
<GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
<GridCommandButton Command="Delete" Icon="delete" Primary="true">Delete</GridCommandButton>
<GridCommandButton Icon="@IconName.Window" OnClick="(e) => PostDetailAsync(e)">Display Comment</GridCommandButton>
<GridCommandButton Command="Cancel" Icon="cancel" ShowInEdit="true">Cancel</GridCommandButton>
</GridCommandColumn>
</GridColumns>
<GridToolBar>
<GridCommandButton Command="Add" Icon="add">Add Post</GridCommandButton>
</GridToolBar>
</TelerikGrid>
@* Modal *@
<TelerikWindow Class="demo-window" Width="500px" Height="250px" Centered="true" @bind-Visible=@ModalVisible Modal="true">
<WindowTitle>
<strong>Comment</strong>
</WindowTitle>
<WindowActions>
<WindowAction Name="Close" />
</WindowActions>
<WindowContent>
<p><b>Email:</b> @Comment.Email</p>
<p>
<b>Message:</b> @Comment.Body
</p>
</WindowContent>
</TelerikWindow>
</TelerikRootComponent>
```
**Post.razor.cs**
```csharp
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Telerik.Blazor.Components;
using TelerikComponents.Posts;
namespace TelerikComponents.Blazor.Pages
{
public partial class Posts
{
private List<Post> GridData { get; set; }
private TelerikGrid<Post> Grid { get; set; }
private bool ModalVisible { get; set; } = false;
private Comment Comment { get; set; }
public Posts()
{
Comment = new Comment();
}
protected override async Task OnInitializedAsync()
{
await LoadDataAsync();
}
private async Task LoadDataAsync()
{
GridData = await PostAppService.GetPostsAsync();
}
private async Task UpdateHandler(GridCommandEventArgs args)
{
var post = (Post) args.Item;
await PostAppService.UpdatePostAsync(post.Id, post);
var matchingPost = GridData.FirstOrDefault(x => x.Id == post.Id);
if (matchingPost != null)
{
matchingPost.Body = post.Body;
matchingPost.Title = post.Title;
}
}
private async Task DeleteHandler(GridCommandEventArgs args)
{
var post = (Post) args.Item;
GridData.Remove(post);
}
private async Task CreateHandler(GridCommandEventArgs args)
{
var post = (Post) args.Item;
var addedPost = await PostAppService.AddPostAsync(post);
GridData.Insert(0, addedPost);
}
private async Task PostDetailAsync(GridCommandEventArgs args)
{
var post = (Post) args.Item;
Comment = await PostAppService.GetFirstCommentByPostIdAsync(post.Id);
ModalVisible = true;
}
}
}
```
* In here, we've used `TelerikGrid` component.
* The `Telerik Grid` is a powerful component, which allows you to visualize and edit data via its table representation. It provides a variety of options about how to present and perform operations over the underlying data, such as paging, sorting, filtering and editing.
* The Blazor UI Grid allows flexible customization of its items exposing rows, columns and edit templates for this purpose.
### Final Result
* After all of these steps, we can finally run our application.
* Run `*.HttpApi.Host` project for use the required endpoints,
* Run `*.Blazor` project for see the Blazor UI.
* When we navigate to `Posts` route, we should see the following screenshot in this page.
![final-result](./final-result.jpg)
## Conclusion
In this article, I've tried to explain how we can integrate [Telerik Blazor Component](https://www.telerik.com/blazor-ui) to our Blazor UI. ABP Framework designed as modular, so that it can work with any UI library/framework.

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/automated-nuget-feed-setup.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/final-result.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/sample-application.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/telerik-blazor-component-1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
docs/en/Community-Articles/2020-12-10-How-to-Integrate-the-Telerik-Blazor-Component/telerik-progress-bar.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

1581
docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/POST.md

File diff suppressed because it is too large

BIN
docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/author-crud.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

BIN
docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/author-with-books.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

BIN
docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-create.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

BIN
docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-delete.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-edit.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
docs/en/Community-Articles/2020-12-11-Using-Angular-Material-Components-With-ABP-Framework/book-list.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 KiB

6
docs/en/Exception-Handling.md

@ -1,11 +1,11 @@
# Exception Handling
ABP provides a built-in infrastructure and offers a standard model for handling exceptions in a web application.
ABP provides a built-in infrastructure and offers a standard model for handling exceptions.
* Automatically **handles all exceptions** and sends a standard **formatted error message** to the client for an API/AJAX request.
* Automatically hides **internal infrastructure errors** and returns a standard error message.
* Provides a configurable way to **localize** exception messages.
* Automatically maps standard exceptions to **HTTP status codes** and provides a configurable option to map these to custom exceptions.
* Provides an easy and configurable way to **localize** exception messages.
* Automatically maps standard exceptions to **HTTP status codes** and provides a configurable option to map custom exceptions.
## Automatic Exception Handling

392
docs/en/Module-Entity-Extensions.md

@ -1,3 +1,393 @@
# Module Entity Extensions
See https://docs.abp.io/en/commercial/latest/guides/module-entity-extensions (it will be moved here soon).
## Introduction
Module entity extension system is a **high level** extension system that allows you to **define new properties** for existing entities of the depended modules. It automatically **adds properties to the entity, database, HTTP API and the user interface** in a single point.
> The module must be developed the *Module Entity Extensions* system in mind. All the **official modules** supports this system wherever possible.
## Quick Example
Open the *YourProjectNameModuleExtensionConfigurator* class inside the `Domain.Shared` project of your solution and change the `ConfigureExtraProperties`method as shown below to add a `SocialSecurityNumber` property to the `IdentityUser` entity of the [Identity Module](Modules/Identity.md).
````csharp
public static void ConfigureExtraProperties()
{
OneTimeRunner.Run(() =>
{
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<string>( //property type: string
"SocialSecurityNumber", //property name
property =>
{
//validation rules
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(
new StringLengthAttribute(64) {
MinimumLength = 4
}
);
//...other configurations for this property
}
);
});
});
});
}
````
>This method is called inside the `YourProjectNameDomainSharedModule` at the beginning of the application. `OneTimeRunner` is a utility class that guarantees to execute this code only one time per application, since multiple calls are unnecessary.
* `ObjectExtensionManager.Instance.Modules()` is the starting point to configure a module. `ConfigureIdentity(...)` method is used to configure the entities of the Identity Module.
* `identity.ConfigureUser(...)` is used to configure the user entity of the identity module. Not all entities are designed to be extensible (since it is not needed). Use the intellisense to discover the extensible modules and entities.
* `user.AddOrUpdateProperty<string>(...)` is used to add a new property to the user entity with the `string` type (`AddOrUpdateProperty` method can be called multiple times for the same property of the same entity. Each call can configure the options of the same property, but only one property is added to the entity with the same property name). You can call this method with different property names to add more properties.
* `SocialSecurityNumber` is the name of the new property.
* `AddOrUpdateProperty` gets a second argument (the `property =>` lambda expression) to configure additional options for the new property.
* We can add data annotation attributes like shown here, just like adding a data annotation attribute to a class property.
#### Create & Update Forms
Once you define a property, it appears in the create and update forms of the related entity:
![add-new-property-to-user-form](images/add-new-property-to-user-form.png)
`SocialSecurityNumber` field comes into the form. Next sections will explain the localization and the validation for this new property.
### Data Table
New properties also appear in the data table of the related page:
![add-new-property-to-user-form](images/add-new-property-to-user-table.png)
`SocialSecurityNumber` column comes into the table. Next sections will explain the option to hide this column from the data table.
## Property Options
There are some options that you can configure while defining a new property.
### Display Name
You probably want to set a different (human readable) display name for the property that is shown on the user interface.
#### Don't Want to Localize?
If your application is not localized, you can directly set the `DisplayName` for the property to a `FixedLocalizableString` object. Example:
````csharp
property =>
{
property.DisplayName = new FixedLocalizableString("Social security no");
}
````
#### Localizing the Display Name
If you want to localize the display name, you have two options.
##### Localize by Convention
Instead of setting the `property.DisplayName`, you can directly open your localization file (like `en.json`) and add the following entry to the `texts` section:
````json
"SocialSecurityNumber": "Social security no"
````
Define the same `SocialSecurityNumber` key (the property name you've defined before) in your localization file for each language you support. That's all!
In some cases, the localization key may conflict with other keys in your localization files. In such cases, you can use the `DisplayName:` prefix for display names in the localization file (`DisplayName:SocialSecurityNumber` as the localization key for this example). Extension system looks for prefixed version first, then fallbacks to the non prefixed name (it then fallbacks to the property name if you haven't localized it).
> This approach is recommended since it is simple and suitable for most scenarios.
##### Localize using the `DisplayName` Property
If you want to specify the localization key or the localization resource, you can still set the `DisplayName` option:
````csharp
property =>
{
property.DisplayName =
LocalizableString.Create<MyProjectNameResource>(
"UserSocialSecurityNumberDisplayName"
);
}
````
* `MyProjectNameResource` is the localization resource and `UserSocialSecurityNumberDisplayName` is the localization key in the localization resource.
> See [the localization document](Localization.md) if you want to learn more about the localization system.
#### Default Value
A default value is automatically set for the new property, which is the natural default value for the property type, like `null` for `string`, `false` for `bool` or `0` for `int`.
There are two ways to override the default value:
##### DefaultValue Option
`DefaultValue` option can be set to any value:
````csharp
property =>
{
property.DefaultValue = 42;
}
````
##### DefaultValueFactory Options
`DefaultValueFactory` can be set to a function that returns the default value:
````csharp
property =>
{
property.DefaultValueFactory = () => DateTime.Now;
}
````
`options.DefaultValueFactory` has a higher priority than the `options.DefaultValue` .
> Tip: Use `DefaultValueFactory` option only if the default value may change over the time (like `DateTime.Now` in this example). If it is a constant value, then use the `DefaultValue` option.
### Validation
Entity extension system allows you to define validation for extension properties in a few ways.
#### Data Annotation Attributes
`Attributes` is a list of attributes associated to this property. The example code below adds two [data annotation validation attributes](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation) to the property:
````csharp
property =>
{
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});
}
````
When you run the application, you see that the validation works out of the box:
![add-new-propert-to-user-form](images/add-new-property-to-user-form-validation-error.png)
Since we've added the `RequiredAttribute`, it doesn't allow to left it blank. The validation system works;
* On the user interface (with automatic localization).
* On the HTTP API. Even if you directly perform an HTTP request, you get validation errors with a proper HTTP status code.
* On the `SetProperty(...)` method on the entity (see [the document](Entities.md) if you wonder what is the `SetProperty()` method).
So, it automatically makes a full stack validation.
> See the [ASP.NET Core MVC Validation document](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation) to learn more about the attribute based validation.
##### Default Validation Attributes
There are some attributes **automatically added** when you create certain type of properties;
* `RequiredAttribute` is added for **non nullable** primitive property types (e.g. `int`, `bool`, `DateTime`...) and `enum` types. If you want to allow nulls, make the property nullable (e.g. `int?`).
* `EnumDataTypeAttribute` is added for **enum types**, to prevent to set invalid enum values.
Use `property.Attributes.Clear();` if you don't want these attributes.
#### Validation Actions
Validation actions allows you to execute a custom code to perform the validation. The example below checks if the `SocialSecurityNumber` starts with `B` and adds a validation error if so:
````csharp
property =>
{
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});
property.Validators.Add(context =>
{
if (((string) context.Value).StartsWith("B"))
{
context.ValidationErrors.Add(
new ValidationResult(
"Social security number can not start with the letter 'B', sorry!",
new[] {"extraProperties.SocialSecurityNumber"}
)
);
}
});
}
````
Using a `RegularExpressionAttribute` might be better in this case, but this is just an example. Anyway, if you enter a value starts with the letter `B` you get the following error **while saving the form**:
![add-new-propert-to-user-form](images/add-new-property-to-user-form-validation-error-custom.png)
##### The Context Object
The `context` object has useful properties that can be used in your custom validation action. For example, you can use the `context.ServiceProvider` to resolve services from the [dependency injection system](Dependency-Injection.md). The example below gets the localizer and adds a localized error message:
````csharp
if (((string) context.Value).StartsWith("B"))
{
var localizer = context.ServiceProvider
.GetRequiredService<IStringLocalizer<MyProjectNameResource>>();
context.ValidationErrors.Add(
new ValidationResult(
localizer["SocialSecurityNumberCanNotStartWithB"],
new[] {"extraProperties.SocialSecurityNumber"}
)
);
}
````
>`context.ServiceProvider` is nullable! It can be `null` only if you use the `SetProperty(...)` method on the object. Because DI system is not available on this time. While this is a rare case, you should perform a fallback logic when `context.ServiceProvider` is `null`. For this example, you would add a non-localized error message. This is not a problem since setting an invalid value to a property generally is a programmer mistake and you mostly don't need to localization in this case. In any way, you would not be able to use localization even in a regular property setter. But, if you are serious about localization, you can throw a business exception (see the [exception handling document](https://docs.abp.io/en/abp/latest/Exception-Handling) to learn how to localize a business exception).
### UI Visibility
When you define a property, it appears on the data table, create and edit forms on the related UI page. However, you can control each one individually. Example:
````csharp
property =>
{
property.UI.OnTable.IsVisible = false;
//...other configurations
}
````
Use `property.UI.OnCreateForm` and `property.UI.OnEditForm` to control forms too. If a property is required, but not added to the create form, you definitely get a validation exception, so use this option carefully. But a required property may not be in the edit form if that's your requirement.
### HTTP API Availability
Even if you disable a property on UI, it can be still available through the HTTP API. By default, a property is available on all APIs.
Use the `property.Api` options to make a property unavailable in some API endpoints.
````csharp
property =>
{
property.Api.OnUpdate.IsAvailable = false;
}
````
In this example, Update HTTP API will not allow to set a new value to this property. In this case, you also want to disable this property on the edit form:
````csharp
property =>
{
property.Api.OnUpdate.IsAvailable = false;
property.UI.OnEditForm.IsVisible = false;
}
````
In addition to the `property.Api.OnUpdate`, you can set `property.Api.OnCreate` and `property.Api.OnGet` for a fine control the API endpoint.
## Special Types
### Enum
Module extension system naturally supports the `enum` types.
An example enum type:
````csharp
public enum UserType
{
Regular,
Moderator,
SuperUser
}
````
You can add enum properties just like others:
````csharp
user.AddOrUpdateProperty<UserType>("Type");
````
An enum properties is shown as combobox (select) in the create/edit forms:
![add-new-property-enum](images/add-new-property-enum.png)
#### Localization
Enum member name is shown on the table and forms by default. If you want to localize it, just create a new entry on your [localization](https://docs.abp.io/en/abp/latest/Localization) file:
````json
"UserType.SuperUser": "Super user"
````
One of the following names can be used as the localization key:
* `Enum:UserType.SuperUser`
* `UserType.SuperUser`
* `SuperUser`
Localization system searches for the key with the given order. Localized text are used on the table and the create/edit forms.
## Database Mapping
For relational databases, all extension property values are stored in a single field in the table:
![add-new-propert-to-user-database-extra-properties](images/add-new-propert-to-user-database-extra-properties.png)
`ExtraProperties` field stores the properties as a JSON object. While that's fine for some scenarios, you may want to create a dedicated field for your new property. Fortunately, it is very easy to configure.
If you are using the Entity Framework Core database provider, you can configure the database mapping as shown below:
````csharp
ObjectExtensionManager.Instance
.MapEfCoreProperty<IdentityUser, string>(
"SocialSecurityNumber",
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(64);
}
);
````
Write this inside the `YourProjectNameEfCoreEntityExtensionMappings` class in your `.EntityFrameworkCore` project. Then you need to use the standard `Add-Migration` and `Update-Database` commands to create a new database migration and apply the change to your database.
Add-Migration create a new migration as shown below:
````csharp
public partial class Added_SocialSecurityNumber_To_IdentityUser : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SocialSecurityNumber",
table: "AbpUsers",
maxLength: 128,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SocialSecurityNumber",
table: "AbpUsers");
}
}
````
Once you update your database, you will see that the `AbpUsers` table has the new property as a standard table field:
![add-new-propert-to-user-database-extra-properties](images/add-new-propert-to-user-database-field.png)
> If you first created a property without a database table field, then you later needed to move this property to a database table field, it is suggested to execute an SQL command in your migration to copy the old values to the new field.
>
> However, if you don't make it, the ABP Framework seamlessly manages it. It uses the new database field, but fallbacks to the `ExtraProperties` field if it is null. When you save the entity, it moves the value to the new field.
See the [Extending Entities](Customizing-Application-Modules-Extending-Entities.md) document for more.
## More
See the [Customizing the Modules](Customizing-Application-Modules-Guide.md) guide for an overall index for all the extensibility options.
Here, a few things you can do:
* You can create a second entity that maps to the same database table with the extra property as a standard class property (if you've defined the EF Core mapping). For the example above, you can add a `public string SocialSecurityNumber {get; set;}` property to the `AppUser` entity in your application, since the `AppUser` entity is mapped to the same `AbpUser` table. Do this only if you need it, since it brings more complexity to your application.
* You can override a domain or application service to perform custom logics with your new property.
* You can low level control how to add/render a field in the data table on the UI.

2
docs/en/Modules/Identity.md

@ -1,6 +1,6 @@
# Identity Management Module
Identity module is used to manage [organization units](Organization-Units.md), roles, users and their permissions, based on the Microsoft Identity library.
Identity module is used to manage organization units, roles, users and their permissions, based on the Microsoft Identity library.
> **See [the source code](https://github.com/abpframework/abp/tree/dev/modules/identity). Documentation will come soon...**

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

@ -1386,7 +1386,7 @@ Open the `Books.razor` page and add the following `EntityAction` under the "Edit
<EntityAction TItem="BookDto"
Text="@L["Delete"]"
Clicked="() => DeleteEntityAsync(context)"
ConfirmationMessage="@() => GetDeleteConfirmationMessage(context)" />
ConfirmationMessage="() => GetDeleteConfirmationMessage(context)" />
````
* `DeleteEntityAsync` is defined in the base class that deletes the entity by performing a call to the server.
@ -1429,6 +1429,7 @@ Here the complete code to create the book management CRUD page, that has been de
<DataGrid TItem="BookDto"
Data="Entities"
ReadData="OnDataGridReadAsync"
CurrentPage="CurrentPage"
TotalItems="TotalCount"
ShowPager="true"
PageSize="PageSize">

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

@ -53,7 +53,7 @@ This part covers the **server side** tests. There are several test projects in t
Each project is used to test the related project. Test projects use the following libraries for testing:
* [Xunit](https://xunit.github.io/) as the main test framework.
* [Shoudly](http://shouldly.readthedocs.io/en/latest/) as the assertion library.
* [Shoudly](https://github.com/shouldly/shouldly) as the assertion library.
* [NSubstitute](http://nsubstitute.github.io/) as the mocking library.
{{if DB=="EF"}}

6
docs/en/Tutorials/Part-7.md

@ -150,7 +150,7 @@ namespace Acme.BookStore.Authors
}
````
* Inherited from the `EfCoreAuthorRepository`, so it inherits the standard repository method implementations.
* Inherited from the `EfCoreRepository`, so it inherits the standard repository method implementations.
* `WhereIf` is a shortcut extension method of the ABP Framework. It adds the `Where` condition only if the first condition meets (it filters by name, only if the filter was provided). You could do the same yourself, but these type of shortcut methods makes our life easier.
* `sorting` can be a string like `Name`, `Name ASC` or `Name DESC`. It is possible by using the [System.Linq.Dynamic.Core](https://www.nuget.org/packages/System.Linq.Dynamic.Core) NuGet package.
@ -211,7 +211,7 @@ namespace Acme.BookStore.Authors
}
```
* Inherited from the `MongoDbAuthorRepository`, so it inherits the standard repository method implementations.
* Inherited from the `MongoDbRepository`, so it inherits the standard repository method implementations.
* `WhereIf` is a shortcut extension method of the ABP Framework. It adds the `Where` condition only if the first condition meets (it filters by name, only if the filter was provided). You could do the same yourself, but these type of shortcut methods makes our life easier.
* `sorting` can be a string like `Name`, `Name ASC` or `Name DESC`. It is possible by using the [System.Linq.Dynamic.Core](https://www.nuget.org/packages/System.Linq.Dynamic.Core) NuGet package.
@ -221,4 +221,4 @@ namespace Acme.BookStore.Authors
## The Next Part
See the [next part](Part-8.md) of this tutorial.
See the [next part](Part-8.md) of this tutorial.

2
docs/en/Tutorials/Part-9.md

@ -1188,4 +1188,4 @@ That's all! This is a fully working CRUD page, you can create, edit and delete t
## The Next Part
See the [next part](Part-10.md) of this tutorial.
See the [next part](Part-10.md) of this tutorial.

44
docs/en/UI/Angular/List-Service.md

@ -68,6 +68,50 @@ Bind `ListService` to ngx-datatable like this:
</ngx-datatable>
```
## Extending query with custom variables
You can extend the query parameter of the `ListService`'s `hookToQuery` method.
Firstly, you should pass your own type to `ListService` as shown below:
```typescript
constructor(public readonly list: ListService<BooksSearchParamsDto>) { }
```
Then update the `bookStreamCreator` constant like following:
```typescript
const bookStreamCreator = (query) => this.bookService.getList({...query, name: 'name here'});
```
You can also create your params object.
Define a variable like this:
```typescript
booksSearchParams = {} as BooksSearchParamsDto;
```
Update the `bookStreamCreator` constant:
```typescript
const bookStreamCreator = (query) => this.bookService.getList({...query, ...this.booksSearchParams});
```
Then you can place inputs to the HTML:
```html
<div class="form-group">
<input
class="form control"
placeholder="Name"
(keyup.enter)="list.get()"
[(ngModel)]="booksSearchParams.name"
/>
</div>
```
`ListService` emits the hookToQuery stream when you call the `this.list.get()` method.
## Usage with Observables

161
docs/en/UI/AspNetCore/Data-Table-Column-Extensions.md

@ -0,0 +1,161 @@
# Data Table Column Extensions for ASP.NET Core UI
## Introduction
Data table column extension system allows you to add a **new table column** on the user interface. The example below adds a new column with the "Social security no" title:
![user-action-extension-click-me](../../images/table-column-extension-example.png)
You can use the standard column options to fine control the table column.
> Note that this is a low level API to find control the table column. If you want to show an extension property on the table, see the [module entity extension](../../Module-Entity-Extensions.md) document.
## How to Set Up
### Create a JavaScript File
First, add a new JavaScript file to your solution. We added inside the `/Pages/Identity/Users` folder of the `.Web` project:
![user-action-extension-on-solution](../../images/user-action-extension-on-solution.png)
Here, the content of this JavaScript file:
```js
abp.ui.extensions.tableColumns
.get('identity.user')
.addContributor(function (columnList) {
columnList.addTail({ //add as the last column
title: 'Social security no',
data: 'extraProperties.SocialSecurityNumber',
orderable: false,
render: function (data, type, row) {
if (row.extraProperties.SocialSecurityNumber) {
return '<strong>' +
row.extraProperties.SocialSecurityNumber +
'<strong>';
} else {
return '<i class="text-muted">undefined</i>';
}
}
});
});
```
This example defines a custom `render` function to return a custom HTML to render in the column.
### Add the File to the User Management Page
Then you need to add this JavaScript file to the user management page. You can take the power of the [Bundling & Minification system](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Bundling-Minification).
Write the following code inside the `ConfigureServices` of your module class:
```csharp
Configure<AbpBundlingOptions>(options =>
{
options.ScriptBundles.Configure(
typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.IndexModel).FullName,
bundleConfiguration =>
{
bundleConfiguration.AddFiles(
"/Pages/Identity/Users/my-user-extensions.js"
);
});
});
```
This configuration adds `my-user-extensions.js` to the user management page of the Identity Module. `typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.IndexModel).FullName` is the name of the bundle in the user management page. This is a common convention used for all the ABP Commercial modules.
### Rendering the Column
This example assumes that you've defined a `SocialSecurityNumber` extra property using the [module entity extension](../../Module-Entity-Extensions.md) system. However;
* You can add a new column that is related to an existing property of the user (that was not added to the table by default). Example:
````js
abp.ui.extensions.tableColumns
.get('identity.user')
.addContributor(function (columnList) {
columnList.addTail({
title: 'Phone confirmed?',
data: 'phoneNumberConfirmed',
render: function (data, type, row) {
if (row.phoneNumberConfirmed) {
return '<strong style="color: green">YES<strong>';
} else {
return '<i class="text-muted">NO</i>';
}
}
});
});
````
* You can add a new custom column that is not related to any entity property, but a completely custom information. Example:
````js
abp.ui.extensions.tableColumns
.get('identity.user')
.addContributor(function (columnList) {
columnList.addTail({
title: 'Custom column',
data: {},
orderable: false,
render: function (data) {
if (data.phoneNumber) {
return "call: " + data.phoneNumber;
} else {
return '';
}
}
});
});
````
## API
This section explains details of the `abp.ui.extensions.tableColumns` JavaScript API.
### abp.ui.extensions.tableColumns.get(entityName)
This method is used to access the table columns for an entity of a specific module. It takes one parameter:
* **entityName**: The name of the entity defined by the related module.
### abp.ui.extensions.tableColumns.get(entityName).columns
The `columns` property is used to retrieve a [doubly linked list](../Common/Utils/Linked-List.md) of previously defined columns for a table. All contributors are executed in order to prepare the final column list. This is normally called by the modules to show the columns in the table. However, you can use it if you are building your own extensible UIs.
### abp.ui.extensions.tableColumns.get(entityName).addContributor(contributeCallback [, order])
The `addContributor` method covers all scenarios, e.g. you want to add your column in a different position in the list, change or remove an existing column. `addContributor` has the following parameters:
* **contributeCallback**: A callback function that is called whenever the column list should be created. You can freely modify the column list inside this callback method.
* **order** (optional): The order of the callback in the callback list. Your callback is added to the end of the list (so, you have opportunity to modify columns added by the previous contributors). You can set it `0` to add your contributor as the first item.
#### Example
```js
var myColumnDefinition = {
title: 'Custom column',
data: {},
orderable: false,
render: function(data) {
if (data.phoneNumber) {
return "call: " + data.phoneNumber;
} else {
return '';
}
}
};
abp.ui.extensions.tableColumns
.get('identity.user')
.addContributor(function (columnList) {
// Remove an item from actionList
columnList.dropHead();
// Add a new item to the actionList
columnList.addHead(myColumnDefinition);
});
```
> `columnList` is [linked list](../Common/Utils/Linked-List.md). You can use its methods to build a list of columns however you need.

28
docs/en/UI/AspNetCore/Data-Tables.md

@ -105,6 +105,32 @@ The `abp.libs.datatables.createAjax` method (used in the example above) adapts r
This works automatically, so most of the times you don't need to know how it works. See the [DTO document](../../Data-Transfer-Objects.md) if you want to learn more about `IPagedAndSortedResultRequest`, `IPagedResult` and other standard interfaces and base DTO classes those are used in client to server communication.
The `createAjax` also supports you to customize request parameters and handle the responses.
**Example:**
````csharp
var inputAction = function () {
return {
id: $('#Id').val(),
name: $('#Name').val(),
};
};
var responseCallback = function(result) {
// your custom code.
return {
recordsTotal: result.totalCount,
recordsFiltered: result.totalCount,
data: result.items
};
};
ajax: abp.libs.datatables.createAjax(acme.bookStore.books.book.getList, inputAction, responseCallback)
````
### Row Actions
`rowAction` is an option defined by the ABP Framework to the column definitions to show a drop down button to take actions for a row in the table.
@ -260,4 +286,4 @@ Assuming that the possible values for a column data is `f` and `m`, the `gender`
## Other Data Grids
You can use any library you like. For example, [see this article](https://community.abp.io/articles/using-devextreme-components-with-the-abp-framework-zb8z7yqv) to learn how to use DevExtreme Data Grid in your applications.
You can use any library you like. For example, [see this article](https://community.abp.io/articles/using-devextreme-components-with-the-abp-framework-zb8z7yqv) to learn how to use DevExtreme Data Grid in your applications.

108
docs/en/UI/AspNetCore/Entity-Action-Extensions.md

@ -0,0 +1,108 @@
# Entity Action Extensions for ASP.NET Core UI
## Introduction
Entity action extension system allows you to add a **new action** to the action menu for an entity. A **Click Me** action was added to the *User Management* page below:
![user-action-extension-click-me](../../images/user-action-extension-click-me.png)
You can take any action (open a modal, make an HTTP API call, redirect to another page... etc) by writing your custom code. You can access to the current entity in your code.
## How to Set Up
In this example, we will add a "Click Me!" action and execute a JavaScript code for the user management page of the [Identity Module](../../Modules/Identity.md).
### Create a JavaScript File
First, add a new JavaScript file to your solution. We added inside the `/Pages/Identity/Users` folder of the `.Web` project:
![user-action-extension-on-solution](../../images/user-action-extension-on-solution.png)
Here, the content of this JavaScript file:
```js
var clickMeAction = {
text: 'Click Me!',
action: function(data) {
//TODO: Write your custom code
alert(data.record.userName);
}
};
abp.ui.extensions.entityActions
.get('identity.user')
.addContributor(function(actionList) {
actionList.addTail(clickMeAction);
});
```
In the `action` function, you can do anything you need. See the API section for a detailed usage.
### Add the File to the User Management Page
Then you need to add this JavaScript file to the user management page. You can take the power of the [Bundling & Minification System](Bundling-Minification.md).
Write the following code inside the `ConfigureServices` of your module class:
```csharp
Configure<AbpBundlingOptions>(options =>
{
options.ScriptBundles.Configure(
typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.IndexModel).FullName,
bundleConfiguration =>
{
bundleConfiguration.AddFiles(
"/Pages/Identity/Users/my-user-extensions.js"
);
});
});
```
This configuration adds `my-user-extensions.js` to the user management page of the Identity Module. `typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.IndexModel).FullName` is the name of the bundle in the user management page. This is a common convention used for all the ABP Commercial modules.
That's all. Run your application to see the result.
## API
This section explains details of the `abp.ui.extensions.entityActions` JavaScript API.
### abp.ui.extensions.entityActions.get(entityName)
This method is used to access the entity actions of a specific module. It takes one parameter:
* **entityName**: The name of the entity defined by the related module.
### abp.ui.extensions.entityActions.get(entityName).actions
The `actions` property is used to retrieve a [doubly linked list](../Common/Utils/Linked-List.md) of previously defined actions for an entity. All contributors are executed in order to prepare the final actions list. This is normally called by the modules to show the actions in the grid. However, you can use it if you are building your own extensible UIs.
### abp.ui.extensions.entityActions.get(entityName).addContributor(contributeCallback)
The `addContributor` method covers all scenarios, e.g. you want to add your action in a different position in the list, change or remove an existing action item. `addContributor` with the following parameter:
* **contributeCallback**: A callback function that is called whenever the action list should be created. You can freely modify the action list inside this callback method.
#### Example
```js
var clickMe2Action = {
text: 'Click Me 2!',
icon: 'fas fa-hand-point-right',
action: function(data) {
//TODO: Write your custom code
alert(data.record.userName);
}
};
abp.ui.extensions.entityActions
.get('identity.user')
.addContributor(function(actionList) {
// Remove an item from actionList
actionList.dropHead();
// Add the new item to the actionList
actionList.addHead(clickMe2Action);
});
```
> `actionList` is [linked list](../Common/Utils/Linked-List.md). You can use its methods to build a list of columns however you need.

2
docs/en/UI/AspNetCore/Theming.md

@ -32,7 +32,7 @@ All the themes must depend on the [@abp/aspnetcore.mvc.ui.theme.shared](https://
* [Twitter Bootstrap](https://getbootstrap.com/) as the fundamental HTML/CSS framework.
* [JQuery](https://jquery.com/) for DOM manipulation.
* [DataTables.Net](https://datatables.net/) for data grids.
* [JQuery Validation](https://jqueryvalidation.org/) for client side & [unobtrusive](https://github.com/aspnet/jquery-validation-unobtrusive) validation
* [JQuery Validation](https://github.com/jquery-validation/jquery-validation) for client side & [unobtrusive](https://github.com/aspnet/jquery-validation-unobtrusive) validation
* [FontAwesome](https://fontawesome.com/) as the fundamental CSS font library.
* [SweetAlert](https://sweetalert.js.org/) to show fancy alert message and confirmation dialogs.
* [Toastr](https://github.com/CodeSeven/toastr) to show toast notifications.

10
docs/en/UI/Blazor/Authentication.md

@ -1,3 +1,11 @@
# Blazor UI: Authentication
TODO
The [application startup template](../../Startup-Templates/Application.md) is properly configured to use OpenId Connect to authenticate the user through the server side login form;
* When the Blazor application needs to authenticate, it is redirected to the server side.
* Users can enter username & password to login if they already have an account. If not, they can use the register form to create a new user. They can also use forgot password and other features. The server side uses IdentityServer4 to handle the authentication.
* Finally, they are redirected back to the Blazor application to complete the login process.
This is a typical and recommended approach to implement authentication in Single-Page Applications. The client side configuration is done in the startup template, so you can change it.
See the [Blazor Security document](https://docs.microsoft.com/en-us/aspnet/core/blazor/security) to understand and customize the authentication process.

75
docs/en/UI/Blazor/Authorization.md

@ -0,0 +1,75 @@
# Blazor UI: Authorization
Blazor applications can use the same authorization system and permissions defined in the server side.
> This document is only for authorizing on the Blazor UI. See the [Server Side Authorization](../../Authorization.md) to learn how to define permissions and control the authorization system.
## Basic Usage
> ABP Framework is **100% compatible** with the Authorization infrastructure provided by the Blazor. See the [Blazor Security Document](https://docs.microsoft.com/en-us/aspnet/core/blazor/security/) to learn all authorization options. This section **only shows some common scenarios**.
### Authorize Attribute
`[Authorize]` attribute can be used to show a page only to the authenticated users.
````csharp
@page "/"
@attribute [Authorize]
You can only see this if you're signed in.
````
The `[Authorize]` attribute also supports role-based or policy-based authorization. For example, you can check permissions defined in the server side:
````csharp
@page "/"
@attribute [Authorize("MyPermission")]
You can only see this if you have the necessary permission.
````
### AuthorizeView
`AuthorizeView` component can be used in a page/component to conditionally render a part of the content:
````html
<AuthorizeView Policy="MyPermission">
<p>You can only see this if you satisfy the "MyPermission" policy.</p>
</AuthorizeView>
````
### IAuthorizationService
`IAuthorizationService` can be injected and used to programmatically check permissions:
````csharp
public partial class Index
{
protected override async Task OnInitializedAsync()
{
if (await AuthorizationService.IsGrantedAsync("MyPermission"))
{
//...
}
}
}
````
If your component directly or indirectly inherits from the `AbpComponentBase`, `AuthorizationService` becomes pre-injected and ready to use. If not, you can always [inject](../../Dependency-Injection.md) the `IAuthorizationService` yourself.
`IAuthorizationService` can also be used in the view side where `AuthorizeView` component is not enough.
There are some useful extension methods for the `IAuthorizationService`:
* `IsGrantedAsync` simply returns `true` or `false` for the given policy/permission.
* `CheckAsync` checks and throws `AbpAuthorizationException` if given policy/permission hasn't granted. You don't have to handle these kind of exceptions since ABP Framework automatically [handles errors](Error-Handling.md).
* `AuthorizeAsync` returns `AuthorizationResult` as the standard way provided by the ASP.NET Core authorization system.
> See the [Blazor Security Document](https://docs.microsoft.com/en-us/aspnet/core/blazor/security/) to learn all authorization options
## See Also
* [Authorization](../../Authorization.md) (server side)
* [Blazor Security](https://docs.microsoft.com/en-us/aspnet/core/blazor/security/) (Microsoft documentation)
* [ICurrentUser Service](CurrentUser.md)

23
docs/en/UI/Blazor/CurrentTenant.md

@ -0,0 +1,23 @@
# Blazor UI: Current Tenant
`ICurrentTenant` service can be used to get information about the current tenant in a [multi-tenant](../../Multi-Tenancy.md) application. `ICurrentTenant` defines the following properties;
* `Id` (`Guid`): Id of the current tenant. Can be `null` if the current user is a host user or the tenant could not be determined.
* `Name` (`string`): Name of the current tenant. Can be `null` if the current user is a host user or the tenant could not be determined.
* `IsAvailable` (`bool`): Returns `true` if the `Id` is not `null`.
**Example: Show the current tenant name on a page**
````csharp
@page "/"
@using Volo.Abp.MultiTenancy
@inject ICurrentTenant CurrentTenant
@if (CurrentTenant.IsAvailable)
{
<p>Current tenant name: @CurrentTenant.Name</p>
}
````
## See Also
* [Multi-Tenancy](../../Multi-Tenancy.md)

22
docs/en/UI/Blazor/CurrentUser.md

@ -0,0 +1,22 @@
# Blazor UI: Current User
`ICurrentUser` service is used to obtain information about the currently authenticated user. Inject the `ICurrentUser` into any component/page and use its properties and methods.
**Example: Show username & email on a page**
````csharp
@page "/"
@using Volo.Abp.Users
@inject ICurrentUser CurrentUser
@if (CurrentUser.IsAuthenticated)
{
<p>Welcome @CurrentUser.UserName</p>
}
````
> If you (directly or indirectly) derived your component from the `AbpComponentBase`, you can directly use the base `CurrentUser` property.
`ICurrentUser` provides `Id`, `Name`, `SurName`, `Email`, `Roles` and some other properties.
> See the [Server Side Current User](../../CurrentUser) service for more information.

62
docs/en/UI/Blazor/Error-Handling.md

@ -0,0 +1,62 @@
# Blazor UI: Error Handling
Blazor, by default, shows a yellow line at the bottom of the page if any unhandled exception occurs. However, this is not useful in a real application.
ABP provides an automatic error handling system for the Blazor UI.
* Handles all unhandled exceptions and shows nice and useful messages to the user.
* It distinguishes different kind of exceptions. Hides internal/technical error details from the user (shows a generic error message in these cases).
* It is well integrated to the [server side exception handling](../../Exception-Handling.md) system.
## Basic Usage
There are different type of `Exception` classes handled differently by the ABP Framework.
### UserFriendlyException
`UserFriendlyException` is a special type of exception. You can directly show a error message dialog to the user by throwing such an exception.
**Example**
````csharp
@page "/"
@using Volo.Abp
<Button Clicked="TestException">Throw test exception</Button>
@code
{
private void TestException()
{
throw new UserFriendlyException("A user friendly error message!");
}
}
````
ABP automatically handle the exception and show an error message to the user:
![blazor-user-friendly-exception](../../images/blazor-user-friendly-exception.png)
> You can derive from `UserFriendlyException` or directly implement `IUserFriendlyException` interface to create your own `Exception` class if you need.
> You can use the [localization system](Localization.md) to show localized error messages.
### BusinessException and Other Exception Types
See the [exception handling document](../../Exception-Handling.md) to understand different kind of Exception class and interfaces and other capabilities of the Exception Handling system.
## Generic Errors
If the thrown `Exception` is not a special type, it is considered as generic error and a generic error message is shown to the user:
![blazor-generic-exception-message](../../images/blazor-generic-exception-message.png)
> All error details (including stack trace) are still written in the browser's console.
## Server Side Errors
Errors (like Validation, Authorization and User Friendly Errors) sent by the server are processed as you expect and properly shown to the user. So, error handling system works end to end without need to manually handle exceptions or manually transfer server-to-client error messages.
## See Also
* [Exception Handling System](../../Exception-Handling.md)

6
docs/en/UI/Blazor/Overall.md

@ -150,6 +150,12 @@ ABP makes this possible by auto registering components to and resolving the comp
Resolving a component from the Dependency Injection system makes it possible to easily replace components of a depended module.
## Error Handling
Blazor, by default, shows a yellow line at the bottom of the page if any unhandled exception occurs. However, this is not useful in a real application.
ABP provides an [automatic error handling system](Error-Handling.md) for the Blazor UI.
## Customization
While the theme and some modules come as NuGet packages, you can still replace/override and customize them on need. See the [Customization / Overriding Components](Customization-Overriding-Components.md) document.

3
docs/en/UI/Blazor/Page-Header.md

@ -0,0 +1,3 @@
# Blazor UI: Page Header
TODO

24
docs/en/UI/Blazor/Routing.md

@ -0,0 +1,24 @@
# Blazor UI: Routing
Blazor has its own [routing system](https://docs.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing) and you can use it in your applications. ABP doesn't add any new feature to it, except one small improvement for the [modular development](../../Module-Development-Basics.md).
## AbpRouterOptions
Blazor `Router` component requires to define `AdditionalAssemblies` when you have components in assemblies/projects other than the main application's entrance assembly. So, if you want to create razor class libraries as ABP modules, you typically want to add the module's assembly to the `AdditionalAssemblies`. In this case, you need to add your module's assembly to the `AbpRouterOptions`.
**Example**
````csharp
Configure<AbpRouterOptions>(options =>
{
options.AdditionalAssemblies.Add(typeof(MyBlazorModule).Assembly);
});
````
Write this code in the `ConfigureServices` method of your [module](../../Module-Development-Basics.md).
`AbpRouterOptions` has another property, `AppAssembly`, which should be the entrance assembly of the application and typically set in the final application's module. If you've created your solution with the [application startup template](../../Startup-Templates/Application.md), it is already configured for you.
## See Also
* [Blazor Routing](https://docs.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing) (Microsoft Documentation)

3
docs/en/UI/Blazor/Testing.md

@ -0,0 +1,3 @@
# Blazor: Testing
Coming soon.

79
docs/en/docs-nav.json

@ -634,39 +634,76 @@
"text": "Localization",
"path": "UI/Blazor/Localization.md"
},
{
"text": "Settings",
"path": "UI/Blazor/Settings.md"
},
{
"text": "Notification",
"path": "UI/Blazor/Notification.md"
},
{
"text": "Message",
"path": "UI/Blazor/Message.md"
},
{
"text": "Theming",
"path": "UI/Blazor/Theming.md",
"items": [
{
"text": "Overall",
"path": "UI/Blazor/Theming.md"
},
{
"text": "The Basic Theme",
"path": "UI/Blazor/Basic-Theme.md"
},
{
"text": "Branding",
"path": "UI/Blazor/Branding.md"
},
{
"text": "Page Header",
"path": "UI/Blazor/Page-Header.md"
},
{
"text": "Toolbars",
"path": "UI/Blazor/Toolbars.md"
}
]
},
{
"text": "Toolbars",
"path": "UI/Blazor/Toolbars.md"
"text": "Security",
"items": [
{
"text": "Authentication",
"path": "UI/Blazor/Authentication.md"
},
{
"text": "Authorization",
"path": "UI/Blazor/Authorization.md"
}
]
},
{
"text": "Page Alerts",
"path": "UI/Blazor/Page-Alerts.md"
"text": "Services",
"items": [
{
"text": "Current User",
"path": "UI/Blazor/CurrentUser.md"
},
{
"text": "Current Tenant",
"path": "UI/Blazor/CurrentTenant.md"
},
{
"text": "Notification",
"path": "UI/Blazor/Notification.md"
},
{
"text": "Message",
"path": "UI/Blazor/Message.md"
},
{
"text": "Page Alerts",
"path": "UI/Blazor/Page-Alerts.md"
}
]
},
{
"text": "Branding",
"path": "UI/Blazor/Branding.md"
"text": "Settings",
"path": "UI/Blazor/Settings.md"
},
{
"text": "Error Handling",
"path": "UI/Blazor/Error-Handling.md"
},
{
"text": "Customization / Overriding Components",
@ -677,8 +714,8 @@
"path": "UI/Blazor/Global-Scripts-Styles.md"
},
{
"text": "Authentication",
"path": "UI/Blazor/Authentication.md"
"text": "Routing",
"path": "UI/Blazor/Routing.md"
}
]
},

BIN
docs/en/images/add-new-propert-to-user-database-extra-properties.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
docs/en/images/add-new-propert-to-user-database-field.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
docs/en/images/add-new-property-enum.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
docs/en/images/add-new-property-to-user-form-validation-error-custom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
docs/en/images/add-new-property-to-user-form-validation-error.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
docs/en/images/add-new-property-to-user-form.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
docs/en/images/add-new-property-to-user-table.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
docs/en/images/blazor-generic-exception-message.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
docs/en/images/blazor-user-friendly-exception.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
docs/en/images/table-column-extension-example.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
docs/en/images/user-action-extension-click-me.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
docs/en/images/user-action-extension-on-solution.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

1
docs/zh-Hans/CLI.md

@ -126,6 +126,7 @@ abp update [options]
* `--solution-path``-sp`: 指定解决方案路径/目录. 默认使用当前目录
* `--solution-name``-sn`: 指定解决方案名称. 默认在目录中搜索`*.sln`文件.
* `--check-all`: 分别检查每个包的新版本. 默认是 `false`.
* `--version` or `-v`: 指定用于升级的版本. 如果没有指定,则使用最新版本.
### add-package

2
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/Branding.razor

@ -1,3 +1,3 @@
@using Volo.Abp.Ui.Branding
@inject IBrandingProvider BrandingProvider
<a class="navbar-brand" href="/">@BrandingProvider.AppName</a>
<a class="navbar-brand" href="">@BrandingProvider.AppName</a>

41
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs

@ -3,6 +3,8 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using Microsoft.JSInterop;
using Volo.Abp.DependencyInjection;
@ -12,14 +14,28 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
private readonly IJSRuntime _jsRuntime;
public AbpBlazorClientHttpMessageHandler(IJSRuntime jsRuntime)
private readonly ICookieService _cookieService;
private readonly NavigationManager _navigationManager;
private const string AntiForgeryCookieName = "XSRF-TOKEN";
private const string AntiForgeryHeaderName = "RequestVerificationToken";
public AbpBlazorClientHttpMessageHandler(
IJSRuntime jsRuntime,
ICookieService cookieService,
NavigationManager navigationManager)
{
_jsRuntime = jsRuntime;
_cookieService = cookieService;
_navigationManager = navigationManager;
}
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
await SetLanguageAsync(request, cancellationToken);
await SetAntiForgeryTokenAsync(request);
return await base.SendAsync(request, cancellationToken);
}
@ -38,5 +54,28 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
request.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(selectedLanguage));
}
}
private async Task SetAntiForgeryTokenAsync(HttpRequestMessage request)
{
if (request.Method == HttpMethod.Get || request.Method == HttpMethod.Head ||
request.Method == HttpMethod.Trace || request.Method == HttpMethod.Options)
{
return;
}
var selfUri = new Uri(_navigationManager.Uri);
if (request.RequestUri.Host != selfUri.Host || request.RequestUri.Port != selfUri.Port)
{
return;
}
var token = await _cookieService.GetAsync(AntiForgeryCookieName);
if (!token.IsNullOrWhiteSpace())
{
request.Headers.Add(AntiForgeryHeaderName, token);
}
}
}
}

11
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs

@ -86,12 +86,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{
selectTagHelper.Items = GetSelectItems(context, output);
}
else
else if(!TagHelper.AutocompleteSelectedItemName.IsNullOrEmpty())
{
selectTagHelper.Items = new SelectListItem[]
{
new SelectListItem(TagHelper.AutocompleteSelectedItemName,TagHelper.AutocompleteSelectedItemValue,true)
};
selectTagHelper.Items = new[]
{
new SelectListItem(TagHelper.AutocompleteSelectedItemName,
TagHelper.AutocompleteSelectedItemValue, false)
};
}
var selectTagHelperOutput = await selectTagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "select", TagMode.StartTagAndEndTag);

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/tenant-switch.js

@ -9,7 +9,7 @@
});
tenantSwitchModal.onResult(function() {
location.reload();
location.assign(location.href);
});
});

11
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/CmsKit/CmsKitScriptContributor.cs

@ -0,0 +1,11 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.StarRatingSvg;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.CmsKit
{
[DependsOn(typeof(StarRatingSvgScriptContributor))]
public class CmsKitScriptContributor : BundleContributor
{
}
}

11
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/CmsKit/CmsKitStyleContributor.cs

@ -0,0 +1,11 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.StarRatingSvg;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.CmsKit
{
[DependsOn(typeof(StarRatingSvgStyleContributor))]
public class CmsKitStyleContributor : BundleContributor
{
}
}

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js

@ -325,7 +325,14 @@
* AJAX extension for datatables *
*************************************************************************/
(function () {
datatables.createAjax = function (serverMethod, inputAction) {
datatables.createAjax = function (serverMethod, inputAction, responseCallback) {
responseCallback = responseCallback || function(result) {
return {
recordsTotal: result.totalCount,
recordsFiltered: result.totalCount,
data: result.items
};
}
return function (requestData, callback, settings) {
var input = inputAction ? inputAction(requestData, settings) : {};
@ -359,11 +366,7 @@
if (callback) {
serverMethod(input).then(function (result) {
callback({
recordsTotal: result.totalCount,
recordsFiltered: result.totalCount,
data: result.items
});
callback(responseCallback(result));
});
}
};

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUglify" Version="1.6.3" />
<PackageReference Include="NUglify" Version="1.11.4" />
</ItemGroup>
<ItemGroup>

1
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/StandardLayouts.cs

@ -4,6 +4,7 @@
{
public const string Application = "Application";
public const string Account = "Account";
public const string Public = "Public";
public const string Empty = "Empty";
}
}

7
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/ThemeExtensions.cs

@ -12,9 +12,14 @@
return theme.GetLayout(StandardLayouts.Account, fallbackToDefault);
}
public static string GetPublicLayout(this ITheme theme, bool fallbackToDefault = true)
{
return theme.GetLayout(StandardLayouts.Public, fallbackToDefault);
}
public static string GetEmptyLayout(this ITheme theme, bool fallbackToDefault = true)
{
return theme.GetLayout(StandardLayouts.Empty, fallbackToDefault);
}
}
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj

@ -29,7 +29,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.2.0" />
</ItemGroup>
</Project>

3
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpExtraPropertiesDictionaryModelBinderProvider.cs

@ -23,7 +23,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding
return null;
}
if (!context.Metadata.ContainerType.IsAssignableTo<IHasExtraProperties>())
if (context.Metadata.ContainerType == null ||
!context.Metadata.ContainerType.IsAssignableTo<IHasExtraProperties>())
{
return null;
}

19
framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs

@ -95,7 +95,8 @@ namespace Microsoft.AspNetCore.Authorization
{
if (!await authorizationService.IsGrantedAsync(policyName))
{
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted: " + policyName);
throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedWithPolicyName)
.WithData("PolicyName", policyName);
}
}
@ -103,7 +104,8 @@ namespace Microsoft.AspNetCore.Authorization
{
if (!await authorizationService.IsGrantedAsync(resource, requirement))
{
throw new AbpAuthorizationException("Authorization failed! Given requirement has not granted for given resource: " + resource);
throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenRequirementHasNotGrantedForGivenResource)
.WithData("ResourceName", resource);
}
}
@ -111,7 +113,8 @@ namespace Microsoft.AspNetCore.Authorization
{
if (!await authorizationService.IsGrantedAsync(resource, policy))
{
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted for given resource: " + resource);
throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedForGivenResource)
.WithData("ResourceName", resource);
}
}
@ -119,7 +122,7 @@ namespace Microsoft.AspNetCore.Authorization
{
if (!await authorizationService.IsGrantedAsync(policy))
{
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted.");
throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGranted);
}
}
@ -127,7 +130,8 @@ namespace Microsoft.AspNetCore.Authorization
{
if (!await authorizationService.IsGrantedAsync(resource, requirements))
{
throw new AbpAuthorizationException("Authorization failed! Given requirements have not granted for given resource: " + resource);
throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenRequirementsHasNotGrantedForGivenResource)
.WithData("ResourceName", resource);
}
}
@ -135,7 +139,8 @@ namespace Microsoft.AspNetCore.Authorization
{
if (!await authorizationService.IsGrantedAsync(resource, policyName))
{
throw new AbpAuthorizationException("Authorization failed! Given polist has not granted for given resource: " + resource);
throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedForGivenResource)
.WithData("ResourceName", resource);
}
}
@ -149,4 +154,4 @@ namespace Microsoft.AspNetCore.Authorization
return abpAuthorizationService;
}
}
}
}

7
framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj

@ -19,7 +19,12 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Localization.Abstractions\Volo.Abp.Localization.Abstractions.csproj" />
<None Remove="Volo\Abp\Authorization\Localization\*.json" />
<EmbeddedResource Include="Volo\Abp\Authorization\Localization\*.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy\Volo.Abp.MultiTenancy.csproj" />
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
</ItemGroup>

15
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationErrorCodes.cs

@ -0,0 +1,15 @@
namespace Volo.Abp.Authorization
{
public static class AbpAuthorizationErrorCodes
{
public const string GivenPolicyHasNotGranted = "Volo.Authorization:010001";
public const string GivenPolicyHasNotGrantedWithPolicyName = "Volo.Authorization:010002";
public const string GivenPolicyHasNotGrantedForGivenResource = "Volo.Authorization:010003";
public const string GivenRequirementHasNotGrantedForGivenResource = "Volo.Authorization:010004";
public const string GivenRequirementsHasNotGrantedForGivenResource = "Volo.Authorization:010005";
}
}

22
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs

@ -3,17 +3,20 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.Authorization.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.Authorization
{
[DependsOn(
typeof(AbpSecurityModule),
typeof(AbpLocalizationAbstractionsModule),
typeof(AbpLocalizationModule),
typeof(AbpMultiTenancyModule)
)]
public class AbpAuthorizationModule : AbpModule
@ -38,6 +41,23 @@ namespace Volo.Abp.Authorization
options.ValueProviders.Add<RolePermissionValueProvider>();
options.ValueProviders.Add<ClientPermissionValueProvider>();
});
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpAuthorizationResource>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<AbpAuthorizationResource>("en")
.AddVirtualJson("/Volo/Abp/Authorization/Localization");
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
options.MapCodeNamespace("Volo.Authorization", typeof(AbpAuthorizationResource));
});
}
private static void AutoAddDefinitionProviders(IServiceCollection services)

10
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/AbpAuthorizationResource.cs

@ -0,0 +1,10 @@
using Volo.Abp.Localization;
namespace Volo.Abp.Authorization.Localization
{
[LocalizationResourceName("AbpAuthorization")]
public class AbpAuthorizationResource
{
}
}

10
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/en.json

@ -0,0 +1,10 @@
{
"culture": "en",
"texts": {
"Volo.Authorization:010001": "Authorization failed! Given policy has not granted.",
"Volo.Authorization:010002": "Authorization failed! Given policy has not granted: {PolicyName}",
"Volo.Authorization:010003": "Authorization failed! Given policy has not granted for given resource: {ResourceName}",
"Volo.Authorization:010004": "Authorization failed! Given requirement has not granted for given resource: {ResourceName}",
"Volo.Authorization:010005": "Authorization failed! Given requirements has not granted for given resource: {ResourceName}"
}
}

10
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/tr.json

@ -0,0 +1,10 @@
{
"culture": "tr",
"texts": {
"Volo.Authorization:010001": "Yetkilendirme başarısız! Belirtilen izin sağlanmamış.",
"Volo.Authorization:010002": "Yetkilendirme başarısız! Bu izin sağlanmamış: {PolicyName}",
"Volo.Authorization:010003": "Yetkilendirme başarısız! Bu izin, bu kaynak için sağlanmamış: {ResourceName}",
"Volo.Authorization:010004": "Yetkilendirme başarısız! Bu kaynak belirtilen gerekliliği sağlamamış: {ResourceName}",
"Volo.Authorization:010005": "Yetkilendirme başarısız! Bu kaynak belirtilen gereklilikleri sağlamamış: {ResourceName}"
}
}

10
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/zh-Hans.json

@ -0,0 +1,10 @@
{
"culture": "zh-Hans",
"texts": {
"Volo.Authorization:010001": "授权失败! 提供的策略尚未授予.",
"Volo.Authorization:010002": "授权失败! 提供的策略尚未授予: {PolicyName}",
"Volo.Authorization:010003": "授权失败! 提供的策略未授予提供的资源: {ResourceName}",
"Volo.Authorization:010004": "授权失败! 提供的要求未授予提供的资源: {ResourceName}",
"Volo.Authorization:010005": "授权失败! 提供的要求未授予提供的资源: {ResourceName}"
}
}

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

@ -21,7 +21,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.0.0" />
<PackageReference Include="AutoMapper" Version="10.1.1" />
</ItemGroup>
</Project>

3
framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs

@ -27,6 +27,7 @@ using System;
using System.Reflection;
using Autofac.Builder;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
namespace Autofac.Extensions.DependencyInjection
@ -116,6 +117,7 @@ namespace Autofac.Extensions.DependencyInjection
.RegisterGeneric(service.ImplementationType)
.As(service.ServiceType)
.ConfigureLifecycle(service.Lifetime)
.FindConstructorsWith(new AbpAutofacConstructorFinder())
.ConfigureAbpConventions(moduleContainer, registrationActionList);
}
else
@ -124,6 +126,7 @@ namespace Autofac.Extensions.DependencyInjection
.RegisterType(service.ImplementationType)
.As(service.ServiceType)
.ConfigureLifecycle(service.Lifetime)
.FindConstructorsWith(new AbpAutofacConstructorFinder())
.ConfigureAbpConventions(moduleContainer, registrationActionList);
}
}

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

@ -15,8 +15,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="5.0.0" />
<PackageReference Include="Autofac" Version="5.2.0" />
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
<PackageReference Include="Autofac" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

43
framework/src/Volo.Abp.Autofac/Volo/Abp/Autofac/AbpAutofacConstructorFinder.cs

@ -0,0 +1,43 @@
using System;
using System.Collections.Concurrent;
using System.Reflection;
using Autofac.Core.Activators.Reflection;
namespace Volo.Abp.Autofac
{
public class AbpAutofacConstructorFinder : IConstructorFinder
{
private const BindingFlags DeclaredOnlyPublicFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly; //Remove static constructor, BindingFlags.Static
private readonly Func<Type, ConstructorInfo[]> _finder;
private static readonly ConcurrentDictionary<Type, ConstructorInfo[]> DefaultPublicConstructorsCache = new ConcurrentDictionary<Type, ConstructorInfo[]>();
public AbpAutofacConstructorFinder()
: this(GetDefaultPublicConstructors)
{
}
public AbpAutofacConstructorFinder(Func<Type, ConstructorInfo[]> finder)
{
_finder = finder ?? throw new ArgumentNullException(nameof(finder));
}
public ConstructorInfo[] FindConstructors(Type targetType)
{
return _finder(targetType);
}
private static ConstructorInfo[] GetDefaultPublicConstructors(Type type)
{
var retval = DefaultPublicConstructorsCache.GetOrAdd(type, t => t.GetConstructors(DeclaredOnlyPublicFlags));
if (retval.Length == 0)
{
throw new NoConstructorsFoundException(type);
}
return retval;
}
}
}

4
framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs

@ -17,7 +17,7 @@ namespace Volo.Abp.BackgroundJobs
protected AbpBackgroundJobWorkerOptions WorkerOptions { get; }
public BackgroundJobWorker(
AbpTimer timer,
AbpAsyncTimer timer,
IOptions<AbpBackgroundJobOptions> jobOptions,
IOptions<AbpBackgroundJobWorkerOptions> workerOptions,
IServiceScopeFactory serviceScopeFactory)
@ -113,4 +113,4 @@ namespace Volo.Abp.BackgroundJobs
return nextTryDate;
}
}
}
}

2
framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerAdapter.cs

@ -34,7 +34,7 @@ namespace Volo.Abp.BackgroundWorkers.Quartz
throw new ArgumentException($"{nameof(worker)} type is different from the generic type");
}
var timer = (AbpTimer) worker.GetType().GetProperty("Timer", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(worker);
var timer = (AbpAsyncTimer) worker.GetType().GetProperty("Timer", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(worker);
period = timer?.Period;
}
else

25
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs

@ -11,15 +11,15 @@ namespace Volo.Abp.BackgroundWorkers
public abstract class AsyncPeriodicBackgroundWorkerBase : BackgroundWorkerBase
{
protected IServiceScopeFactory ServiceScopeFactory { get; }
protected AbpTimer Timer { get; }
protected AbpAsyncTimer Timer { get; }
protected AsyncPeriodicBackgroundWorkerBase(
AbpTimer timer,
AbpAsyncTimer timer,
IServiceScopeFactory serviceScopeFactory)
{
ServiceScopeFactory = serviceScopeFactory;
Timer = timer;
Timer.Elapsed += Timer_Elapsed;
Timer.Elapsed = Timer_Elapsed;
}
public async override Task StartAsync(CancellationToken cancellationToken = default)
@ -34,23 +34,24 @@ namespace Volo.Abp.BackgroundWorkers
await base.StopAsync(cancellationToken);
}
private void Timer_Elapsed(object sender, System.EventArgs e)
private async Task Timer_Elapsed(AbpAsyncTimer timer)
{
await DoWorkAsync();
}
private async Task DoWorkAsync()
{
using (var scope = ServiceScopeFactory.CreateScope())
{
try
{
AsyncHelper.RunSync(
() => DoWorkAsync(new PeriodicBackgroundWorkerContext(scope.ServiceProvider))
);
await DoWorkAsync(new PeriodicBackgroundWorkerContext(scope.ServiceProvider));
}
catch (Exception ex)
{
AsyncHelper.RunSync(
() => scope.ServiceProvider
.GetRequiredService<IExceptionNotifier>()
.NotifyAsync(new ExceptionNotificationContext(ex))
);
await scope.ServiceProvider
.GetRequiredService<IExceptionNotifier>()
.NotifyAsync(new ExceptionNotificationContext(ex));
Logger.LogException(ex);
}

6
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs

@ -43,14 +43,12 @@ namespace Volo.Abp.BackgroundWorkers
{
try
{
DoWork(new PeriodicBackgroundWorkerContext(scope.ServiceProvider));
}
catch (Exception ex)
{
scope.ServiceProvider
.GetRequiredService<IExceptionNotifier>()
.NotifyAsync(new ExceptionNotificationContext(ex));
var exceptionNotifier = scope.ServiceProvider.GetRequiredService<IExceptionNotifier>();
AsyncHelper.RunSync(() => exceptionNotifier.NotifyAsync(new ExceptionNotificationContext(ex)));
Logger.LogException(ex);
}

15
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

@ -175,7 +175,7 @@ namespace Volo.Abp.BlazoriseUI
protected virtual int PageSize { get; } = LimitedResultRequestDto.DefaultMaxResultCount;
protected int CurrentPage;
protected int CurrentPage = 1;
protected string CurrentSorting;
protected int? TotalCount;
protected TGetListInput GetListInput = new TGetListInput();
@ -255,7 +255,7 @@ namespace Volo.Abp.BlazoriseUI
if (GetListInput is IPagedResultRequest pagedResultRequestInput)
{
pagedResultRequestInput.SkipCount = CurrentPage * PageSize;
pagedResultRequestInput.SkipCount = (CurrentPage - 1) * PageSize;
}
if (GetListInput is ILimitedResultRequest limitedResultRequestInput)
@ -266,13 +266,22 @@ namespace Volo.Abp.BlazoriseUI
return Task.CompletedTask;
}
protected virtual async Task SearchEntitiesAsync()
{
CurrentPage = 1;
await GetEntitiesAsync();
StateHasChanged();
}
protected virtual async Task OnDataGridReadAsync(DataGridReadDataEventArgs<TListViewModel> e)
{
CurrentSorting = e.Columns
.Where(c => c.Direction != SortDirection.None)
.Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : ""))
.JoinAsString(",");
CurrentPage = e.Page - 1;
CurrentPage = e.Page;
await GetEntitiesAsync();

10
framework/src/Volo.Abp.BlazoriseUI/Components/SubmitButton.razor

@ -0,0 +1,10 @@
<Button form="@Form" Type="@Type" Color="@Color" Block="@Block" PreventDefaultOnSubmit="@PreventDefaultOnSubmit" Disabled="@IsDisabled" Loading="@IsLoading" Clicked="@OnClickedHandler">
@if ( ChildContent != null )
{
@ChildContent
}
else
{
@SaveString
}
</Button>

73
framework/src/Volo.Abp.BlazoriseUI/Components/SubmitButton.razor.cs

@ -0,0 +1,73 @@
using System;
using System.Threading.Tasks;
using Blazorise;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
namespace Volo.Abp.BlazoriseUI.Components
{
public partial class SubmitButton : ComponentBase
{
protected bool Submiting { get; set; }
[Parameter]
public string Form { get; set; }
[Parameter]
public ButtonType Type { get; set; } = ButtonType.Submit;
[Parameter]
public Color Color { get; set; } = Color.Primary;
[Parameter]
public bool PreventDefaultOnSubmit { get; set; } = true;
[Parameter]
public bool Block { get; set; }
[Parameter]
public bool? Disabled { get; set; }
[Parameter]
public string SaveResourceKey { get; set; } = "Save";
[Parameter]
public EventCallback Clicked { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Inject]
protected IStringLocalizer<AbpUiResource> StringLocalizer { get; set; }
protected bool IsDisabled
=> Disabled == true || Submiting;
protected bool IsLoading
=> Submiting;
protected string SaveString
=> StringLocalizer[SaveResourceKey];
protected virtual async Task OnClickedHandler()
{
try
{
Submiting = true;
await Clicked.InvokeAsync(null);
}
catch (Exception)
{
throw;
}
finally
{
Submiting = false;
await InvokeAsync(StateHasChanged);
}
}
}
}

2
framework/src/Volo.Abp.BlobStoring.Aliyun/Volo.Abp.BlobStoring.Aliyun.csproj

@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="aliyun-net-sdk-sts" Version="3.0.4" />
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.10.0" />
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.12.0" />
</ItemGroup>
<ItemGroup>

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

Loading…
Cancel
Save