Browse Source

Merge branch 'dev' of https://github.com/abpframework/abp into bun/bs5

pull/10447/head
bnymncoskuner 5 years ago
parent
commit
fc4a1a21b8
  1. 17
      .github/workflows/build-and-test.yml
  2. 2
      .gitignore
  3. 1
      README.md
  4. 3
      abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en-GB.json
  5. 3
      abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
  6. 3
      abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/tr.json
  7. 4
      build/common.ps1
  8. 4
      codecov.yml
  9. 2
      common.props
  10. 11
      docs/en/Background-Jobs-Hangfire.md
  11. 8
      docs/en/Blog-Posts/2021-10-05 v5_0_Beta1/POST.md
  12. 26
      docs/en/CLI-New-Command-Samples.md
  13. 14
      docs/en/CLI.md
  14. 7
      docs/en/Migration-Guides/Abp-5-0-Blazor.md
  15. 12
      docs/en/Migration-Guides/Abp-5-0-MVC.md
  16. 18
      docs/en/Migration-Guides/Abp-5_0-Angular.md
  17. 97
      docs/en/Migration-Guides/Abp-5_0.md
  18. 4
      docs/en/UI/Angular/Config-State-Service.md
  19. 21
      docs/en/UI/AspNetCore/Bundling-Minification.md
  20. 34
      framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/DependencyInjection/AbpWebAssemblyConventionalRegistrar.cs
  21. 14
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundlingOptions.cs
  22. 1
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs
  23. 1
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs
  24. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpScriptBundleTagHelper.cs
  25. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpScriptTagHelper.cs
  26. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpStyleBundleTagHelper.cs
  27. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpStyleTagHelper.cs
  28. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs
  29. 20
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs
  30. 24
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs
  31. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/AlertsDemoViewComponent.cs
  32. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/BadgesDemoViewComponent.cs
  33. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/BordersDemoViewComponent.cs
  34. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/BreadcrumbsDemoViewComponent.cs
  35. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/ButtonGroupsDemoViewComponent.cs
  36. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonsDemo/ButtonsDemoViewComponent.cs
  37. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/CardsDemoViewComponent.cs
  38. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CarouselDemo/CarouselDemoViewComponent.cs
  39. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/CollapseDemoViewComponent.cs
  40. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/DropdownsDemoViewComponent.cs
  41. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DynamicFormsDemo/DynamicFormsDemoViewComponent.cs
  42. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/FormElementsDemo/FormElementsDemoViewComponent.cs
  43. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs
  44. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/ListGroupsDemoViewComponent.cs
  45. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/ModalsDemoViewComponent.cs
  46. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavbarsDemo/NavbarsDemoViewComponent.cs
  47. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/NavsDemoViewComponent.cs
  48. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/PopoversDemoViewComponent.cs
  49. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/ProgressBarsDemoViewComponent.cs
  50. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/TablesDemoViewComponent.cs
  51. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/TabsDemoViewComponent.cs
  52. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/TooltipsDemoViewComponent.cs
  53. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/AbpApplicationPathViewComponent.cs
  54. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpPageSearchBox/AbpPageSearchBoxViewComponent.cs
  55. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpPageToolbar/AbpPageToolbarViewComponent.cs
  56. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/sweetalert2/abp-sweetalert2.js
  57. 41
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DependencyInjection/AbpAspNetCoreMvcConventionalRegistrar.cs
  58. 36
      framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpSignalRConventionalRegistrar.cs
  59. 18
      framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperConventionalRegistrar.cs
  60. 23
      framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs
  61. 1
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
  62. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
  63. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/DefaultDotNetProjectBuilder.cs
  64. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
  65. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs
  66. 8
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs
  67. 12
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigratorCommand.cs
  68. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  69. 8
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
  70. 22
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
  71. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs
  72. 109
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs
  73. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs
  74. 23
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs
  75. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs
  76. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs
  77. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs
  78. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmGlobalPackagesChecker.cs
  79. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
  80. 14
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs
  81. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs
  82. 122
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs
  83. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
  84. 26
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionPackageVersionFinder.cs
  85. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs
  86. 46
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
  87. 24
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/ICmdHelper.cs
  88. 100
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ConventionalRegistrarBase.cs
  89. 95
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/DefaultConventionalRegistrar.cs
  90. 12
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/AbpRepositoryConventionalRegistrar.cs
  91. 38
      framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs
  92. 14
      framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireAuthorizationFilter.cs
  93. 24
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/DynamicJavaScriptProxyOptions.cs
  94. 27
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs
  95. 27
      framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/DependencyInjection/AbpMongoDbConventionalRegistrar.cs
  96. 1
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ar.json
  97. 1
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json
  98. 1
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de-DE.json
  99. 1
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de.json
  100. 1
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en-GB.json

17
.github/workflows/build-and-test.yml

@ -1,5 +1,22 @@
name: "build and test" name: "build and test"
on: on:
push:
branches:
- dev
paths:
- 'framework/**/*.cs'
- 'framework/**/*.cshtml'
- 'framework/**/*.csproj'
- 'framework/**/*.razor'
- 'modules/**/*.cs'
- 'modules/**/*.cshtml'
- 'modules/**/*.csproj'
- 'modules/**/*.razor'
- 'templates/**/*.cs'
- 'templates/**/*.cshtml'
- 'templates/**/*.csproj'
- 'templates/**/*.razor'
pull_request: pull_request:
paths: paths:
- 'framework/**/*.cs' - 'framework/**/*.cs'

2
.gitignore

@ -314,7 +314,7 @@ abp-build-config.json
tempkey.jwk tempkey.jwk
# ABP Analyzing files # ABP Analyzing files
*.abppkg.analyze.json # [Disabled for now] *.abppkg.analyze.json
# appsettings.secrets.json # appsettings.secrets.json
appsettings.secrets.json appsettings.secrets.json

1
README.md

@ -1,6 +1,7 @@
# ABP Framework # ABP Framework
![build and test](https://img.shields.io/github/workflow/status/abpframework/abp/build%20and%20test/dev?style=flat-square) ![build and test](https://img.shields.io/github/workflow/status/abpframework/abp/build%20and%20test/dev?style=flat-square)
[![codecov](https://codecov.io/gh/abpframework/abp/branch/dev/graph/badge.svg?token=jUKLCxa6HF)](https://codecov.io/gh/abpframework/abp)
[![NuGet](https://img.shields.io/nuget/v/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) [![NuGet](https://img.shields.io/nuget/v/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core)
[![NuGet (with prereleases)](https://img.shields.io/nuget/vpre/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) [![NuGet (with prereleases)](https://img.shields.io/nuget/vpre/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core)
[![MyGet (nightly builds)](https://img.shields.io/myget/abp-nightly/vpre/Volo.Abp.svg?style=flat-square)](https://docs.abp.io/en/abp/latest/Nightly-Builds) [![MyGet (nightly builds)](https://img.shields.io/myget/abp-nightly/vpre/Volo.Abp.svg?style=flat-square)](https://docs.abp.io/en/abp/latest/Nightly-Builds)

3
abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en-GB.json

@ -101,6 +101,7 @@
"WeWillSendYouADownloadLink": "We've sent the file to {0}.", "WeWillSendYouADownloadLink": "We've sent the file to {0}.",
"InvalidFormInputs": "Please, type the valid information specified on the form.", "InvalidFormInputs": "Please, type the valid information specified on the form.",
"DDDBookEmailBody": "Thank you. <br /> To download your book, <a href=\"{0}\">click here</a>.", "DDDBookEmailBody": "Thank you. <br /> To download your book, <a href=\"{0}\">click here</a>.",
"FreeDDDEBook": "Free DDD E-Book" "FreeDDDEBook": "Free DDD E-Book",
"CommercialNewsletterConfirmationMessage": "I agree to the <a href=\"https://commercial.abp.io/TermsConditions\">Terms & Conditions</a> and <a href=\"https://commercial.abp.io/Privacy\">Privacy Policy</a>."
} }
} }

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

@ -388,6 +388,7 @@
"PurchaseTrialLicenseMessage": "Your license expiration date is {0}. <br> If you want to continue using the projects you created during your free trial period, you need to change the license keys in your <code>appsettings.secrets.json</code> files. Here is your license key:", "PurchaseTrialLicenseMessage": "Your license expiration date is {0}. <br> If you want to continue using the projects you created during your free trial period, you need to change the license keys in your <code>appsettings.secrets.json</code> files. Here is your license key:",
"TrialLicenseExpireMessage": "You are using the trial license and your trial license will expire on {0}.", "TrialLicenseExpireMessage": "You are using the trial license and your trial license will expire on {0}.",
"TryForFree": "Try For Free", "TryForFree": "Try For Free",
"TrialLicenseExpiredInfo": "Your trial license period has expired!" "TrialLicenseExpiredInfo": "Your trial license period has expired!",
"CommercialNewsletterConfirmationMessage": "I agree to the <a href=\"https://commercial.abp.io/TermsConditions\">Terms & Conditions</a> and <a href=\"https://commercial.abp.io/Privacy\">Privacy Policy</a>."
} }
} }

3
abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/tr.json

@ -98,6 +98,7 @@
"WeWillSendYouADownloadLink": "{0} adresine email gönderilmiştir.", "WeWillSendYouADownloadLink": "{0} adresine email gönderilmiştir.",
"InvalidFormInputs": "Lütfen formda belirtilen geçerli bilgileri yazınız.", "InvalidFormInputs": "Lütfen formda belirtilen geçerli bilgileri yazınız.",
"DDDBookEmailBody": "Teşekkürler. <br /> Kitabı indirmek için, <a href=\"{0}\">buraya tıklayınız</a>.", "DDDBookEmailBody": "Teşekkürler. <br /> Kitabı indirmek için, <a href=\"{0}\">buraya tıklayınız</a>.",
"FreeDDDEBook": "Ücretsiz DDD E-Kitap" "FreeDDDEBook": "Ücretsiz DDD E-Kitap",
"CommercialNewsletterConfirmationMessage": "<a href=\"https://commercial.abp.io/TermsConditions\">Şartlar, Koşullar</a> ve <a href=\"https://commercial.abp.io/Privacy\">Gizlilik politikasını</a> kabul ediyorum."
} }
} }

4
build/common.ps1

@ -7,6 +7,7 @@ $rootFolder = (Get-Item -Path "./" -Verbose).FullName
# List of solutions used only in development mode # List of solutions used only in development mode
$solutionPaths = @( $solutionPaths = @(
"../framework", "../framework",
"../studio",
"../modules/basic-theme", "../modules/basic-theme",
"../modules/users", "../modules/users",
"../modules/permission-management", "../modules/permission-management",
@ -19,7 +20,8 @@ $solutionPaths = @(
"../modules/background-jobs", "../modules/background-jobs",
"../modules/account", "../modules/account",
"../modules/cms-kit", "../modules/cms-kit",
"../modules/blob-storing-database" "../modules/blob-storing-database",
"../studio"
) )
if ($full -eq "-f") if ($full -eq "-f")

4
codecov.yml

@ -1,6 +1,4 @@
codecov: codecov:
branch: dev branch: dev
require_ci_to_pass: yes require_ci_to_pass: yes
comment: allow_coverage_offsets: true
require_head: no
require_base: no

2
common.props

@ -1,7 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Version>5.0.0-beta.1</Version> <Version>5.0.0-beta.2</Version>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn> <NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<PackageIconUrl>https://abp.io/assets/abp_nupkg.png</PackageIconUrl> <PackageIconUrl>https://abp.io/assets/abp_nupkg.png</PackageIconUrl>
<PackageProjectUrl>https://abp.io/</PackageProjectUrl> <PackageProjectUrl>https://abp.io/</PackageProjectUrl>

11
docs/en/Background-Jobs-Hangfire.md

@ -95,12 +95,21 @@ app.UseHangfireDashboard("/hangfire", new DashboardOptions
}); });
``` ```
* `AbpHangfireAuthorizationFilter` is an implementation of an authorization filter.
#### AbpHangfireAuthorizationFilter
`AbpHangfireAuthorizationFilter` class has the following fields:
* **`enableTenant` (`bool`, default: `false`):** Enables/disables accessing the Hangfire dashboard on tenant users.
* **`requiredPermissionName` (`string`, default: `null`):** Hangfire dashboard is accessible only if the current user has the specified permission. In this case, if we specify a permission name, we don't need to set `enableTenant` `true` because the permission system already does it.
If you want to require an additional permission, you can pass it into the constructor as below: If you want to require an additional permission, you can pass it into the constructor as below:
```csharp ```csharp
app.UseHangfireDashboard("/hangfire", new DashboardOptions app.UseHangfireDashboard("/hangfire", new DashboardOptions
{ {
AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter("MyHangFireDashboardPermissionName") } AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter(requiredPermissionName: "MyHangFireDashboardPermissionName") }
}); });
``` ```

8
docs/en/Blog-Posts/2021-10-05 v5_0_Beta1/POST.md

@ -1,6 +1,6 @@
# ABP Platform 5.0 Beta 1 Has Been Released # ABP Platform 5.0 Beta 1 Has Been Released
Today, we are excited to release the [ABP Framework](https://abp.io/) and the [ABP Commercial](https://commercial.abp.io/) version **5.0 Beta 1**. This blog post introduces the new features and important changes in this new version. Today, we are excited to release the [ABP Framework](https://abp.io/) and the [ABP Commercial](https://commercial.abp.io/) version **5.0 Beta**. This blog post introduces the new features and important changes in this new version.
> **The planned release date for the [5.0.0 Release Candidate](https://github.com/abpframework/abp/milestone/51) version is November, 2021**. > **The planned release date for the [5.0.0 Release Candidate](https://github.com/abpframework/abp/milestone/51) version is November, 2021**.
@ -34,10 +34,13 @@ See the [ABP CLI documentation](https://docs.abp.io/en/abp/latest/CLI) for all t
### Visual Studio Upgrade ### Visual Studio Upgrade
As .NET 6 is a preview version you need to make changes on your current Visual Studio. If you want to run a .NET 6 project on Visual Studio 2019, you need to enable the `Use Previews of the .NET SDK` option from Visual Studio 2019 options. See the screenshot: As .NET 6 is a preview version you need to make changes on the Visual Studio 2019.
If you want to run a .NET 6 project on Visual Studio 2019, you need to install the latest .NET SDK 6 from https://dotnet.microsoft.com/download/dotnet/6.0
and also enable the `Use Previews of the .NET SDK` option from Visual Studio 2019 options. See the screenshot:
![Enable Using Previews of the .NET SDK ](use-preview-visual-studio.png) ![Enable Using Previews of the .NET SDK ](use-preview-visual-studio.png)
Alternatively you can download the latest Visual Studio 2022 preview to run/create the .NET 6 projects. We have tested the ABP solution with the Visual Studio 2022 `17.0.0 Preview 4.1`. Check out https://visualstudio.microsoft.com/vs/preview/ for more information. Alternatively you can download the latest Visual Studio 2022 preview to run/create the .NET 6 projects. We have tested the ABP solution with the Visual Studio 2022 `17.0.0 Preview 4.1`. Check out https://visualstudio.microsoft.com/vs/preview/ for more information.
### Migration Notes & Breaking Changes ### Migration Notes & Breaking Changes
@ -48,6 +51,7 @@ This is a major version and there are some breaking changes and upgrade steps. H
* `IRepository` doesn't inherit from `IQueryable` anymore. It was already made obsolete in 4.2. * `IRepository` doesn't inherit from `IQueryable` anymore. It was already made obsolete in 4.2.
* Removed NGXS and states from the Angular UI. * Removed NGXS and states from the Angular UI.
* Removed gulp dependency from the MVC / Razor Pages UI in favor of `abp install-libs` command of ABP CLI. * Removed gulp dependency from the MVC / Razor Pages UI in favor of `abp install-libs` command of ABP CLI.
* Deprecated EntityCreatingEventData, EntityUpdatingEventData, EntityDeletingEventData and EntityChangingEventData classes. See [#9897](https://github.com/abpframework/abp/issues/9897).
Please see the [migration document](https://docs.abp.io/en/abp/5.0/Migration-Guides/Abp-5_0) for all the details. You can also see all [the closed issues and pull request](https://github.com/abpframework/abp/releases/tag/5.0.0-beta.1) on GitHub. Please see the [migration document](https://docs.abp.io/en/abp/5.0/Migration-Guides/Abp-5_0) for all the details. You can also see all [the closed issues and pull request](https://github.com/abpframework/abp/releases/tag/5.0.0-beta.1) on GitHub.

26
docs/en/CLI-New-Command-Samples.md

@ -1,4 +1,4 @@
# ABP CLI Create Solution Sample Commands # ABP CLI - New Solution Sample Commands
The `abp new` command creates an ABP solution or other artifacts based on an ABP template. [ABP CLI](CLI.md) has several parameters to create a new ABP solution. In this document we will show you some sample commands to create a new solution. All the project names are `Acme.BookStore`. Currently, the only available mobile project is a `React Native` mobile app. Available database providers are `Entity Framework Core` and `MongoDB`. All the commands starts with `abp new`. The `abp new` command creates an ABP solution or other artifacts based on an ABP template. [ABP CLI](CLI.md) has several parameters to create a new ABP solution. In this document we will show you some sample commands to create a new solution. All the project names are `Acme.BookStore`. Currently, the only available mobile project is a `React Native` mobile app. Available database providers are `Entity Framework Core` and `MongoDB`. All the commands starts with `abp new`.
@ -87,6 +87,28 @@ The following commands are for creating Blazor projects:
abp new Acme.BookStore -u blazor --database-provider mongodb --mobile none -csf abp new Acme.BookStore -u blazor --database-provider mongodb --mobile none -csf
``` ```
## Blazor Server
The following commands are for creating Blazor projects:
* **Entity Framework Core**, no mobile app:
```bash
abp new Acme.BookStore -t app -u blazor-server --mobile none
```
* **Entity Framework Core**, **separate Identity Server**, **separate API Host**, mobile app included:
```bash
abp new Acme.BookStore -u blazor-server --tiered
```
* **MongoDB**, no mobile app, creates the project in a new folder:
```bash
abp new Acme.BookStore -u blazor --database-provider mongodb --mobile none -csf
```
## No UI ## No UI
In the default app template, there is always a frontend project. In this option there is no frontend project. It has a `HttpApi.Host` project to serve your HTTP WebAPIs. It's appropriate if you want to create a WebAPI service. In the default app template, there is always a frontend project. In this option there is no frontend project. It has a `HttpApi.Host` project to serve your HTTP WebAPIs. It's appropriate if you want to create a WebAPI service.
@ -101,6 +123,8 @@ In the default app template, there is always a frontend project. In this option
```bash ```bash
abp new Acme.BookStore -u none --mobile none --database-provider mongodb abp new Acme.BookStore -u none --mobile none --database-provider mongodb
``` ```
## Console application ## Console application

14
docs/en/CLI.md

@ -89,12 +89,14 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample
* `--ui` or `-u`: Specifies the UI framework. Default framework is `mvc`. Available frameworks: * `--ui` or `-u`: Specifies the UI framework. Default framework is `mvc`. Available frameworks:
* `mvc`: ASP.NET Core MVC. There are some additional options for this template: * `mvc`: ASP.NET Core MVC. There are some additional options for this template:
* `--tiered`: Creates a tiered solution where Web and Http API layers are physically separated. If not specified, it creates a layered solution which is less complex and suitable for most scenarios. * `--tiered`: Creates a tiered solution where Web and Http API layers are physically separated. If not specified, it creates a layered solution which is less complex and suitable for most scenarios.
* `angular`: Angular. There are some additional options for this template: * `angular`: Angular UI. There are some additional options for this template:
* `--separate-identity-server`: Separates the identity server application from the API host application. If not specified, you will have a single endpoint in the server side. * `--separate-identity-server`: The Identity Server project comes as a separate project and runs at a different endpoint. It separates the Identity Server from the API Host application. If not specified, you will have a single endpoint in the server side.
* `blazor`: Blazor. There are some additional options for this template: * `blazor`: Blazor UI. There are some additional options for this template:
* `--separate-identity-server`: Separates the identity server application from the API host application. If not specified, you will have a single endpoint in the server side. * `--separate-identity-server`The Identity Server project comes as a separate project and runs at a different endpoint. It separates the Identity Server from the API Host application. If not specified, you will have a single endpoint in the server side.
* `none`: Without UI. There are some additional options for this template: * `blazor-server`: Blazor Server UI. There are some additional options for this template:
* `--separate-identity-server`: Separates the identity server application from the API host application. If not specified, you will have a single endpoint in the server side. * `--tiered`: The Identity Server and the API Host project comes as separate projects and run at different endpoints. It has 3 startup projects: *HttpApi.Host*, *IdentityServer* and *Blazor* and and each runs on different endpoints. If not specified, you will have a single endpoint for your web project.
* `none`: Without UI. No front-end layer will be created. There are some additional options for this template:
* `--separate-identity-server`: The Identity Server project comes as a separate project and runs at a different endpoint. It separates the Identity Server from the API Host application. If not specified, you will have a single endpoint in the server side.
* `--mobile` or `-m`: Specifies the mobile application framework. If not specified, no mobile application will be created. Available options: * `--mobile` or `-m`: Specifies the mobile application framework. If not specified, no mobile application will be created. Available options:
* `react-native`: React Native. * `react-native`: React Native.
* `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers: * `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers:

7
docs/en/Migration-Guides/Abp-5-0-Blazor.md

@ -0,0 +1,7 @@
# ABP Blazor UI v4.x to v5.0 Migration Guide
> This document is for the ABP MVC / Razor Pages UI. See also [the main migration guide](Abp-5_0.md).
## Upgrading to the latest Blazorise
ABP 5.0 uses the latest version of the [Blazorise](https://blazorise.com/) library. Please upgrade the Blazorise NuGet packages in your solution.

12
docs/en/Migration-Guides/Abp-5-0-MVC.md

@ -0,0 +1,12 @@
# ABP MVC / Razor Pages UI v4.x to v5.0 Migration Guide
> This document is for the ABP MVC / Razor Pages UI. See also [the main migration guide](Abp-5_0.md).
## Use install-libs by default
Removed the Gulp dependency from the MVC / Razor Pages UI projects in favor of `abp install-libs` command ([see](https://docs.abp.io/en/abp/5.0/UI/AspNetCore/Client-Side-Package-Management#install-libs-command)) of the ABP CLI. You should run this command whenever you change/upgrade your client-side package dependencies via `package.json`.
## Switched to SweetAlert2
Switched from SweetAlert to SweetAlert2. Run the `abp install-libs` command (in the root directory of the web project) after upgrading your solution. See [#9607](https://github.com/abpframework/abp/pull/9607).

18
docs/en/Migration-Guides/Abp-5_0-Angular.md

@ -1,8 +1,8 @@
# Angular UI v4.x to v5.0 Migration Guide # Angular UI v4.x to v5.0 Migration Guide
## Breaking Changes This document is for the ABP MVC / Razor Pages UI. See also [the main migration guide](Abp-5_0.md).
### Overall ## Overall
See the overall list of breaking changes: See the overall list of breaking changes:
@ -16,15 +16,15 @@ See the overall list of breaking changes:
- Update all dependency versions to the latest [#9806](https://github.com/abpframework/abp/issues/9806) - Update all dependency versions to the latest [#9806](https://github.com/abpframework/abp/issues/9806)
- Chart.js big include with CommonJS warning [#7472](https://github.com/abpframework/abp/issues/7472) - Chart.js big include with CommonJS warning [#7472](https://github.com/abpframework/abp/issues/7472)
### Angular v12 ## Angular v12
The new ABP Angular UI is based on Angular v12. We started to compile Angular UI packages with the Ivy compilation. Therefore, **new packages only work with Angular v12**. If you are still on the older version of Angular v12, you have to update to Angular v12. The update is usually very easy. See [Angular Update Guide](https://update.angular.io/?l=2&v=11.0-12.0) for further information. The new ABP Angular UI is based on Angular v12. We started to compile Angular UI packages with the Ivy compilation. Therefore, **new packages only work with Angular v12**. If you are still on the older version of Angular v12, you have to update to Angular v12. The update is usually very easy. See [Angular Update Guide](https://update.angular.io/?l=2&v=11.0-12.0) for further information.
### Bootstrap 5 ## Bootstrap 5
TODO TODO
### NGXS has been removed ## NGXS has been removed
We aim to make the ABP Framework free of any state-management solutions. ABP developers should be able to use the ABP Framework with any library/framework of their choice. So, we decided to remove NGXS from ABP packages. We aim to make the ABP Framework free of any state-management solutions. ABP developers should be able to use the ABP Framework with any library/framework of their choice. So, we decided to remove NGXS from ABP packages.
@ -42,7 +42,7 @@ NGXS states and actions, some namespaces have been removed. See [this issue](htt
If you don't want to use the NGXS, you should remove all NGXS related imports, injections, etc., from your project. If you don't want to use the NGXS, you should remove all NGXS related imports, injections, etc., from your project.
### @angular/localize package ## @angular/localize package
[`@angular/localize`](https://angular.io/api/localize) dependency has been removed from `@abp/ng.core` package. The package must be installed in your app. Run the following command to install: [`@angular/localize`](https://angular.io/api/localize) dependency has been removed from `@abp/ng.core` package. The package must be installed in your app. Run the following command to install:
@ -56,7 +56,7 @@ yarn add @angular/localize
> ABP Angular UI packages are not dependent on the `@angular/localize` package. However, some packages (like `@ng-bootstrap/ng-bootstrap`) depend on the package. Thus, this package needs to be installed in your project. > ABP Angular UI packages are not dependent on the `@angular/localize` package. However, some packages (like `@ng-bootstrap/ng-bootstrap`) depend on the package. Thus, this package needs to be installed in your project.
### Proxy endpoints ## Proxy endpoints
New endpoints named proxy have been created, related proxies have moved. New endpoints named proxy have been created, related proxies have moved.
For example; before v5.0, `IdentityUserService` could be imported from `@abp/ng.identity`. As of v5.0, the service can be imported from `@abp/ng.identity/proxy`. See an example: For example; before v5.0, `IdentityUserService` could be imported from `@abp/ng.identity`. As of v5.0, the service can be imported from `@abp/ng.identity/proxy`. See an example:
@ -79,11 +79,11 @@ Following proxies have been affected:
- `@abp/ng.tenant-management` to `@abp/ng.tenant-management/proxy` - `@abp/ng.tenant-management` to `@abp/ng.tenant-management/proxy`
- **ProfileService** is deleted from `@abp/ng.core`. Instead, you can import it from `@abp/ng.identity/proxy` - **ProfileService** is deleted from `@abp/ng.core`. Instead, you can import it from `@abp/ng.identity/proxy`
### SettingTabsService ## SettingTabsService
**SettingTabsService** has moved from `@abp/ng.core` to `@abp/ng.setting-management/config`. **SettingTabsService** has moved from `@abp/ng.core` to `@abp/ng.setting-management/config`.
### ChartComponent ## ChartComponent
[`ChartComponent`](../UI/Angular/Chart-Component.md) has moved from `@abp/ng.theme.shared` to `@abp/ng.components/chart.js`. To use the component, you need to import the `ChartModule` to your module as follows: [`ChartComponent`](../UI/Angular/Chart-Component.md) has moved from `@abp/ng.theme.shared` to `@abp/ng.components/chart.js`. To use the component, you need to import the `ChartModule` to your module as follows:

97
docs/en/Migration-Guides/Abp-5_0.md

@ -1,12 +1,75 @@
# ABP Framework v4.x to v5.0 Migration Guide # ABP Framework v4.x to v5.0 Migration Guide
## IdentityUser This document is a guide for upgrading ABP 4.x solutions to ABP 5.0. Please read them all since 5.0 has some important breaking changes.
`IsActive <bool>` property is added to the `IdentityUser`. This flag will be checked during the authentication of the users. See the related [PR](https://github.com/abpframework/abp/pull/10185). ## .NET 6.0
**After the migration, set this property to `true` for the existing users: `UPDATE AbpUsers SET IsActive=1`**
For EFCore you can set `defaultValue` to `true` in the migration class: ABP 5.0 runs on .NET 6.0. So, please upgrade your solution to .NET 6.0 if you want to use ABP 5.0. You can see [Microsoft's migration guide](https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60).
(This will add the column with `true` value for the existing records.)
## Bootstrap 5
ABP 5.0 uses the Bootstrap 5 as the fundamental HTML/CSS framework. We've migrated all the UI themes, tag helpers, UI components and the pages of the pre-built application modules. You may need to update your own pages by following the [Bootstrap's migration guide](https://getbootstrap.com/docs/5.0/migration/).
## Startup Template Changes
The startup template has changed. You don't need to apply all the changes, but it is strongly suggested to follow [this guide](Upgrading-Startup-Template.md) and make the necessary changes for your solution.
## ABP Framework
This section contains breaking changes in the ABP Framework.
### MongoDB
ABP Framework will serialize the datetime based on [AbpClockOptions](https://docs.abp.io/en/abp/latest/Timing#clock-options) starting from ABP v5.0. It was saving `DateTime` values as UTC in MongoDB. Check out [MongoDB Datetime Serialization Options](https://mongodb.github.io/mongo-csharp-driver/2.13/reference/bson/mapping/#datetime-serialization-options).
If you want to revert back this feature, set `UseAbpClockHandleDateTime` to `false` in `AbpMongoDbOptions`:
```cs
Configure<AbpMongoDbOptions>(x => x.UseAbpClockHandleDateTime = false);
```
### Publishing Auto-Events in the Same Unit of Work
Local and distributed auto-events are handled in the same unit of work now. That means the event handles are executed in the same database transaction and they can rollback the transaction if they throw any exception. The new behavior may affect your previous assumptions. See [#9896](https://github.com/abpframework/abp/issues/9896) for more.
#### Deprecated EntityCreatingEventData, EntityUpdatingEventData, EntityDeletingEventData and EntityChangingEventData
As a side effect of the previous change, `EntityCreatingEventData`, `EntityUpdatingEventData`, `EntityDeletingEventData` and `EntityChangingEventData` is not necessary now, because `EntityCreatedEventData`, `EntityUpdatedEventData`, `EntityDeletedEventData` and `EntityChangedEventData` is already taken into the current unit of work. Please switch to `EntityCreatedEventData`, `EntityUpdatedEventData`, `EntityDeletedEventData` and `EntityChangedEventData` if you've used the deprecated events. See [#9897](https://github.com/abpframework/abp/issues/9897) to learn more.
### Removed ModelBuilderConfigurationOptions classes
If you've used these classes, please remove their usages and use the static properties to customize the module's database mappings. See [#8887](https://github.com/abpframework/abp/issues/8887) for more.
### Removed Obsolete APIs
* `IRepository` doesn't inherit from `IQueryable` anymore. It was [made obsolete in 4.2](https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-4_2#irepository-getqueryableasync).
### Other Breaking Changes
* [#9549](https://github.com/abpframework/abp/pull/9549) `IObjectValidator` methods have been changed to asynchronous.
* [#9940](https://github.com/abpframework/abp/pull/9940) Use ASP NET Core's authentication scheme to handle `AbpAuthorizationException`.
* [#9180](https://github.com/abpframework/abp/pull/9180) Use `IRemoteContentStream` without form content headers.
## UI Providers
* [Angular UI 4.x to 5.0 Migration Guide](Abp-5_0-Angular.md)
* [ASP.NET Core MVC / Razor Pages UI 4.x to 5.0 Migration Guide](Abp-5-0-MVC.md)
* [Blazor UI 4.x to 5.0 Migration Guide](Abp-5-0-Blazor.md)
## Modules
This section contains breaking and important changes in the application modules.
### Identity
#### User Active/Passive
An `IsActive` (`bool`) property is added to the `IdentityUser` entity. This flag will be checked during the authentication of the users. EF Core developers need to add a new database migration and update their databases.
**After the database migration, set this property to `true` for the existing users: `UPDATE AbpUsers SET IsActive=1`**. Otherwise, none of the users can login to the application.
Alternatively, you can set `defaultValue` to `true` in the migration class (after adding the migration).
This will add the column with `true` value for the existing records.
```cs ```cs
public partial class AddIsActiveToIdentityUser : Migration public partial class AddIsActiveToIdentityUser : Migration
@ -18,7 +81,7 @@ public partial class AddIsActiveToIdentityUser : Migration
table: "AbpUsers", table: "AbpUsers",
type: "bit", type: "bit",
nullable: false, nullable: false,
defaultValue: true); // Default is false. defaultValue: true); // Default is false, change it to true.
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
@ -30,22 +93,18 @@ public partial class AddIsActiveToIdentityUser : Migration
} }
``` ```
For document base databases like MongoDB, you need to manually update the `IsActive` field for the existing user records. For MongoDB, you need to update the `IsActive` field for the existing users in the database.
## MongoDB
ABP Framework will serialize the datetime based on [AbpClockOptions](https://docs.abp.io/en/abp/latest/Timing#clock-options) starting from ABP v5.0. It was saving `DateTime` values as UTC in MongoDB. Check out [MongoDB Datetime Serialization Options](https://mongodb.github.io/mongo-csharp-driver/2.13/reference/bson/mapping/#datetime-serialization-options). #### Identity -> Account API Changes
To revert back this feature, set `UseAbpClockHandleDateTime = false` in `AbpMongoDbOptions`:
```cs `IProfileAppService` (and the implementation and the related DTOs) are moved to the Account module from the Identity module (done with [this PR](https://github.com/abpframework/abp/pull/10370/files)).
services.Configure<AbpMongoDbOptions>(x => x.UseAbpClockHandleDateTime = false);
```
## IApiScopeRepository ### IdentityServer
`GetByNameAsync` method renamed as `FindByNameAsync`. `IApiScopeRepository.GetByNameAsync` method renamed as `FindByNameAsync`.
## Angular UI ## See Also
See the [Angular UI 5.0 Migration Guide](Abp-5_0-Angular.md). * [Angular UI 4.x to 5.0 Migration Guide](Abp-5_0-Angular.md)
* [ASP.NET Core MVC / Razor Pages UI 4.x to 5.0 Migration Guide]()
* [Blazor UI 4.x to 5.0 Migration Guide](Abp-5-0-Blazor.md)

4
docs/en/UI/Angular/Config-State-Service.md

@ -81,7 +81,7 @@ You can use the `getFeature` or `getFeature$` method of `ConfigStateService` to
```js ```js
// this.config is instance of ConfigStateService // this.config is instance of ConfigStateService
const enableLdapLogin = this.configStateService.getFeature("Account.EnableLdapLogin"); const enableLdapLogin = this.config.getFeature("Account.EnableLdapLogin");
// or // or
this.config.getFeature$("Account.EnableLdapLogin").subscribe(enableLdapLogin => { this.config.getFeature$("Account.EnableLdapLogin").subscribe(enableLdapLogin => {
@ -98,7 +98,7 @@ You can use the `getSetting` or `getSetting$` method of `ConfigStateService` to
```js ```js
// this.config is instance of ConfigStateService // this.config is instance of ConfigStateService
const twoFactorBehaviour = this.configStateService.getSetting("Abp.Identity.TwoFactor.Behaviour"); const twoFactorBehaviour = this.config.getSetting("Abp.Identity.TwoFactor.Behaviour");
// or // or
this.config.getSetting$("Abp.Identity.TwoFactor.Behaviour").subscribe(twoFactorBehaviour => { this.config.getSetting$("Abp.Identity.TwoFactor.Behaviour").subscribe(twoFactorBehaviour => {

21
docs/en/UI/AspNetCore/Bundling-Minification.md

@ -390,6 +390,27 @@ Configure<AbpBundlingOptions>(options =>
Given file is still added to the bundle, but not minified in this case. Given file is still added to the bundle, but not minified in this case.
### Load JavaScript and CSS asynchronously
You can configure `AbpBundlingOptions` to load all or a single js/css file asynchronously.
**Example:**
````csharp
Configure<AbpBundlingOptions>(options =>
{
options.PreloadStyles.Add("/__bundles/Basic.Global");
options.DeferScriptsByDefault = true;
});
````
**Output HTML:**
````html
<link rel="preload" href="/__bundles/Basic.Global.F4FA61F368098407A4C972D0A6914137.css?_v=637697363694828051" as="style" onload="this.rel='stylesheet'"/>
<script defer src="/libs/timeago/locales/jquery.timeago.en.js?_v=637674729040000000"></script>
````
## Themes ## Themes
Themes uses the standard package contributors to add library resources to page layouts. Themes may also define some standard/global bundles, so any module can contribute to these standard/global bundles. See the [theming documentation](Theming.md) for more. Themes uses the standard package contributors to add library resources to page layouts. Themes may also define some standard/global bundles, so any module can contribute to these standard/global bundles. See the [theming documentation](Theming.md) for more.

34
framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/DependencyInjection/AbpWebAssemblyConventionalRegistrar.cs

@ -5,39 +5,21 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Components.DependencyInjection namespace Volo.Abp.AspNetCore.Components.DependencyInjection
{ {
public class AbpWebAssemblyConventionalRegistrar : ConventionalRegistrarBase public class AbpWebAssemblyConventionalRegistrar : DefaultConventionalRegistrar
{ {
public override void AddType(IServiceCollection services, Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (IsConventionalRegistrationDisabled(type)) return !IsComponent(type) || base.IsConventionalRegistrationDisabled(type);
{
return;
}
if (!IsComponent(type))
{
return;
}
var serviceTypes = ExposedServiceExplorer.GetExposedServices(type);
TriggerServiceExposing(services, type, serviceTypes);
foreach (var serviceType in serviceTypes)
{
services.Add(
ServiceDescriptor.Describe(
serviceType,
type,
ServiceLifetime.Transient
)
);
}
} }
private static bool IsComponent(Type type) private static bool IsComponent(Type type)
{ {
return typeof(ComponentBase).IsAssignableFrom(type); return typeof(ComponentBase).IsAssignableFrom(type);
} }
protected override ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{
return ServiceLifetime.Transient;
}
} }
} }

14
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundlingOptions.cs

@ -20,11 +20,23 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
/// </summary> /// </summary>
public BundlingMode Mode { get; set; } = BundlingMode.Auto; public BundlingMode Mode { get; set; } = BundlingMode.Auto;
public bool DeferScriptsByDefault { get; set; }
public List<string> DeferScripts { get; }
public bool PreloadStylesByDefault { get; set; }
public List<string> PreloadStyles { get; }
public AbpBundlingOptions() public AbpBundlingOptions()
{ {
StyleBundles = new BundleConfigurationCollection(); StyleBundles = new BundleConfigurationCollection();
ScriptBundles = new BundleConfigurationCollection(); ScriptBundles = new BundleConfigurationCollection();
MinificationIgnoredFiles = new HashSet<string>(); MinificationIgnoredFiles = new HashSet<string>();
DeferScriptsByDefault = false;
DeferScripts = new List<string>();
PreloadStylesByDefault = false;
PreloadStyles = new List<string>();
} }
} }
} }

1
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs

@ -28,6 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{ {
await ResourceService.ProcessAsync( await ResourceService.ProcessAsync(
TagHelper.ViewContext, TagHelper.ViewContext,
TagHelper,
context, context,
output, output,
new List<BundleTagHelperItem> new List<BundleTagHelperItem>

1
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs

@ -20,6 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{ {
await ResourceService.ProcessAsync( await ResourceService.ProcessAsync(
TagHelper.ViewContext, TagHelper.ViewContext,
TagHelper,
context, context,
output, output,
await GetBundleItems(context, output), await GetBundleItems(context, output),

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpScriptBundleTagHelper.cs

@ -5,10 +5,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
[HtmlTargetElement("abp-script-bundle", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("abp-script-bundle", TagStructure = TagStructure.NormalOrSelfClosing)]
public class AbpScriptBundleTagHelper : AbpBundleTagHelper<AbpScriptBundleTagHelper, AbpScriptBundleTagHelperService>, IBundleTagHelper public class AbpScriptBundleTagHelper : AbpBundleTagHelper<AbpScriptBundleTagHelper, AbpScriptBundleTagHelperService>, IBundleTagHelper
{ {
[HtmlAttributeName("defer")]
public bool Defer { get; set; }
public AbpScriptBundleTagHelper(AbpScriptBundleTagHelperService service) public AbpScriptBundleTagHelper(AbpScriptBundleTagHelperService service)
: base(service) : base(service)
{ {
} }
} }
} }

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpScriptTagHelper.cs

@ -5,6 +5,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
[HtmlTargetElement("abp-script", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("abp-script", TagStructure = TagStructure.NormalOrSelfClosing)]
public class AbpScriptTagHelper : AbpBundleItemTagHelper<AbpScriptTagHelper, AbpScriptTagHelperService>, IBundleItemTagHelper public class AbpScriptTagHelper : AbpBundleItemTagHelper<AbpScriptTagHelper, AbpScriptTagHelperService>, IBundleItemTagHelper
{ {
[HtmlAttributeName("defer")]
public bool Defer { get; set; }
public AbpScriptTagHelper(AbpScriptTagHelperService service) public AbpScriptTagHelper(AbpScriptTagHelperService service)
: base(service) : base(service)
{ {
@ -16,4 +19,4 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
return "js"; return "js";
} }
} }
} }

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpStyleBundleTagHelper.cs

@ -5,6 +5,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
[HtmlTargetElement("abp-style-bundle", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("abp-style-bundle", TagStructure = TagStructure.NormalOrSelfClosing)]
public class AbpStyleBundleTagHelper : AbpBundleTagHelper<AbpStyleBundleTagHelper, AbpStyleBundleTagHelperService>, IBundleTagHelper public class AbpStyleBundleTagHelper : AbpBundleTagHelper<AbpStyleBundleTagHelper, AbpStyleBundleTagHelperService>, IBundleTagHelper
{ {
[HtmlAttributeName("preload")]
public bool Preload { get; set; }
public AbpStyleBundleTagHelper(AbpStyleBundleTagHelperService service) public AbpStyleBundleTagHelper(AbpStyleBundleTagHelperService service)
: base(service) : base(service)
{ {

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpStyleTagHelper.cs

@ -5,6 +5,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
[HtmlTargetElement("abp-style", TagStructure = TagStructure.NormalOrSelfClosing)] [HtmlTargetElement("abp-style", TagStructure = TagStructure.NormalOrSelfClosing)]
public class AbpStyleTagHelper : AbpBundleItemTagHelper<AbpStyleTagHelper, AbpStyleTagHelperService>, IBundleItemTagHelper public class AbpStyleTagHelper : AbpBundleItemTagHelper<AbpStyleTagHelper, AbpStyleTagHelperService>, IBundleItemTagHelper
{ {
[HtmlAttributeName("preload")]
public bool Preload { get; set; }
public AbpStyleTagHelper(AbpStyleTagHelperService service) public AbpStyleTagHelper(AbpStyleTagHelperService service)
: base(service) : base(service)
{ {
@ -16,4 +19,4 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
return "css"; return "css";
} }
} }
} }

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs

@ -36,6 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
public virtual async Task ProcessAsync( public virtual async Task ProcessAsync(
[NotNull] ViewContext viewContext, [NotNull] ViewContext viewContext,
[NotNull] TagHelper tagHelper,
[NotNull] TagHelperContext context, [NotNull] TagHelperContext context,
[NotNull] TagHelperOutput output, [NotNull] TagHelperOutput output,
[NotNull] List<BundleTagHelperItem> bundleItems, [NotNull] List<BundleTagHelperItem> bundleItems,
@ -72,7 +73,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
if (file.Length > 0) if (file.Length > 0)
{ {
AddHtmlTag(viewContext, context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks); AddHtmlTag(viewContext, tagHelper, context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks);
} }
} }
@ -84,7 +85,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
protected abstract Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName); protected abstract Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName);
protected abstract void AddHtmlTag(ViewContext viewContext, TagHelperContext context, TagHelperOutput output, string file); protected abstract void AddHtmlTag(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, string file);
protected virtual string GenerateBundleName(List<BundleTagHelperItem> bundleItems) protected virtual string GenerateBundleName(List<BundleTagHelperItem> bundleItems)
{ {

20
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs

@ -4,13 +4,10 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{ {
@ -19,8 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
public AbpTagHelperScriptService( public AbpTagHelperScriptService(
IBundleManager bundleManager, IBundleManager bundleManager,
IOptions<AbpBundlingOptions> options, IOptions<AbpBundlingOptions> options,
IWebHostEnvironment hostingEnvironment IWebHostEnvironment hostingEnvironment) : base(
) : base(
bundleManager, bundleManager,
options, options,
hostingEnvironment) hostingEnvironment)
@ -41,9 +37,19 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
return await BundleManager.GetScriptBundleFilesAsync(bundleName); return await BundleManager.GetScriptBundleFilesAsync(bundleName);
} }
protected override void AddHtmlTag(ViewContext viewContext, TagHelperContext context, TagHelperOutput output, string file) protected override void AddHtmlTag(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, string file)
{ {
output.Content.AppendHtml($"<script src=\"{viewContext.GetUrlHelper().Content(file.EnsureStartsWith('~'))}\"></script>{Environment.NewLine}"); var defer = tagHelper switch
{
AbpScriptTagHelper scriptTagHelper => scriptTagHelper.Defer,
AbpScriptBundleTagHelper scriptBundleTagHelper => scriptBundleTagHelper.Defer,
_ => false
};
var deferText = (defer || Options.DeferScriptsByDefault || Options.DeferScripts.Any(x => file.StartsWith(x, StringComparison.OrdinalIgnoreCase)))
? "defer"
: string.Empty;
output.Content.AppendHtml($"<script {deferText} src=\"{viewContext.GetUrlHelper().Content(file.EnsureStartsWith('~'))}\"></script>{Environment.NewLine}");
} }
} }
} }

24
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs

@ -4,13 +4,10 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{ {
@ -19,8 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
public AbpTagHelperStyleService( public AbpTagHelperStyleService(
IBundleManager bundleManager, IBundleManager bundleManager,
IOptions<AbpBundlingOptions> options, IOptions<AbpBundlingOptions> options,
IWebHostEnvironment hostingEnvironment IWebHostEnvironment hostingEnvironment) : base(
) : base(
bundleManager, bundleManager,
options, options,
hostingEnvironment) hostingEnvironment)
@ -41,9 +37,23 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
return await BundleManager.GetStyleBundleFilesAsync(bundleName); return await BundleManager.GetStyleBundleFilesAsync(bundleName);
} }
protected override void AddHtmlTag(ViewContext viewContext, TagHelperContext context, TagHelperOutput output, string file) protected override void AddHtmlTag(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, string file)
{ {
output.Content.AppendHtml($"<link rel=\"stylesheet\" href=\"{viewContext.GetUrlHelper().Content(file.EnsureStartsWith('~'))}\" />{Environment.NewLine}"); var preload = tagHelper switch
{
AbpStyleTagHelper styleTagHelper => styleTagHelper.Preload,
AbpStyleBundleTagHelper styleBundleTagHelper => styleBundleTagHelper.Preload,
_ => false
};
if (preload || Options.PreloadStylesByDefault || Options.PreloadStyles.Any(x => file.StartsWith(x, StringComparison.OrdinalIgnoreCase)))
{
output.Content.AppendHtml($"<link rel=\"preload\" href=\"{viewContext.GetUrlHelper().Content(file.EnsureStartsWith('~'))}\" as=\"style\" onload=\"this.rel='stylesheet'\" />{Environment.NewLine}");
}
else
{
output.Content.AppendHtml($"<link rel=\"stylesheet\" href=\"{viewContext.GetUrlHelper().Content(file.EnsureStartsWith('~'))}\" />{Environment.NewLine}");
}
} }
} }
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/AlertsDemo/AlertsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/AlertsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/AlertsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BadgesDemo/BadgesDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BadgesDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BadgesDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BordersDemo/BordersDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BordersDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BordersDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/BreadcrumbsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/BreadcrumbsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/ButtonGroupsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ButtonGroupsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ButtonsDemo/ButtonsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ButtonsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ButtonsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CardsDemo/CardsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CardsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CardsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CarouselDemo/CarouselDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CarouselDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CarouselDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/CollapseDemo/CollapseDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CollapseDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/CollapseDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DropdownsDemo/DropdownsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/DropdownsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/DropdownsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
var Model = new DropDownDemoDemoModel(); var Model = new DropDownDemoDemoModel();

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/DynamicFormsDemo/DynamicFormsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/DynamicFormsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/DynamicFormsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
var model = new DynamicFormsDemoModel(); var model = new DynamicFormsDemoModel();

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/FormElementsDemo/FormElementsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/FormElementsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/FormElementsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
var model = new FormElementsDemoModel(); var model = new FormElementsDemoModel();

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/GridsDemo/GridsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/GridsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/GridsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ListGroupsDemo/ListGroupsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ListGroupsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ListGroupsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ModalsDemo/ModalsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ModalsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ModalsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavbarsDemo/NavbarsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/NavbarsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/NavbarsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/NavsDemo/NavsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/NavsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/NavsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/PopoversDemo/PopoversDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/PopoversDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/PopoversDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/ProgressBarsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/ProgressBarsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TablesDemo/TablesDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TablesDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TablesDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TabsDemo/TabsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TabsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TabsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Views/Components/Themes/Shared/Demos/TooltipsDemo/TooltipsDemoViewComponent.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.Views.Components.Themes.S
{ {
public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TooltipsDemo/Default.cshtml"; public const string ViewPath = "/Views/Components/Themes/Shared/Demos/TooltipsDemo/Default.cshtml";
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View(ViewPath); return View(ViewPath);
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/AbpApplicationPathViewComponent.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpApp
{ {
public class AbpApplicationPathViewComponent : AbpViewComponent public class AbpApplicationPathViewComponent : AbpViewComponent
{ {
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
var applicationPath = ViewContext.HttpContext.Request.PathBase.Value; var applicationPath = ViewContext.HttpContext.Request.PathBase.Value;
var model = new AbpApplicationPathViewComponentModel var model = new AbpApplicationPathViewComponentModel

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpPageSearchBox/AbpPageSearchBoxViewComponent.cs

@ -4,7 +4,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPag
{ {
public class AbpPageSearchBoxViewComponent : AbpViewComponent public class AbpPageSearchBoxViewComponent : AbpViewComponent
{ {
public IViewComponentResult Invoke() public virtual IViewComponentResult Invoke()
{ {
return View("~/Pages/Shared/Components/AbpPageSearchBox/Default.cshtml"); return View("~/Pages/Shared/Components/AbpPageSearchBox/Default.cshtml");
} }

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpPageToolbar/AbpPageToolbarViewComponent.cs

@ -6,16 +6,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPag
{ {
public class AbpPageToolbarViewComponent : AbpViewComponent public class AbpPageToolbarViewComponent : AbpViewComponent
{ {
private readonly IPageToolbarManager _toolbarManager; protected IPageToolbarManager ToolbarManager { get; }
public AbpPageToolbarViewComponent(IPageToolbarManager toolbarManager) public AbpPageToolbarViewComponent(IPageToolbarManager toolbarManager)
{ {
_toolbarManager = toolbarManager; ToolbarManager = toolbarManager;
} }
public async Task<IViewComponentResult> InvokeAsync(string pageName) public virtual async Task<IViewComponentResult> InvokeAsync(string pageName)
{ {
var items = await _toolbarManager.GetItemsAsync(pageName); var items = await ToolbarManager.GetItemsAsync(pageName);
return View("~/Pages/Shared/Components/AbpPageToolbar/Default.cshtml", items); return View("~/Pages/Shared/Components/AbpPageToolbar/Default.cshtml", items);
} }
} }

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

@ -36,11 +36,6 @@ var abp = abp || {};
/* MESSAGE **************************************************/ /* MESSAGE **************************************************/
var showMessage = function (type, message, title) { var showMessage = function (type, message, title) {
if (!title) {
title = message;
message = undefined;
}
var opts = $.extend( var opts = $.extend(
{}, {},
abp.libs.sweetAlert.config['default'], abp.libs.sweetAlert.config['default'],

41
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DependencyInjection/AbpAspNetCoreMvcConventionalRegistrar.cs

@ -7,36 +7,11 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.DependencyInjection namespace Volo.Abp.AspNetCore.Mvc.DependencyInjection
{ {
public class AbpAspNetCoreMvcConventionalRegistrar : ConventionalRegistrarBase public class AbpAspNetCoreMvcConventionalRegistrar : DefaultConventionalRegistrar
{ {
public override void AddType(IServiceCollection services, Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (IsConventionalRegistrationDisabled(type)) return !IsMvcService(type) || base.IsConventionalRegistrationDisabled(type);
{
return;
}
if (!IsMvcService(type))
{
return;
}
var lifeTime = GetMvcServiceLifetime(type);
var serviceTypes = ExposedServiceExplorer.GetExposedServices(type);
TriggerServiceExposing(services, type, serviceTypes);
foreach (var serviceType in serviceTypes)
{
services.Add(
ServiceDescriptor.Describe(
serviceType,
type,
lifeTime
)
);
}
} }
protected virtual bool IsMvcService(Type type) protected virtual bool IsMvcService(Type type)
@ -46,11 +21,6 @@ namespace Volo.Abp.AspNetCore.Mvc.DependencyInjection
IsViewComponent(type); IsViewComponent(type);
} }
protected virtual ServiceLifetime GetMvcServiceLifetime(Type type)
{
return ServiceLifetime.Transient;
}
private static bool IsPageModel(Type type) private static bool IsPageModel(Type type)
{ {
return typeof(PageModel).IsAssignableFrom(type) || type.IsDefined(typeof(PageModelAttribute), true); return typeof(PageModel).IsAssignableFrom(type) || type.IsDefined(typeof(PageModelAttribute), true);
@ -65,5 +35,10 @@ namespace Volo.Abp.AspNetCore.Mvc.DependencyInjection
{ {
return typeof(ViewComponent).IsAssignableFrom(type) || type.IsDefined(typeof(ViewComponentAttribute), true); return typeof(ViewComponent).IsAssignableFrom(type) || type.IsDefined(typeof(ViewComponentAttribute), true);
} }
protected override ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{
return ServiceLifetime.Transient;
}
} }
} }

36
framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpSignalRConventionalRegistrar.cs

@ -5,39 +5,21 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.SignalR namespace Volo.Abp.AspNetCore.SignalR
{ {
public class AbpSignalRConventionalRegistrar : ConventionalRegistrarBase public class AbpSignalRConventionalRegistrar : DefaultConventionalRegistrar
{ {
public override void AddType(IServiceCollection services, Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (IsConventionalRegistrationDisabled(type)) return !IsHub(type) || base.IsConventionalRegistrationDisabled(type);
{
return;
}
if (!IsHub(type))
{
return;
}
var serviceTypes = ExposedServiceExplorer.GetExposedServices(type);
TriggerServiceExposing(services, type, serviceTypes);
foreach (var serviceType in serviceTypes)
{
services.Add(
ServiceDescriptor.Describe(
serviceType,
type,
ServiceLifetime.Transient
)
);
}
} }
private static bool IsHub(Type type) private static bool IsHub(Type type)
{ {
return typeof(Hub).IsAssignableFrom(type); return typeof(Hub).IsAssignableFrom(type);
} }
protected override ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{
return ServiceLifetime.Transient;
}
} }
} }

18
framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperConventionalRegistrar.cs

@ -3,12 +3,11 @@ using System.Linq;
using AutoMapper; using AutoMapper;
using AutoMapper.Internal; using AutoMapper.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AutoMapper namespace Volo.Abp.AutoMapper
{ {
public class AbpAutoMapperConventionalRegistrar : ConventionalRegistrarBase public class AbpAutoMapperConventionalRegistrar : DefaultConventionalRegistrar
{ {
protected readonly Type[] OpenTypes = { protected readonly Type[] OpenTypes = {
typeof(IValueResolver<,,>), typeof(IValueResolver<,,>),
@ -18,17 +17,14 @@ namespace Volo.Abp.AutoMapper
typeof(IMappingAction<,>) typeof(IMappingAction<,>)
}; };
public override void AddType(IServiceCollection services, Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (IsConventionalRegistrationDisabled(type)) return !OpenTypes.Any(type.ImplementsGenericInterface) || base.IsConventionalRegistrationDisabled(type);
{ }
return;
}
if (type.IsClass && !type.IsAbstract && OpenTypes.Any(type.ImplementsGenericInterface)) protected override ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{ {
services.TryAddTransient(type); return ServiceLifetime.Transient;
}
} }
} }
} }

23
framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/AbpQuartzConventionalRegistrar.cs

@ -1,27 +1,22 @@
using System; using System;
using Microsoft.Extensions.DependencyInjection; using System.Collections.Generic;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace Volo.Abp.BackgroundWorkers.Quartz namespace Volo.Abp.BackgroundWorkers.Quartz
{ {
public class AbpQuartzConventionalRegistrar : DefaultConventionalRegistrar public class AbpQuartzConventionalRegistrar : DefaultConventionalRegistrar
{ {
public override void AddType(IServiceCollection services, Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (!typeof(IQuartzBackgroundWorker).IsAssignableFrom(type)) return !typeof(IQuartzBackgroundWorker).IsAssignableFrom(type) || base.IsConventionalRegistrationDisabled(type);
{ }
return;
}
var dependencyAttribute = GetDependencyAttributeOrNull(type);
var lifeTime = GetLifeTimeOrNull(type, dependencyAttribute);
if (lifeTime == null) protected override List<Type> GetExposedServiceTypes(Type type)
{
return new List<Type>()
{ {
return; typeof(IQuartzBackgroundWorker)
} };
services.Add(ServiceDescriptor.Describe(typeof(IQuartzBackgroundWorker), type, lifeTime.Value));
} }
} }
} }

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

@ -527,6 +527,7 @@ namespace Volo.Abp.BlazoriseUI
{ {
await GetEntitiesAsync(); await GetEntitiesAsync();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
await Notify.Success(L["SuccessfullyDeleted"]);
} }
protected virtual string GetDeleteConfirmationMessage(TListViewModel entity) protected virtual string GetDeleteConfirmationMessage(TListViewModel entity)

1
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs

@ -9,6 +9,7 @@ using Volo.Abp.Cli.ServiceProxying.CSharp;
using Volo.Abp.Cli.ServiceProxying.JavaScript; using Volo.Abp.Cli.ServiceProxying.JavaScript;
using Volo.Abp.Domain; using Volo.Abp.Domain;
using Volo.Abp.Http; using Volo.Abp.Http;
using Volo.Abp.Http.ProxyScripting.Generators.JQuery;
using Volo.Abp.IdentityModel; using Volo.Abp.IdentityModel;
using Volo.Abp.Json; using Volo.Abp.Json;
using Volo.Abp.Json.SystemTextJson; using Volo.Abp.Json.SystemTextJson;

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/DefaultDotNetProjectBuilder.cs

@ -9,6 +9,13 @@ namespace Volo.Abp.Cli.Build
{ {
public class DefaultDotNetProjectBuilder : IDotNetProjectBuilder, ITransientDependency public class DefaultDotNetProjectBuilder : IDotNetProjectBuilder, ITransientDependency
{ {
public ICmdHelper CmdHelper { get; }
public DefaultDotNetProjectBuilder(ICmdHelper cmdHelper)
{
CmdHelper = cmdHelper;
}
public List<string> BuildProjects(List<DotNetProjectInfo> projects, string arguments) public List<string> BuildProjects(List<DotNetProjectInfo> projects, string arguments)
{ {
var builtProjects = new ConcurrentBag<string>(); var builtProjects = new ConcurrentBag<string>();

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs

@ -24,17 +24,20 @@ namespace Volo.Abp.Cli
protected ICommandSelector CommandSelector { get; } protected ICommandSelector CommandSelector { get; }
protected IServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
protected NuGetService NuGetService { get; } protected NuGetService NuGetService { get; }
public ICmdHelper CmdHelper { get; }
public CliService( public CliService(
ICommandLineArgumentParser commandLineArgumentParser, ICommandLineArgumentParser commandLineArgumentParser,
ICommandSelector commandSelector, ICommandSelector commandSelector,
IServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
NuGetService nugetService) NuGetService nugetService,
ICmdHelper cmdHelper)
{ {
CommandLineArgumentParser = commandLineArgumentParser; CommandLineArgumentParser = commandLineArgumentParser;
CommandSelector = commandSelector; CommandSelector = commandSelector;
ServiceScopeFactory = serviceScopeFactory; ServiceScopeFactory = serviceScopeFactory;
NuGetService = nugetService; NuGetService = nugetService;
CmdHelper = cmdHelper;
Logger = NullLogger<CliService>.Instance; Logger = NullLogger<CliService>.Instance;
} }
@ -42,7 +45,7 @@ namespace Volo.Abp.Cli
public async Task RunAsync(string[] args) public async Task RunAsync(string[] args)
{ {
Logger.LogInformation("ABP CLI (https://abp.io)"); Logger.LogInformation("ABP CLI (https://abp.io)");
var commandLineArgs = CommandLineArgumentParser.Parse(args); var commandLineArgs = CommandLineArgumentParser.Parse(args);
#if !DEBUG #if !DEBUG
@ -147,7 +150,7 @@ namespace Volo.Abp.Cli
await RunInternalAsync(args); await RunInternalAsync(args);
} }
} }
private async Task RunInternalAsync(CommandLineArgs commandLineArgs) private async Task RunInternalAsync(CommandLineArgs commandLineArgs)
{ {
var commandType = CommandSelector.Select(commandLineArgs); var commandType = CommandSelector.Select(commandLineArgs);
@ -203,7 +206,7 @@ namespace Volo.Abp.Cli
{ {
SemanticVersion currentCliVersion = default; SemanticVersion currentCliVersion = default;
var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list -g")); var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list -g", out int exitCode));
string line; string line;
while ((line = await consoleOutput.ReadLineAsync()) != null) while ((line = await consoleOutput.ReadLineAsync()) != null)
{ {

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs

@ -4,19 +4,18 @@ namespace Volo.Abp.Cli
{ {
public static class CliUrls public static class CliUrls
{ {
#if DEBUG /*
public const string WwwAbpIo = WwwAbpIoDevelopment; public const string WwwAbpIo = WwwAbpIoDevelopment;
public const string AccountAbpIo = AccountAbpIoDevelopment; public const string AccountAbpIo = AccountAbpIoDevelopment;
public const string NuGetRootPath = NuGetRootPathDevelopment; public const string NuGetRootPath = NuGetRootPathDevelopment;
#else */
public const string WwwAbpIo = WwwAbpIoProduction; public const string WwwAbpIo = WwwAbpIoProduction;
public const string AccountAbpIo = AccountAbpIoProduction; public const string AccountAbpIo = AccountAbpIoProduction;
public const string NuGetRootPath = NuGetRootPathProduction; public const string NuGetRootPath = NuGetRootPathProduction;
#endif
public const string WwwAbpIoProduction = "https://abp.io/"; public const string WwwAbpIoProduction = "https://abp.io/";
public const string AccountAbpIoProduction = "https://account.abp.io/"; public const string AccountAbpIoProduction = "https://account.abp.io/";

8
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs

@ -18,7 +18,7 @@ namespace Volo.Abp.Cli.Commands
public ILogger<AddModuleCommand> Logger { get; set; } public ILogger<AddModuleCommand> Logger { get; set; }
protected SolutionModuleAdder SolutionModuleAdder { get; } protected SolutionModuleAdder SolutionModuleAdder { get; }
public SolutionAbpVersionFinder SolutionAbpVersionFinder { get; } public SolutionPackageVersionFinder SolutionPackageVersionFinder { get; }
public AddModuleInfoOutput LastAddedModuleInfo public AddModuleInfoOutput LastAddedModuleInfo
{ {
@ -33,10 +33,10 @@ namespace Volo.Abp.Cli.Commands
} }
} }
public AddModuleCommand(SolutionModuleAdder solutionModuleAdder, SolutionAbpVersionFinder solutionAbpVersionFinder) public AddModuleCommand(SolutionModuleAdder solutionModuleAdder, SolutionPackageVersionFinder solutionPackageVersionFinder)
{ {
SolutionModuleAdder = solutionModuleAdder; SolutionModuleAdder = solutionModuleAdder;
SolutionAbpVersionFinder = solutionAbpVersionFinder; SolutionPackageVersionFinder = solutionPackageVersionFinder;
Logger = NullLogger<AddModuleCommand>.Instance; Logger = NullLogger<AddModuleCommand>.Instance;
} }
@ -62,7 +62,7 @@ namespace Volo.Abp.Cli.Commands
var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);
if (version == null) if (version == null)
{ {
version = SolutionAbpVersionFinder.Find(solutionFile); version = SolutionPackageVersionFinder.Find(solutionFile);
} }
var moduleInfo = await SolutionModuleAdder.AddAsync( var moduleInfo = await SolutionModuleAdder.AddAsync(

12
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigratorCommand.cs

@ -12,10 +12,12 @@ namespace Volo.Abp.Cli.Commands
{ {
public class CreateMigrationAndRunMigratorCommand : IConsoleCommand, ITransientDependency public class CreateMigrationAndRunMigratorCommand : IConsoleCommand, ITransientDependency
{ {
public ICmdHelper CmdHelper { get; }
public ILogger<CreateMigrationAndRunMigratorCommand> Logger { get; set; } public ILogger<CreateMigrationAndRunMigratorCommand> Logger { get; set; }
public CreateMigrationAndRunMigratorCommand() public CreateMigrationAndRunMigratorCommand(ICmdHelper cmdHelper)
{ {
CmdHelper = cmdHelper;
Logger = NullLogger<CreateMigrationAndRunMigratorCommand>.Instance; Logger = NullLogger<CreateMigrationAndRunMigratorCommand>.Instance;
} }
@ -98,7 +100,7 @@ namespace Volo.Abp.Cli.Commands
return Path.GetFileName(dbContext).RemovePostFix(".cs"); return Path.GetFileName(dbContext).RemovePostFix(".cs");
} }
private static string AddMigrationAndGetOutput(string dbMigrationsFolder, string dbContext, string outputDirectory) private string AddMigrationAndGetOutput(string dbMigrationsFolder, string dbContext, string outputDirectory)
{ {
var dbContextOption = string.IsNullOrWhiteSpace(dbContext) var dbContextOption = string.IsNullOrWhiteSpace(dbContext)
? string.Empty ? string.Empty
@ -107,12 +109,12 @@ namespace Volo.Abp.Cli.Commands
var addMigrationCmd = $"cd \"{dbMigrationsFolder}\" && " + var addMigrationCmd = $"cd \"{dbMigrationsFolder}\" && " +
$"dotnet ef migrations add Initial --output-dir {outputDirectory} {dbContextOption}"; $"dotnet ef migrations add Initial --output-dir {outputDirectory} {dbContextOption}";
return CmdHelper.RunCmdAndGetOutput(addMigrationCmd); return CmdHelper.RunCmdAndGetOutput(addMigrationCmd, out int exitCode);
} }
private static bool IsDotNetEfToolInstalled() private bool IsDotNetEfToolInstalled()
{ {
var output = CmdHelper.RunCmdAndGetOutput("dotnet tool list -g"); var output = CmdHelper.RunCmdAndGetOutput("dotnet tool list -g", out int exitCode);
return output.Contains("dotnet-ef"); return output.Contains("dotnet-ef");
} }

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -35,8 +35,9 @@ namespace Volo.Abp.Cli.Commands
public NewCommand(TemplateProjectBuilder templateProjectBuilder public NewCommand(TemplateProjectBuilder templateProjectBuilder
, ITemplateInfoProvider templateInfoProvider, , ITemplateInfoProvider templateInfoProvider,
ConnectionStringProvider connectionStringProvider) ConnectionStringProvider connectionStringProvider,
: base(connectionStringProvider) ICmdHelper cmdHelper)
: base(connectionStringProvider, cmdHelper)
{ {
TemplateProjectBuilder = templateProjectBuilder; TemplateProjectBuilder = templateProjectBuilder;
TemplateInfoProvider = templateInfoProvider; TemplateInfoProvider = templateInfoProvider;

8
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs

@ -18,11 +18,13 @@ namespace Volo.Abp.Cli.Commands
public abstract class ProjectCreationCommandBase public abstract class ProjectCreationCommandBase
{ {
public ConnectionStringProvider ConnectionStringProvider { get; } public ConnectionStringProvider ConnectionStringProvider { get; }
public ICmdHelper CmdHelper { get; }
public ILogger<NewCommand> Logger { get; set; } public ILogger<NewCommand> Logger { get; set; }
public ProjectCreationCommandBase(ConnectionStringProvider connectionStringProvider) public ProjectCreationCommandBase(ConnectionStringProvider connectionStringProvider, ICmdHelper cmdHelper)
{ {
ConnectionStringProvider = connectionStringProvider; ConnectionStringProvider = connectionStringProvider;
CmdHelper = cmdHelper;
Logger = NullLogger<NewCommand>.Instance; Logger = NullLogger<NewCommand>.Instance;
} }
@ -204,6 +206,10 @@ namespace Volo.Abp.Cli.Commands
bool isTiered, bool isTiered,
CommandLineArgs commandLineArgs) CommandLineArgs commandLineArgs)
{ {
#if DEBUG
return;
#endif
if (AppTemplateBase.IsAppTemplate(template)) if (AppTemplateBase.IsAppTemplate(template))
{ {
var isCommercial = template == AppProTemplate.TemplateName; var isCommercial = template == AppProTemplate.TemplateName;

22
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs

@ -15,13 +15,15 @@ namespace Volo.Abp.Cli.Commands
{ {
public class SuiteCommand : IConsoleCommand, ITransientDependency public class SuiteCommand : IConsoleCommand, ITransientDependency
{ {
public ICmdHelper CmdHelper { get; }
private readonly AbpNuGetIndexUrlService _nuGetIndexUrlService; private readonly AbpNuGetIndexUrlService _nuGetIndexUrlService;
private readonly NuGetService _nuGetService; private readonly NuGetService _nuGetService;
private const string SuitePackageName = "Volo.Abp.Suite"; private const string SuitePackageName = "Volo.Abp.Suite";
public ILogger<SuiteCommand> Logger { get; set; } public ILogger<SuiteCommand> Logger { get; set; }
public SuiteCommand(AbpNuGetIndexUrlService nuGetIndexUrlService, NuGetService nuGetService) public SuiteCommand(AbpNuGetIndexUrlService nuGetIndexUrlService, NuGetService nuGetService, ICmdHelper cmdHelper)
{ {
CmdHelper = cmdHelper;
_nuGetIndexUrlService = nuGetIndexUrlService; _nuGetIndexUrlService = nuGetIndexUrlService;
_nuGetService = nuGetService; _nuGetService = nuGetService;
Logger = NullLogger<SuiteCommand>.Instance; Logger = NullLogger<SuiteCommand>.Instance;
@ -71,7 +73,7 @@ namespace Volo.Abp.Cli.Commands
private string GetCurrentSuiteVersion() private string GetCurrentSuiteVersion()
{ {
var dotnetToolList = CmdHelper.RunCmdAndGetOutput("dotnet tool list -g"); var dotnetToolList = CmdHelper.RunCmdAndGetOutput("dotnet tool list -g", out int exitCode);
var suiteLine = dotnetToolList.Split(Environment.NewLine) var suiteLine = dotnetToolList.Split(Environment.NewLine)
.FirstOrDefault(l => l.ToLower().StartsWith("volo.abp.suite ")); .FirstOrDefault(l => l.ToLower().StartsWith("volo.abp.suite "));
@ -127,11 +129,11 @@ namespace Volo.Abp.Cli.Commands
versionOption = $" --version {version}"; versionOption = $" --version {version}";
} }
var result = CmdHelper.RunCmd( CmdHelper.RunCmd(
$"dotnet tool install {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g" $"dotnet tool install {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g", out int exitCode
); );
if (result == 0) if (exitCode == 0)
{ {
Logger.LogInformation("ABP Suite has been successfully installed."); Logger.LogInformation("ABP Suite has been successfully installed.");
Logger.LogInformation("You can run it with the CLI command \"abp suite\""); Logger.LogInformation("You can run it with the CLI command \"abp suite\"");
@ -197,11 +199,11 @@ namespace Volo.Abp.Cli.Commands
versionOption = $" --version {version}"; versionOption = $" --version {version}";
} }
var result = CmdHelper.RunCmd( CmdHelper.RunCmd(
$"dotnet tool update {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g" $"dotnet tool update {SuitePackageName}{versionOption} --add-source {nugetIndexUrl} -g", out int exitCode
); );
if (result != 0) if (exitCode != 0)
{ {
ShowSuiteManualUpdateCommand(); ShowSuiteManualUpdateCommand();
} }
@ -230,7 +232,7 @@ namespace Volo.Abp.Cli.Commands
Logger.LogError("dotnet tool update -g Volo.Abp.Suite --add-source https://nuget.abp.io/<your-private-key>/v3/index.json"); Logger.LogError("dotnet tool update -g Volo.Abp.Suite --add-source https://nuget.abp.io/<your-private-key>/v3/index.json");
} }
private static void RemoveSuite() private void RemoveSuite()
{ {
CmdHelper.RunCmd("dotnet tool uninstall " + SuitePackageName + " -g"); CmdHelper.RunCmd("dotnet tool uninstall " + SuitePackageName + " -g");
} }
@ -275,7 +277,7 @@ namespace Volo.Abp.Cli.Commands
sb.AppendLine(" abp suite"); sb.AppendLine(" abp suite");
sb.AppendLine(" abp suite install"); sb.AppendLine(" abp suite install");
sb.AppendLine(" abp suite install --preview"); sb.AppendLine(" abp suite install --preview");
sb.AppendLine(" abp suite install --version 4.2.2"); sb.AppendLine(" abp suite install --version 4.2.2");
sb.AppendLine(" abp suite update"); sb.AppendLine(" abp suite update");
sb.AppendLine(" abp suite update --preview"); sb.AppendLine(" abp suite update --preview");
sb.AppendLine(" abp suite remove"); sb.AppendLine(" abp suite remove");

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs

@ -16,14 +16,16 @@ namespace Volo.Abp.Cli.LIbs
{ {
public class InstallLibsService : IInstallLibsService, ITransientDependency public class InstallLibsService : IInstallLibsService, ITransientDependency
{ {
public ICmdHelper CmdHelper { get; }
public const string LibsDirectory = "./wwwroot/libs"; public const string LibsDirectory = "./wwwroot/libs";
public ILogger<InstallLibsService> Logger { get; set; } public ILogger<InstallLibsService> Logger { get; set; }
private readonly IJsonSerializer _jsonSerializer; private readonly IJsonSerializer _jsonSerializer;
public InstallLibsService(IJsonSerializer jsonSerializer) public InstallLibsService(IJsonSerializer jsonSerializer, ICmdHelper cmdHelper)
{ {
CmdHelper = cmdHelper;
_jsonSerializer = jsonSerializer; _jsonSerializer = jsonSerializer;
Logger = NullLogger<InstallLibsService>.Instance; Logger = NullLogger<InstallLibsService>.Instance;
} }

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

@ -1,3 +1,4 @@
using System;
using Newtonsoft.Json; using Newtonsoft.Json;
using NuGet.Versioning; using NuGet.Versioning;
using System.Collections.Generic; using System.Collections.Generic;
@ -5,7 +6,6 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Cli.Auth;
using Volo.Abp.Cli.Http; using Volo.Abp.Cli.Http;
using Volo.Abp.Cli.Licensing; using Volo.Abp.Cli.Licensing;
using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding;
@ -24,7 +24,6 @@ namespace Volo.Abp.Cli.NuGet
protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; }
private readonly IApiKeyService _apiKeyService; private readonly IApiKeyService _apiKeyService;
private readonly CliHttpClientFactory _cliHttpClientFactory; private readonly CliHttpClientFactory _cliHttpClientFactory;
private List<string> _proPackageList;
private DeveloperApiKeyResult _apiKeyResult; private DeveloperApiKeyResult _apiKeyResult;
public NuGetService( public NuGetService(
@ -42,10 +41,32 @@ namespace Volo.Abp.Cli.NuGet
Logger = NullLogger<VoloNugetPackagesVersionUpdater>.Instance; Logger = NullLogger<VoloNugetPackagesVersionUpdater>.Instance;
} }
public async Task<bool> PackageExistAsync(string packageId, string version = null)
{
var versionList = await GetPackageVersionListAsync(packageId, false, true);
if (versionList == null)
{
return false;
}
if (version == null)
{
return versionList.Any();
}
return versionList.Contains(version);
}
public async Task<SemanticVersion> GetLatestVersionOrNullAsync(string packageId, bool includeNightly = false, bool includeReleaseCandidates = false) public async Task<SemanticVersion> GetLatestVersionOrNullAsync(string packageId, bool includeNightly = false, bool includeReleaseCandidates = false)
{ {
var versionList = await GetPackageVersionListAsync(packageId, includeNightly, includeReleaseCandidates); var versionList = await GetPackageVersionListAsync(packageId, includeNightly, includeReleaseCandidates);
if (versionList == null)
{
return null;
}
List<SemanticVersion> versions; List<SemanticVersion> versions;
if (!includeNightly && !includeReleaseCandidates) if (!includeNightly && !includeReleaseCandidates)
@ -77,76 +98,54 @@ namespace Volo.Abp.Cli.NuGet
public async Task<List<string>> GetPackageVersionListAsync(string packageId, bool includeNightly = false, public async Task<List<string>> GetPackageVersionListAsync(string packageId, bool includeNightly = false,
bool includeReleaseCandidates = false) bool includeReleaseCandidates = false)
{ {
if (AuthService.IsLoggedIn())
{
_proPackageList ??= await GetProPackageListAsync();
}
string url;
if (includeNightly) if (includeNightly)
{ {
url = $"https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/{packageId.ToLowerInvariant()}/index.json"; var includeNightlyUrl = $"https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/{packageId.ToLowerInvariant()}/index.json";
} return await GetPackageVersionListFromUrlAsync(includeNightlyUrl);
else if (_proPackageList?.Contains(packageId) ?? false)
{
url = await GetNuGetUrlForCommercialPackage(packageId);
}
else
{
url = $"https://api.nuget.org/v3-flatcontainer/{packageId.ToLowerInvariant()}/index.json";
} }
var client = _cliHttpClientFactory.CreateClient(needsAuthentication: false); var nugetUrl = $"https://api.nuget.org/v3-flatcontainer/{packageId.ToLowerInvariant()}/index.json";
var commercialUrl = await GetNuGetUrlForCommercialPackage(packageId);
using (var responseMessage = await client.GetHttpResponseMessageWithRetryAsync( return (await GetPackageVersionListFromUrlAsync(nugetUrl)) ?? (await GetPackageVersionListFromUrlAsync(commercialUrl));
url,
cancellationToken: CancellationTokenProvider.Token,
logger: Logger
))
{
await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage);
var responseContent = await responseMessage.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<NuGetVersionResultDto>(responseContent).Versions;
}
} }
private async Task<string> GetNuGetUrlForCommercialPackage(string packageId) private async Task<List<string>> GetPackageVersionListFromUrlAsync(string url)
{ {
if (_apiKeyResult == null) try
{ {
_apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); var client = _cliHttpClientFactory.CreateClient(needsAuthentication: false);
}
return CliUrls.GetNuGetPackageInfoUrl(_apiKeyResult.ApiKey, packageId); using (var responseMessage = await client.GetHttpResponseMessageWithRetryAsync(
url,
cancellationToken: CancellationTokenProvider.Token,
logger: Logger
))
{
await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage);
var responseContent = await responseMessage.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<NuGetVersionResultDto>(responseContent).Versions;
}
}
catch (Exception)
{
return null;
}
} }
private async Task<List<string>> GetProPackageListAsync() private async Task<string> GetNuGetUrlForCommercialPackage(string packageId)
{ {
var url = $"{CliUrls.WwwAbpIo}api/app/nugetPackage/proPackageNames"; if (_apiKeyResult == null)
var client = _cliHttpClientFactory.CreateClient(needsAuthentication: true);
using (var responseMessage = await client.GetHttpResponseMessageWithRetryAsync(
url: url,
cancellationToken: CancellationTokenProvider.Token,
logger: Logger
))
{ {
if (responseMessage.IsSuccessStatusCode) _apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync();
{
return JsonSerializer.Deserialize<List<string>>(await responseMessage.Content.ReadAsStringAsync());
}
var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. ";
var remoteServiceErrorMessage = await RemoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage);
if (remoteServiceErrorMessage != null) if (_apiKeyResult == null)
{ {
exceptionMessage += remoteServiceErrorMessage; return null;
} }
Logger.LogError(exceptionMessage);
return null;
} }
return CliUrls.GetNuGetPackageInfoUrl(_apiKeyResult.ApiKey, packageId);
} }
public class NuGetVersionResultDto public class NuGetVersionResultDto
@ -155,4 +154,4 @@ namespace Volo.Abp.Cli.NuGet
public List<string> Versions { get; set; } public List<string> Versions { get; set; }
} }
} }
} }

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs

@ -98,11 +98,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{ {
Check.NotNull(content, nameof(content)); Check.NotNull(content, nameof(content));
var doc = new XmlDocument() { PreserveWhitespace = true }; using (var stream = StreamHelper.GenerateStreamFromString(content))
{
doc.Load(StreamHelper.GenerateStreamFromString(content)); var doc = new XmlDocument() { PreserveWhitespace = true };
doc.Load(stream);
return ProcessReferenceNodes(doc, content); return ProcessReferenceNodes(doc, content);
}
} }
private string ProcessReferenceNodes(XmlDocument doc, string content) private string ProcessReferenceNodes(XmlDocument doc, string content)

23
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs

@ -1,6 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Volo.Abp.Cli.ProjectBuilding.Files;
namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{ {
@ -35,6 +39,25 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
var solutionFile = context.GetFile(_solutionFilePath); var solutionFile = context.GetFile(_solutionFilePath);
solutionFile.NormalizeLineEndings(); solutionFile.NormalizeLineEndings();
solutionFile.SetLines(RemoveProject(solutionFile.GetLines().ToList())); solutionFile.SetLines(RemoveProject(solutionFile.GetLines().ToList()));
RemoveProjectFromAbpmdlFile(context);
}
private void RemoveProjectFromAbpmdlFile(ProjectBuildContext context)
{
var abpmdlFile = context.FindFile(_solutionFilePath.RemovePostFix(".sln") + ".abpmdl.json");
if (abpmdlFile == null)
{
return;
}
var jsonRoot = JObject.Parse(abpmdlFile.Content);
var packagesObj = (JObject) jsonRoot["packages"];
packagesObj?.Remove(_projectName);
abpmdlFile.SetContent(jsonRoot.ToString(Formatting.Indented));
} }
private List<string> RemoveProject(List<string> solutionFileLines) private List<string> RemoveProject(List<string> solutionFileLines)

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs

@ -40,11 +40,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{ {
Check.NotNull(content, nameof(content)); Check.NotNull(content, nameof(content));
var doc = new XmlDocument() { PreserveWhitespace = true }; using (var stream = StreamHelper.GenerateStreamFromString(content))
{
doc.Load(StreamHelper.GenerateStreamFromString(content)); var doc = new XmlDocument() { PreserveWhitespace = true };
doc.Load(stream);
return ProcessReferenceNodes(doc, content); return ProcessReferenceNodes(doc, content);
}
} }
private string ProcessReferenceNodes(XmlDocument doc, string content) private string ProcessReferenceNodes(XmlDocument doc, string content)

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceConfigureAwaitPropsStep.cs

@ -40,11 +40,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{ {
Check.NotNull(content, nameof(content)); Check.NotNull(content, nameof(content));
var doc = new XmlDocument() { PreserveWhitespace = true }; using (var stream = StreamHelper.GenerateStreamFromString(content))
{
doc.Load(StreamHelper.GenerateStreamFromString(content)); var doc = new XmlDocument() { PreserveWhitespace = true };
doc.Load(stream);
return ProcessReferenceNodes(doc, content); return ProcessReferenceNodes(doc, content);
}
} }
private string ProcessReferenceNodes(XmlDocument doc, string content) private string ProcessReferenceNodes(XmlDocument doc, string content)

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs

@ -10,10 +10,12 @@ namespace Volo.Abp.Cli.ProjectModification
{ {
public class EfCoreMigrationManager : ITransientDependency public class EfCoreMigrationManager : ITransientDependency
{ {
public ICmdHelper CmdHelper { get; }
public ILogger<EfCoreMigrationManager> Logger { get; set; } public ILogger<EfCoreMigrationManager> Logger { get; set; }
public EfCoreMigrationManager() public EfCoreMigrationManager(ICmdHelper cmdHelper)
{ {
CmdHelper = cmdHelper;
Logger = NullLogger<EfCoreMigrationManager>.Instance; Logger = NullLogger<EfCoreMigrationManager>.Instance;
} }

6
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmGlobalPackagesChecker.cs

@ -7,10 +7,12 @@ namespace Volo.Abp.Cli.ProjectModification
{ {
public class NpmGlobalPackagesChecker : ITransientDependency public class NpmGlobalPackagesChecker : ITransientDependency
{ {
public ICmdHelper CmdHelper { get; }
public ILogger<NpmGlobalPackagesChecker> Logger { get; set; } public ILogger<NpmGlobalPackagesChecker> Logger { get; set; }
public NpmGlobalPackagesChecker() public NpmGlobalPackagesChecker(ICmdHelper cmdHelper)
{ {
CmdHelper = cmdHelper;
Logger = NullLogger<NpmGlobalPackagesChecker>.Instance; Logger = NullLogger<NpmGlobalPackagesChecker>.Instance;
} }
@ -31,7 +33,7 @@ namespace Volo.Abp.Cli.ProjectModification
protected virtual string GetInstalledNpmPackages() protected virtual string GetInstalledNpmPackages()
{ {
Logger.LogInformation("Checking installed npm global packages..."); Logger.LogInformation("Checking installed npm global packages...");
return CmdHelper.RunCmdAndGetOutput("npm list -g --depth 0 --silent"); return CmdHelper.RunCmdAndGetOutput("npm list -g --depth 0 --silent", out int exitCode);
} }
protected virtual void InstallYarn() protected virtual void InstallYarn()

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

@ -23,6 +23,7 @@ namespace Volo.Abp.Cli.ProjectModification
{ {
public ILogger<NpmPackagesUpdater> Logger { get; set; } public ILogger<NpmPackagesUpdater> Logger { get; set; }
protected ICancellationTokenProvider CancellationTokenProvider { get; } protected ICancellationTokenProvider CancellationTokenProvider { get; }
public ICmdHelper CmdHelper { get; }
private readonly PackageJsonFileFinder _packageJsonFileFinder; private readonly PackageJsonFileFinder _packageJsonFileFinder;
private readonly NpmGlobalPackagesChecker _npmGlobalPackagesChecker; private readonly NpmGlobalPackagesChecker _npmGlobalPackagesChecker;
@ -33,11 +34,13 @@ namespace Volo.Abp.Cli.ProjectModification
PackageJsonFileFinder packageJsonFileFinder, PackageJsonFileFinder packageJsonFileFinder,
NpmGlobalPackagesChecker npmGlobalPackagesChecker, NpmGlobalPackagesChecker npmGlobalPackagesChecker,
ICancellationTokenProvider cancellationTokenProvider, ICancellationTokenProvider cancellationTokenProvider,
CliHttpClientFactory cliHttpClientFactory) CliHttpClientFactory cliHttpClientFactory,
ICmdHelper cmdHelper)
{ {
_packageJsonFileFinder = packageJsonFileFinder; _packageJsonFileFinder = packageJsonFileFinder;
_npmGlobalPackagesChecker = npmGlobalPackagesChecker; _npmGlobalPackagesChecker = npmGlobalPackagesChecker;
CancellationTokenProvider = cancellationTokenProvider; CancellationTokenProvider = cancellationTokenProvider;
CmdHelper = cmdHelper;
_cliHttpClientFactory = cliHttpClientFactory; _cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger<NpmPackagesUpdater>.Instance; Logger = NullLogger<NpmPackagesUpdater>.Instance;
} }

14
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NugetPackageToLocalReferenceConverter.cs

@ -31,13 +31,13 @@ namespace Volo.Abp.Cli.ProjectModification
foreach (var projectFile in projectFiles) foreach (var projectFile in projectFiles)
{ {
var content = File.ReadAllText(projectFile); var content = File.ReadAllText(projectFile);
var doc = new XmlDocument() { PreserveWhitespace = true }; using (var stream = StreamHelper.GenerateStreamFromString(content))
{
doc.Load(StreamHelper.GenerateStreamFromString(content)); var doc = new XmlDocument() { PreserveWhitespace = true };
doc.Load(stream);
var convertedProject = ProcessReferenceNodes(folder, doc, nugetPackageList, localPathPrefix, sourceFile, modulePrefix); var convertedProject = ProcessReferenceNodes(folder, doc, nugetPackageList, localPathPrefix, sourceFile, modulePrefix);
File.WriteAllText(projectFile, convertedProject);
File.WriteAllText(projectFile, convertedProject); }
} }
} }

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs

@ -26,6 +26,7 @@ namespace Volo.Abp.Cli.ProjectModification
public SourceCodeDownloadService SourceCodeDownloadService { get; } public SourceCodeDownloadService SourceCodeDownloadService { get; }
public AngularSourceCodeAdder AngularSourceCodeAdder { get; } public AngularSourceCodeAdder AngularSourceCodeAdder { get; }
public IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } public IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; }
public ICmdHelper CmdHelper { get; }
private readonly CliHttpClientFactory _cliHttpClientFactory; private readonly CliHttpClientFactory _cliHttpClientFactory;
public ILogger<ProjectNpmPackageAdder> Logger { get; set; } public ILogger<ProjectNpmPackageAdder> Logger { get; set; }
@ -33,12 +34,14 @@ namespace Volo.Abp.Cli.ProjectModification
IJsonSerializer jsonSerializer, IJsonSerializer jsonSerializer,
SourceCodeDownloadService sourceCodeDownloadService, SourceCodeDownloadService sourceCodeDownloadService,
AngularSourceCodeAdder angularSourceCodeAdder, AngularSourceCodeAdder angularSourceCodeAdder,
IRemoteServiceExceptionHandler remoteServiceExceptionHandler) IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
ICmdHelper cmdHelper)
{ {
JsonSerializer = jsonSerializer; JsonSerializer = jsonSerializer;
SourceCodeDownloadService = sourceCodeDownloadService; SourceCodeDownloadService = sourceCodeDownloadService;
AngularSourceCodeAdder = angularSourceCodeAdder; AngularSourceCodeAdder = angularSourceCodeAdder;
RemoteServiceExceptionHandler = remoteServiceExceptionHandler; RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
CmdHelper = cmdHelper;
_cliHttpClientFactory = cliHttpClientFactory; _cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger<ProjectNpmPackageAdder>.Instance; Logger = NullLogger<ProjectNpmPackageAdder>.Instance;
} }
@ -202,4 +205,4 @@ namespace Volo.Abp.Cli.ProjectModification
} }
} }
} }
} }

122
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs

@ -25,6 +25,7 @@ namespace Volo.Abp.Cli.ProjectModification
public BundleCommand BundleCommand { get; } public BundleCommand BundleCommand { get; }
public SourceCodeDownloadService SourceCodeDownloadService { get; } public SourceCodeDownloadService SourceCodeDownloadService { get; }
public SolutionFileModifier SolutionFileModifier { get; } public SolutionFileModifier SolutionFileModifier { get; }
public ICmdHelper CmdHelper { get; }
protected IJsonSerializer JsonSerializer { get; } protected IJsonSerializer JsonSerializer { get; }
protected ProjectNpmPackageAdder NpmPackageAdder { get; } protected ProjectNpmPackageAdder NpmPackageAdder { get; }
@ -43,7 +44,8 @@ namespace Volo.Abp.Cli.ProjectModification
BundleCommand bundleCommand, BundleCommand bundleCommand,
CliHttpClientFactory cliHttpClientFactory, CliHttpClientFactory cliHttpClientFactory,
SourceCodeDownloadService sourceCodeDownloadService, SourceCodeDownloadService sourceCodeDownloadService,
SolutionFileModifier solutionFileModifier) SolutionFileModifier solutionFileModifier,
ICmdHelper cmdHelper)
{ {
JsonSerializer = jsonSerializer; JsonSerializer = jsonSerializer;
NpmPackageAdder = npmPackageAdder; NpmPackageAdder = npmPackageAdder;
@ -53,6 +55,7 @@ namespace Volo.Abp.Cli.ProjectModification
BundleCommand = bundleCommand; BundleCommand = bundleCommand;
SourceCodeDownloadService = sourceCodeDownloadService; SourceCodeDownloadService = sourceCodeDownloadService;
SolutionFileModifier = solutionFileModifier; SolutionFileModifier = solutionFileModifier;
CmdHelper = cmdHelper;
_cliHttpClientFactory = cliHttpClientFactory; _cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger<ProjectNugetPackageAdder>.Instance; Logger = NullLogger<ProjectNugetPackageAdder>.Instance;
} }
@ -140,37 +143,38 @@ namespace Volo.Abp.Cli.ProjectModification
return projectFile; return projectFile;
} }
protected virtual async Task ConvertPackageReferenceToProjectReference(string projectFile,string solutionFile, NugetPackageInfo package) protected virtual async Task ConvertPackageReferenceToProjectReference(string projectFile, string solutionFile, NugetPackageInfo package)
{ {
var content = File.ReadAllText(projectFile); var content = File.ReadAllText(projectFile);
var doc = new XmlDocument() {PreserveWhitespace = true}; var doc = new XmlDocument() { PreserveWhitespace = true };
doc.Load(StreamHelper.GenerateStreamFromString(content)); using (var stream = StreamHelper.GenerateStreamFromString(content))
var nodes = doc.SelectNodes(
$"/Project/ItemGroup/PackageReference[starts-with(@Include, '{package.Name}')]");
if (nodes == null || nodes.Count < 1)
{ {
return; doc.Load(stream);
} var nodes = doc.SelectNodes($"/Project/ItemGroup/PackageReference[starts-with(@Include, '{package.Name}')]");
if (nodes == null || nodes.Count < 1)
{
return;
}
var downloadedProjectPath = FindRelativeFolderToDownloadPackage(projectFile, solutionFile, package); var downloadedProjectPath = FindRelativeFolderToDownloadPackage(projectFile, solutionFile, package);
var oldNodeIncludeValue = nodes[0]?.Attributes?["Include"]?.Value; var oldNodeIncludeValue = nodes[0]?.Attributes?["Include"]?.Value;
if (package.Name == oldNodeIncludeValue) if (package.Name == oldNodeIncludeValue)
{ {
var referenceProjectPath = $"{downloadedProjectPath}\\{package.Name}.csproj"; var referenceProjectPath = $"{downloadedProjectPath}\\{package.Name}.csproj";
var newNode = doc.CreateElement("ProjectReference"); var newNode = doc.CreateElement("ProjectReference");
var includeAttr = doc.CreateAttribute("Include"); var includeAttr = doc.CreateAttribute("Include");
includeAttr.Value = referenceProjectPath; includeAttr.Value = referenceProjectPath;
newNode.Attributes.Append(includeAttr); newNode.Attributes.Append(includeAttr);
nodes[0]?.ParentNode?.ReplaceChild(newNode, nodes[0]); nodes[0]?.ParentNode?.ReplaceChild(newNode, nodes[0]);
} }
File.WriteAllText(projectFile, doc.OuterXml); File.WriteAllText(projectFile, doc.OuterXml);
await Task.CompletedTask;
}
} }
protected virtual async Task AddSourceCode(string projectFile, string solutionFile, NugetPackageInfo package, string version = null) protected virtual async Task AddSourceCode(string projectFile, string solutionFile, NugetPackageInfo package, string version = null)
@ -192,7 +196,7 @@ namespace Volo.Abp.Cli.ProjectModification
protected virtual string FindRelativeFolderToDownloadPackage(string projectFile, string solutionFile, NugetPackageInfo package) protected virtual string FindRelativeFolderToDownloadPackage(string projectFile, string solutionFile, NugetPackageInfo package)
{ {
var folder = Path.Combine(Path.GetDirectoryName(solutionFile), "packages", package.Name); var folder = Path.Combine(Path.GetDirectoryName(solutionFile), "packages", package.Name);
return new Uri(projectFile).MakeRelativeUri(new Uri(folder)).ToString().Replace("/", "\\"); return new Uri(projectFile).MakeRelativeUri(new Uri(folder)).ToString().Replace("/", "\\");
} }
@ -307,56 +311,52 @@ namespace Volo.Abp.Cli.ProjectModification
protected virtual Task AddToCsprojManuallyAsync(string projectFile, NugetPackageInfo package, string version = null) protected virtual Task AddToCsprojManuallyAsync(string projectFile, NugetPackageInfo package, string version = null)
{ {
var projectFileContent = File.ReadAllText(projectFile); var projectFileContent = File.ReadAllText(projectFile);
var doc = new XmlDocument() {PreserveWhitespace = true}; var doc = new XmlDocument() { PreserveWhitespace = true };
doc.Load(StreamHelper.GenerateStreamFromString(projectFileContent)); using (var stream = StreamHelper.GenerateStreamFromString(projectFileContent))
var itemGroupNodes = doc.SelectNodes("/Project/ItemGroup");
XmlNode itemGroupNode = null;
if (itemGroupNodes == null || itemGroupNodes.Count < 1)
{ {
var projectNodes = doc.SelectNodes("/Project"); doc.Load(stream);
var projectNode = projectNodes[0];
itemGroupNode = doc.CreateElement("ItemGroup"); var itemGroupNodes = doc.SelectNodes("/Project/ItemGroup");
projectNode.AppendChild(itemGroupNode); XmlNode itemGroupNode = null;
}
else
{
itemGroupNode = itemGroupNodes[0];
}
var packageReferenceNode = doc.CreateElement("PackageReference"); if (itemGroupNodes == null || itemGroupNodes.Count < 1)
{
var projectNodes = doc.SelectNodes("/Project");
var projectNode = projectNodes[0];
var includeAttr = doc.CreateAttribute("Include"); itemGroupNode = doc.CreateElement("ItemGroup");
includeAttr.Value = package.Name; projectNode.AppendChild(itemGroupNode);
packageReferenceNode.Attributes.Append(includeAttr); }
else
{
itemGroupNode = itemGroupNodes[0];
}
if (version != null) var packageReferenceNode = doc.CreateElement("PackageReference");
{
var versionAttr = doc.CreateAttribute("Version");
versionAttr.Value = version;
packageReferenceNode.Attributes.Append(versionAttr);
}
itemGroupNode.AppendChild(packageReferenceNode); var includeAttr = doc.CreateAttribute("Include");
includeAttr.Value = package.Name;
packageReferenceNode.Attributes.Append(includeAttr);
File.WriteAllText(projectFile, doc.OuterXml); if (version != null)
{
var versionAttr = doc.CreateAttribute("Version");
versionAttr.Value = version;
packageReferenceNode.Attributes.Append(versionAttr);
}
return Task.CompletedTask; itemGroupNode.AppendChild(packageReferenceNode);
File.WriteAllText(projectFile, doc.OuterXml);
return Task.CompletedTask;
}
} }
protected virtual string GetAbpVersionOrNull(string projectFile) protected virtual string GetAbpVersionOrNull(string projectFile)
{ {
var projectFileContent = File.ReadAllText(projectFile); var projectFileContent = File.ReadAllText(projectFile);
return SolutionPackageVersionFinder.TryParseVersionFromCsprojFile(projectFileContent, out var version)
var doc = new XmlDocument() {PreserveWhitespace = true}; ? version
: null;
doc.Load(StreamHelper.GenerateStreamFromString(projectFileContent));
var nodes = doc.SelectNodes("/Project/ItemGroup/PackageReference[starts-with(@Include, 'Volo.')]");
return nodes?[0]?.Attributes?["Version"]?.Value;
} }
protected virtual async Task<NugetPackageInfo> FindNugetPackageInfoAsync(string packageName) protected virtual async Task<NugetPackageInfo> FindNugetPackageInfoAsync(string packageName)

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -30,6 +30,7 @@ namespace Volo.Abp.Cli.ProjectModification
public AngularSourceCodeAdder AngularSourceCodeAdder { get; } public AngularSourceCodeAdder AngularSourceCodeAdder { get; }
public NewCommand NewCommand { get; } public NewCommand NewCommand { get; }
public BundleCommand BundleCommand { get; } public BundleCommand BundleCommand { get; }
public ICmdHelper CmdHelper { get; }
protected IJsonSerializer JsonSerializer { get; } protected IJsonSerializer JsonSerializer { get; }
protected ProjectNugetPackageAdder ProjectNugetPackageAdder { get; } protected ProjectNugetPackageAdder ProjectNugetPackageAdder { get; }
@ -58,7 +59,8 @@ namespace Volo.Abp.Cli.ProjectModification
AngularSourceCodeAdder angularSourceCodeAdder, AngularSourceCodeAdder angularSourceCodeAdder,
NewCommand newCommand, NewCommand newCommand,
BundleCommand bundleCommand, BundleCommand bundleCommand,
CliHttpClientFactory cliHttpClientFactory) CliHttpClientFactory cliHttpClientFactory,
ICmdHelper cmdHelper)
{ {
JsonSerializer = jsonSerializer; JsonSerializer = jsonSerializer;
ProjectNugetPackageAdder = projectNugetPackageAdder; ProjectNugetPackageAdder = projectNugetPackageAdder;
@ -74,6 +76,7 @@ namespace Volo.Abp.Cli.ProjectModification
AngularSourceCodeAdder = angularSourceCodeAdder; AngularSourceCodeAdder = angularSourceCodeAdder;
NewCommand = newCommand; NewCommand = newCommand;
BundleCommand = bundleCommand; BundleCommand = bundleCommand;
CmdHelper = cmdHelper;
_cliHttpClientFactory = cliHttpClientFactory; _cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger<SolutionModuleAdder>.Instance; Logger = NullLogger<SolutionModuleAdder>.Instance;
} }
@ -620,7 +623,7 @@ namespace Volo.Abp.Cli.ProjectModification
if (!string.IsNullOrEmpty(dbMigratorProject)) if (!string.IsNullOrEmpty(dbMigratorProject))
{ {
CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(dbMigratorProject) + "\" && dotnet run"); CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(dbMigratorProject) + "\" && dotnet run", out int exitCode);
} }
} }

26
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionAbpVersionFinder.cs → framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionPackageVersionFinder.cs

@ -7,15 +7,15 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Cli.ProjectModification namespace Volo.Abp.Cli.ProjectModification
{ {
public class SolutionAbpVersionFinder : ITransientDependency public class SolutionPackageVersionFinder : ITransientDependency
{ {
public string Find(string solutionFile) public string Find(string solutionFile, string packagePrefix = "Volo.Abp")
{ {
var projectFilesUnderSrc = GetProjectFilesOfSolution(solutionFile); var projectFilesUnderSrc = GetProjectFilesOfSolution(solutionFile);
foreach (var projectFile in projectFilesUnderSrc) foreach (var projectFile in projectFilesUnderSrc)
{ {
var content = File.ReadAllText(projectFile); var content = File.ReadAllText(projectFile);
if (TryParseVersionFromCsprojViaXmlDocument(content, out var s)) if (TryParseVersionFromCsprojViaXmlDocument(content, out var s, packagePrefix))
{ {
return s; return s;
} }
@ -24,13 +24,13 @@ namespace Volo.Abp.Cli.ProjectModification
return null; return null;
} }
private static bool TryParseVersionFromCsprojViaXmlDocument(string content, out string version) private static bool TryParseVersionFromCsprojViaXmlDocument(string content, out string version, string packagePrefix)
{ {
var doc = new XmlDocument() { PreserveWhitespace = true }; var doc = new XmlDocument() { PreserveWhitespace = true };
using (var stream = StreamHelper.GenerateStreamFromString(content)) using (var stream = StreamHelper.GenerateStreamFromString(content))
{ {
doc.Load(stream); doc.Load(stream);
var nodes = doc.SelectNodes("/Project/ItemGroup/PackageReference[starts-with(@Include, 'Volo.Abp')]"); var nodes = doc.SelectNodes($"/Project/ItemGroup/PackageReference[starts-with(@Include, '{packagePrefix}')]");
var value = nodes?[0]?.Attributes?["Version"]?.Value; var value = nodes?[0]?.Attributes?["Version"]?.Value;
if (value == null) if (value == null)
{ {
@ -43,12 +43,12 @@ namespace Volo.Abp.Cli.ProjectModification
} }
} }
public static bool TryParseVersionFromCsprojFile(string csprojContent, out string version) public static bool TryParseVersionFromCsprojFile(string csprojContent, out string version, string packagePrefix = "Volo.Abp")
{ {
try try
{ {
var matches = Regex.Matches(csprojContent, var matches = Regex.Matches(csprojContent,
@"PackageReference\s*Include\s*=\s*\""Volo.Abp(.*?)\""\s*Version\s*=\s*\""(.*?)\""", @"PackageReference\s*Include\s*=\s*\""" + packagePrefix + @"(.*?)\""\s*Version\s*=\s*\""(.*?)\""",
RegexOptions.IgnoreCase | RegexOptions.IgnoreCase |
RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnorePatternWhitespace |
RegexOptions.Singleline | RegexOptions.Multiline); RegexOptions.Singleline | RegexOptions.Multiline);
@ -72,11 +72,11 @@ namespace Volo.Abp.Cli.ProjectModification
} }
public static bool TryParseSemanticVersionFromCsprojFile(string csprojContent, out SemanticVersion version) public static bool TryParseSemanticVersionFromCsprojFile(string csprojContent, out SemanticVersion version, string packagePrefix = "Volo.Abp")
{ {
try try
{ {
if (TryParseVersionFromCsprojFile(csprojContent, out var versionText)) if (TryParseVersionFromCsprojFile(csprojContent, out var versionText, packagePrefix))
{ {
return SemanticVersion.TryParse(versionText, out version); return SemanticVersion.TryParse(versionText, out version);
} }
@ -90,13 +90,13 @@ namespace Volo.Abp.Cli.ProjectModification
return false; return false;
} }
public static bool TryFind(string solutionFile, out string version) public static bool TryFind(string solutionFile, out string version, string packagePrefix = "Volo.Abp")
{ {
var projectFiles = GetProjectFilesOfSolution(solutionFile); var projectFiles = GetProjectFilesOfSolution(solutionFile);
foreach (var projectFile in projectFiles) foreach (var projectFile in projectFiles)
{ {
var csprojContent = File.ReadAllText(projectFile); var csprojContent = File.ReadAllText(projectFile);
if (TryParseVersionFromCsprojFile(csprojContent, out var parsedVersion)) if (TryParseVersionFromCsprojFile(csprojContent, out var parsedVersion, packagePrefix))
{ {
version = parsedVersion; version = parsedVersion;
return true; return true;
@ -107,13 +107,13 @@ namespace Volo.Abp.Cli.ProjectModification
return false; return false;
} }
public static bool TryFindSemanticVersion(string solutionFile, out SemanticVersion version) public static bool TryFindSemanticVersion(string solutionFile, out SemanticVersion version, string packagePrefix = "Volo.Abp")
{ {
var projectFiles = GetProjectFilesOfSolution(solutionFile); var projectFiles = GetProjectFilesOfSolution(solutionFile);
foreach (var projectFile in projectFiles) foreach (var projectFile in projectFiles)
{ {
var csprojContent = File.ReadAllText(projectFile); var csprojContent = File.ReadAllText(projectFile);
if (TryParseSemanticVersionFromCsprojFile(csprojContent, out var parsedVersion)) if (TryParseSemanticVersionFromCsprojFile(csprojContent, out var parsedVersion, packagePrefix))
{ {
version = parsedVersion; version = parsedVersion;
return true; return true;

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs

@ -17,13 +17,16 @@ namespace Volo.Abp.Cli.ServiceProxying.Angular
public const string Name = "NG"; public const string Name = "NG";
private readonly CliService _cliService; private readonly CliService _cliService;
private readonly ICmdHelper _cmdhelper;
public AngularServiceProxyGenerator( public AngularServiceProxyGenerator(
CliHttpClientFactory cliHttpClientFactory, CliHttpClientFactory cliHttpClientFactory,
IJsonSerializer jsonSerializer, IJsonSerializer jsonSerializer,
ICmdHelper cmdhelper,
CliService cliService) : CliService cliService) :
base(cliHttpClientFactory, jsonSerializer) base(cliHttpClientFactory, jsonSerializer)
{ {
_cmdhelper = cmdhelper;
_cliService = cliService; _cliService = cliService;
} }
@ -63,7 +66,7 @@ namespace Volo.Abp.Cli.ServiceProxying.Angular
commandBuilder.Append($" --target {target}"); commandBuilder.Append($" --target {target}");
} }
CmdHelper.RunCmd(commandBuilder.ToString()); _cmdhelper.RunCmd(commandBuilder.ToString());
} }
private async Task CheckNgSchematicsAsync() private async Task CheckNgSchematicsAsync()

46
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs

@ -1,14 +1,15 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Cli.Utils namespace Volo.Abp.Cli.Utils
{ {
public static class CmdHelper public class CmdHelper : ICmdHelper, ITransientDependency
{ {
public static int SuccessfulExitCode = 0; private const int SuccessfulExitCode = 0;
public static void OpenWebPage(string url) public void OpenWebPage(string url)
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
@ -25,45 +26,57 @@ namespace Volo.Abp.Cli.Utils
} }
} }
public static void Run(string file, string arguments)
public void Run(string file, string arguments)
{ {
var procStartInfo = new ProcessStartInfo(file, arguments); var procStartInfo = new ProcessStartInfo(file, arguments);
Process.Start(procStartInfo)?.WaitForExit(); Process.Start(procStartInfo)?.WaitForExit();
} }
public static int RunCmd(string command) public void RunCmd(string command, string workingDirectory = null)
{
RunCmd(command, out _, workingDirectory);
}
public void RunCmd(string command, out int exitCode, string workingDirectory = null)
{ {
var procStartInfo = new ProcessStartInfo( var procStartInfo = new ProcessStartInfo(
GetFileName(), GetFileName(),
GetArguments(command) GetArguments(command)
); );
if (!string.IsNullOrEmpty(workingDirectory))
{
procStartInfo.WorkingDirectory = workingDirectory;
}
using (var process = Process.Start(procStartInfo)) using (var process = Process.Start(procStartInfo))
{ {
process?.WaitForExit(); process?.WaitForExit();
return process?.ExitCode ?? 0;
exitCode = process.ExitCode;
} }
} }
public static string RunCmdAndGetOutput(string command) public string RunCmdAndGetOutput(string command, string workingDirectory = null)
{ {
return RunCmdAndGetOutput(command, out int _); return RunCmdAndGetOutput(command, out int _, workingDirectory);
} }
public static string RunCmdAndGetOutput(string command, out bool isExitCodeSuccessful) public string RunCmdAndGetOutput(string command, out bool isExitCodeSuccessful, string workingDirectory = null)
{ {
var output = RunCmdAndGetOutput(command, out int exitCode); var output = RunCmdAndGetOutput(command, out int exitCode, workingDirectory);
isExitCodeSuccessful = exitCode == SuccessfulExitCode; isExitCodeSuccessful = exitCode == SuccessfulExitCode;
return output; return output;
} }
public static string RunCmdAndGetOutput(string command, out int exitCode) public string RunCmdAndGetOutput(string command, out int exitCode, string workingDirectory = null)
{ {
string output; string output;
using (var process = new Process()) using (var process = new Process())
{ {
process.StartInfo = new ProcessStartInfo(CmdHelper.GetFileName()) process.StartInfo = new ProcessStartInfo(GetFileName())
{ {
Arguments = GetArguments(command), Arguments = GetArguments(command),
UseShellExecute = false, UseShellExecute = false,
@ -72,6 +85,11 @@ namespace Volo.Abp.Cli.Utils
RedirectStandardError = true RedirectStandardError = true
}; };
if (!string.IsNullOrEmpty(workingDirectory))
{
process.StartInfo.WorkingDirectory = workingDirectory;
}
process.Start(); process.Start();
using (var standardOutput = process.StandardOutput) using (var standardOutput = process.StandardOutput)
@ -91,7 +109,7 @@ namespace Volo.Abp.Cli.Utils
return output.Trim(); return output.Trim();
} }
public static string GetArguments(string command) public string GetArguments(string command)
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{ {
@ -102,7 +120,7 @@ namespace Volo.Abp.Cli.Utils
return "/C \"" + command + "\""; return "/C \"" + command + "\"";
} }
public static string GetFileName() public string GetFileName()
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {

24
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/ICmdHelper.cs

@ -0,0 +1,24 @@
namespace Volo.Abp.Cli.Utils
{
public interface ICmdHelper
{
void OpenWebPage(string url);
void Run(string file, string arguments);
string GetArguments(string command);
string GetFileName();
void RunCmd(string command, string workingDirectory = null);
void RunCmd(string command, out int exitCode, string workingDirectory = null);
string RunCmdAndGetOutput(string command, string workingDirectory = null);
string RunCmdAndGetOutput(string command, out bool isExitCodeSuccessful, string workingDirectory = null);
string RunCmdAndGetOutput(string command, out int exitCode, string workingDirectory = null);
}
}

100
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ConventionalRegistrarBase.cs

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Reflection; using Volo.Abp.Reflection;
@ -50,5 +51,102 @@ namespace Volo.Abp.DependencyInjection
} }
} }
} }
protected virtual DependencyAttribute GetDependencyAttributeOrNull(Type type)
{
return type.GetCustomAttribute<DependencyAttribute>(true);
}
protected virtual ServiceLifetime? GetLifeTimeOrNull(Type type, [CanBeNull] DependencyAttribute dependencyAttribute)
{
return dependencyAttribute?.Lifetime ?? GetServiceLifetimeFromClassHierarchy(type) ?? GetDefaultLifeTimeOrNull(type);
}
protected virtual ServiceLifetime? GetServiceLifetimeFromClassHierarchy(Type type)
{
if (typeof(ITransientDependency).GetTypeInfo().IsAssignableFrom(type))
{
return ServiceLifetime.Transient;
}
if (typeof(ISingletonDependency).GetTypeInfo().IsAssignableFrom(type))
{
return ServiceLifetime.Singleton;
}
if (typeof(IScopedDependency).GetTypeInfo().IsAssignableFrom(type))
{
return ServiceLifetime.Scoped;
}
return null;
}
protected virtual ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{
return null;
}
protected virtual List<Type> GetExposedServiceTypes(Type type)
{
return ExposedServiceExplorer.GetExposedServices(type);
}
protected virtual ServiceDescriptor CreateServiceDescriptor(
Type implementationType,
Type exposingServiceType,
List<Type> allExposingServiceTypes,
ServiceLifetime lifeTime)
{
if (lifeTime.IsIn(ServiceLifetime.Singleton, ServiceLifetime.Scoped))
{
var redirectedType = GetRedirectedTypeOrNull(
implementationType,
exposingServiceType,
allExposingServiceTypes
);
if (redirectedType != null)
{
return ServiceDescriptor.Describe(
exposingServiceType,
provider => provider.GetService(redirectedType),
lifeTime
);
}
}
return ServiceDescriptor.Describe(
exposingServiceType,
implementationType,
lifeTime
);
}
protected virtual Type GetRedirectedTypeOrNull(
Type implementationType,
Type exposingServiceType,
List<Type> allExposingServiceTypes)
{
if (allExposingServiceTypes.Count < 2)
{
return null;
}
if (exposingServiceType == implementationType)
{
return null;
}
if (allExposingServiceTypes.Contains(implementationType))
{
return implementationType;
}
return allExposingServiceTypes.FirstOrDefault(
t => t != exposingServiceType && exposingServiceType.IsAssignableFrom(t)
);
}
} }
} }

95
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/DefaultConventionalRegistrar.cs

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
@ -53,96 +49,5 @@ namespace Volo.Abp.DependencyInjection
} }
} }
} }
protected virtual List<Type> GetExposedServiceTypes(Type type)
{
return ExposedServiceExplorer.GetExposedServices(type);
}
protected virtual ServiceDescriptor CreateServiceDescriptor(
Type implementationType,
Type exposingServiceType,
List<Type> allExposingServiceTypes,
ServiceLifetime lifeTime)
{
if (lifeTime.IsIn(ServiceLifetime.Singleton, ServiceLifetime.Scoped))
{
var redirectedType = GetRedirectedTypeOrNull(
implementationType,
exposingServiceType,
allExposingServiceTypes
);
if (redirectedType != null)
{
return ServiceDescriptor.Describe(
exposingServiceType,
provider => provider.GetService(redirectedType),
lifeTime
);
}
}
return ServiceDescriptor.Describe(
exposingServiceType,
implementationType,
lifeTime
);
}
protected virtual Type GetRedirectedTypeOrNull(
Type implementationType,
Type exposingServiceType,
List<Type> allExposingServiceTypes)
{
if (allExposingServiceTypes.Count < 2)
{
return null;
}
if (exposingServiceType == implementationType)
{
return null;
}
if (allExposingServiceTypes.Contains(implementationType))
{
return implementationType;
}
return allExposingServiceTypes.FirstOrDefault(
t => t != exposingServiceType && exposingServiceType.IsAssignableFrom(t)
);
}
protected virtual DependencyAttribute GetDependencyAttributeOrNull(Type type)
{
return type.GetCustomAttribute<DependencyAttribute>(true);
}
protected virtual ServiceLifetime? GetLifeTimeOrNull(Type type, [CanBeNull] DependencyAttribute dependencyAttribute)
{
return dependencyAttribute?.Lifetime ?? GetServiceLifetimeFromClassHierarchy(type);
}
protected virtual ServiceLifetime? GetServiceLifetimeFromClassHierarchy(Type type)
{
if (typeof(ITransientDependency).GetTypeInfo().IsAssignableFrom(type))
{
return ServiceLifetime.Transient;
}
if (typeof(ISingletonDependency).GetTypeInfo().IsAssignableFrom(type))
{
return ServiceLifetime.Singleton;
}
if (typeof(IScopedDependency).GetTypeInfo().IsAssignableFrom(type))
{
return ServiceLifetime.Scoped;
}
return null;
}
} }
} }

12
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/AbpRepositoryConventionalRegistrar.cs

@ -15,12 +15,7 @@ namespace Volo.Abp.Domain.Repositories
protected override bool IsConventionalRegistrationDisabled(Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (!typeof(IRepository).IsAssignableFrom(type)) return !typeof(IRepository).IsAssignableFrom(type) || base.IsConventionalRegistrationDisabled(type);
{
return true;
}
return base.IsConventionalRegistrationDisabled(type);
} }
protected override List<Type> GetExposedServiceTypes(Type type) protected override List<Type> GetExposedServiceTypes(Type type)
@ -35,10 +30,9 @@ namespace Volo.Abp.Domain.Repositories
.ToList(); .ToList();
} }
protected override ServiceLifetime? GetServiceLifetimeFromClassHierarchy(Type type) protected override ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{ {
return base.GetServiceLifetimeFromClassHierarchy(type) ?? return ServiceLifetime.Transient;
ServiceLifetime.Transient;
} }
} }
} }

38
framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs

@ -1,39 +1,31 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using FluentValidation; using FluentValidation;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace Volo.Abp.FluentValidation namespace Volo.Abp.FluentValidation
{ {
public class AbpFluentValidationConventionalRegistrar : ConventionalRegistrarBase public class AbpFluentValidationConventionalRegistrar : DefaultConventionalRegistrar
{ {
public override void AddType(IServiceCollection services, Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (IsConventionalRegistrationDisabled(type)) return !type.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IValidator<>)) ||
{ base.IsConventionalRegistrationDisabled(type);
return; }
}
if (!typeof(IValidator).IsAssignableFrom(type)) protected override ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{ {
return; return ServiceLifetime.Transient;
} }
var validatingType = GetFirstGenericArgumentOrNull(type, 1); protected override List<Type> GetExposedServiceTypes(Type type)
if (validatingType == null) {
return new List<Type>()
{ {
return; typeof(IValidator<>).MakeGenericType(GetFirstGenericArgumentOrNull(type, 1))
} };
var serviceType = typeof(IValidator<>).MakeGenericType(validatingType);
TriggerServiceExposing(services, type, new List<Type>{ serviceType });
services.AddTransient(
serviceType,
type
);
} }
private static Type GetFirstGenericArgumentOrNull(Type type, int depth) private static Type GetFirstGenericArgumentOrNull(Type type, int depth)

14
framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireAuthorizationFilter.cs

@ -9,16 +9,18 @@ namespace Volo.Abp.Hangfire
{ {
public class AbpHangfireAuthorizationFilter : IDashboardAsyncAuthorizationFilter public class AbpHangfireAuthorizationFilter : IDashboardAsyncAuthorizationFilter
{ {
private readonly bool _enableTenant;
private readonly string _requiredPermissionName; private readonly string _requiredPermissionName;
public AbpHangfireAuthorizationFilter(string requiredPermissionName = null) public AbpHangfireAuthorizationFilter(bool enableTenant = false, string requiredPermissionName = null)
{ {
_enableTenant = requiredPermissionName.IsNullOrWhiteSpace() ? enableTenant : true;
_requiredPermissionName = requiredPermissionName; _requiredPermissionName = requiredPermissionName;
} }
public async Task<bool> AuthorizeAsync(DashboardContext context) public async Task<bool> AuthorizeAsync(DashboardContext context)
{ {
if (!IsLoggedIn(context)) if (!IsLoggedIn(context, _enableTenant))
{ {
return false; return false;
} }
@ -31,9 +33,15 @@ namespace Volo.Abp.Hangfire
return await IsPermissionGrantedAsync(context, _requiredPermissionName); return await IsPermissionGrantedAsync(context, _requiredPermissionName);
} }
private static bool IsLoggedIn(DashboardContext context) private static bool IsLoggedIn(DashboardContext context, bool enableTenant)
{ {
var currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>(); var currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>();
if (!enableTenant)
{
return currentUser.IsAuthenticated && !currentUser.TenantId.HasValue;
}
return currentUser.IsAuthenticated; return currentUser.IsAuthenticated;
} }

24
framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/DynamicJavaScriptProxyOptions.cs

@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
{
public class DynamicJavaScriptProxyOptions
{
public HashSet<string> DisabledModules { get; }
public DynamicJavaScriptProxyOptions()
{
DisabledModules = new HashSet<string>();
}
public void DisableModule(string module)
{
DisabledModules.AddIfNotContains(module);
}
public void EnableModule(string module)
{
DisabledModules.Remove(module);
}
}
}

27
framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Modeling; using Volo.Abp.Http.Modeling;
@ -19,6 +20,13 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
/// </summary> /// </summary>
public const string Name = "jquery"; public const string Name = "jquery";
private readonly DynamicJavaScriptProxyOptions _dynamicJavaScriptProxyOptions;
public JQueryProxyScriptGenerator(IOptions<DynamicJavaScriptProxyOptions> dynamicJavaScriptProxyOptions)
{
_dynamicJavaScriptProxyOptions = dynamicJavaScriptProxyOptions.Value;
}
public string CreateScript(ApplicationApiDescriptionModel model) public string CreateScript(ApplicationApiDescriptionModel model)
{ {
var script = new StringBuilder(); var script = new StringBuilder();
@ -26,10 +34,15 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
script.AppendLine("/* This file is automatically generated by ABP framework to use MVC Controllers from javascript. */"); script.AppendLine("/* This file is automatically generated by ABP framework to use MVC Controllers from javascript. */");
script.AppendLine(); script.AppendLine();
foreach (var module in model.Modules.Values) foreach (var module in model.Modules)
{ {
if (!ShouldCreateModuleScript(module))
{
continue;
}
script.AppendLine(); script.AppendLine();
AddModuleScript(script, module); AddModuleScript(script, module.Value);
} }
AddInitializedEventTrigger(script); AddInitializedEventTrigger(script);
@ -37,6 +50,16 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
return script.ToString(); return script.ToString();
} }
private bool ShouldCreateModuleScript(KeyValuePair<string, ModuleApiDescriptionModel> module)
{
if (_dynamicJavaScriptProxyOptions.DisabledModules.Contains(module.Key))
{
return false;
}
return true;
}
private static void AddModuleScript(StringBuilder script, ModuleApiDescriptionModel module) private static void AddModuleScript(StringBuilder script, ModuleApiDescriptionModel module)
{ {
//TODO: Eleminate repeating module.RootPath.Replace("/", ".").ToCamelCase() ! //TODO: Eleminate repeating module.RootPath.Replace("/", ".").ToCamelCase() !

27
framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/DependencyInjection/AbpMongoDbConventionalRegistrar.cs

@ -1,29 +1,28 @@
using System; using System;
using System.Reflection; using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace Volo.Abp.MongoDB.DependencyInjection namespace Volo.Abp.MongoDB.DependencyInjection
{ {
public class AbpMongoDbConventionalRegistrar : DefaultConventionalRegistrar public class AbpMongoDbConventionalRegistrar : DefaultConventionalRegistrar
{ {
public override void AddType(IServiceCollection services, Type type) protected override bool IsConventionalRegistrationDisabled(Type type)
{ {
if (!typeof(IAbpMongoDbContext).IsAssignableFrom(type) || type == typeof(AbpMongoDbContext)) return !typeof(IAbpMongoDbContext).IsAssignableFrom(type) || type == typeof(AbpMongoDbContext) || base.IsConventionalRegistrationDisabled(type);
{ }
return;
}
var dependencyAttribute = GetDependencyAttributeOrNull(type);
var lifeTime = GetLifeTimeOrNull(type, dependencyAttribute);
if (lifeTime == null) protected override List<Type> GetExposedServiceTypes(Type type)
{
return new List<Type>()
{ {
return; typeof(IAbpMongoDbContext)
} };
}
services.Add(ServiceDescriptor.Describe(typeof(IAbpMongoDbContext), type, ServiceLifetime.Transient)); protected override ServiceLifetime? GetDefaultLifeTimeOrNull(Type type)
{
return ServiceLifetime.Transient;
} }
} }
} }

1
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/ar.json

@ -13,6 +13,7 @@
"SavingWithThreeDot": "حفظ...", "SavingWithThreeDot": "حفظ...",
"Actions": "أجراءات", "Actions": "أجراءات",
"Delete": "حذف", "Delete": "حذف",
"SuccessfullyDeleted": "تم الحذف بنجاح",
"Edit": "تعديل", "Edit": "تعديل",
"Refresh": "تحديث", "Refresh": "تحديث",
"Language": "لغة", "Language": "لغة",

1
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/cs.json

@ -12,6 +12,7 @@
"SavingWithThreeDot": "Ukládám...", "SavingWithThreeDot": "Ukládám...",
"Actions": "Akce", "Actions": "Akce",
"Delete": "Smazat", "Delete": "Smazat",
"SuccessfullyDeleted": "Úspěšně smazáno",
"Edit": "Upravit", "Edit": "Upravit",
"Refresh": "Obnovit", "Refresh": "Obnovit",
"Language": "Jazyk", "Language": "Jazyk",

1
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de-DE.json

@ -13,6 +13,7 @@
"SavingWithThreeDot": "Speichern...", "SavingWithThreeDot": "Speichern...",
"Actions": "Aktionen", "Actions": "Aktionen",
"Delete": "Löschen", "Delete": "Löschen",
"SuccessfullyDeleted": "Erfolgreich gelöscht",
"Edit": "Bearbeiten", "Edit": "Bearbeiten",
"Refresh": "Aktualisieren", "Refresh": "Aktualisieren",
"Language": "Sprache", "Language": "Sprache",

1
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/de.json

@ -12,6 +12,7 @@
"SavingWithThreeDot": "Speichere...", "SavingWithThreeDot": "Speichere...",
"Actions": "Aktionen", "Actions": "Aktionen",
"Delete": "Löschen", "Delete": "Löschen",
"SuccessfullyDeleted": "Erfolgreich gelöscht",
"Edit": "Bearbeiten", "Edit": "Bearbeiten",
"Refresh": "Aktualisieren", "Refresh": "Aktualisieren",
"Language": "Sprache", "Language": "Sprache",

1
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en-GB.json

@ -13,6 +13,7 @@
"SavingWithThreeDot": "Saving", "SavingWithThreeDot": "Saving",
"Actions": "Actions", "Actions": "Actions",
"Delete": "Delete", "Delete": "Delete",
"SuccessfullyDeleted": "Successfully deleted",
"Edit": "Edit", "Edit": "Edit",
"Refresh": "Refresh", "Refresh": "Refresh",
"Language": "Language", "Language": "Language",

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

Loading…
Cancel
Save