Browse Source

Merge branch 'dev' into issue-4830

pull/21763/head
SALİH ÖZKARA 2 years ago
parent
commit
1374c64b64
  1. 135
      Directory.Packages.props
  2. 4
      README.md
  3. 2
      docs/en/Blog-Posts/2022-05-09 v5_3_Preview/POST.md
  4. 67
      docs/en/Blog-Posts/2024-12-15-ABP-Studio-R2R/POST.md
  5. 4
      docs/en/Community-Articles/2022-09-15-Grpc-Demo/POST.md
  6. 16
      docs/en/Community-Articles/2024-01-18-ABP-Now-Supports-Keyed-Services/POST.md
  7. 309
      docs/en/Community-Articles/2024-11-25-Global-Assets/POST.md
  8. BIN
      docs/en/Community-Articles/2024-11-25-Global-Assets/image.png
  9. 2
      docs/en/cli/index.md
  10. 2
      docs/en/cli/new-command-samples.md
  11. 458
      docs/en/docs-nav.json
  12. 1
      docs/en/docs-params.json
  13. 44
      docs/en/framework/architecture/best-practices/application-services.md
  14. 6
      docs/en/framework/architecture/best-practices/data-transfer-objects.md
  15. 10
      docs/en/framework/architecture/best-practices/domain-services.md
  16. 33
      docs/en/framework/architecture/best-practices/entities.md
  17. 18
      docs/en/framework/architecture/best-practices/entity-framework-core-integration.md
  18. 4
      docs/en/framework/architecture/best-practices/module-architecture.md
  19. 18
      docs/en/framework/architecture/best-practices/mongodb-integration.md
  20. 10
      docs/en/framework/architecture/best-practices/repositories.md
  21. 2
      docs/en/framework/architecture/domain-driven-design/data-transfer-objects.md
  22. 2
      docs/en/framework/architecture/domain-driven-design/domain-services.md
  23. 44
      docs/en/framework/fundamentals/caching.md
  24. 7
      docs/en/framework/infrastructure/background-jobs/index.md
  25. 12
      docs/en/framework/infrastructure/features.md
  26. 109
      docs/en/framework/ui/blazor/global-scripts-styles.md
  27. 6
      docs/en/framework/ui/mvc-razor-pages/tag-helpers/dynamic-forms.md
  28. 34
      docs/en/get-started/layered-web-application.md
  29. 23
      docs/en/get-started/microservice.md
  30. 107
      docs/en/get-started/pre-requirements.md
  31. 31
      docs/en/get-started/single-layer-web-application.md
  32. 6
      docs/en/kb/index.md
  33. 49
      docs/en/kb/when-to-use-a-distributed-cache-server.md
  34. 28
      docs/en/release-info/migration-guides/openiddict5-to-6.md
  35. BIN
      docs/en/solution-templates/application-module/images/additional-options.png
  36. BIN
      docs/en/solution-templates/application-module/images/create-new-module.png
  37. BIN
      docs/en/solution-templates/application-module/images/issuemanagement-module-solution.png
  38. BIN
      docs/en/solution-templates/application-module/images/new-module.png
  39. BIN
      docs/en/solution-templates/application-module/images/new-solution.png
  40. BIN
      docs/en/solution-templates/application-module/images/select-database-provider.png
  41. BIN
      docs/en/solution-templates/application-module/images/select-user-interface.png
  42. BIN
      docs/en/solution-templates/application-module/images/solution-properties.png
  43. 48
      docs/en/solution-templates/application-module/index.md
  44. 2
      docs/en/solution-templates/index.md
  45. 56
      docs/en/solution-templates/layered-web-application/authentication.md
  46. 51
      docs/en/solution-templates/layered-web-application/blob-storing.md
  47. 25
      docs/en/solution-templates/layered-web-application/built-in-features.md
  48. 37
      docs/en/solution-templates/layered-web-application/cors-configuration.md
  49. 266
      docs/en/solution-templates/layered-web-application/database-configurations.md
  50. 41
      docs/en/solution-templates/layered-web-application/db-migrator.md
  51. 65
      docs/en/solution-templates/layered-web-application/helm-charts-and-kubernetes.md
  52. BIN
      docs/en/solution-templates/layered-web-application/images/account-external-provider.png
  53. BIN
      docs/en/solution-templates/layered-web-application/images/angular-folder-structure.png
  54. BIN
      docs/en/solution-templates/layered-web-application/images/angular-template-structure-diagram.png
  55. BIN
      docs/en/solution-templates/layered-web-application/images/apply-database-migrations.png
  56. BIN
      docs/en/solution-templates/layered-web-application/images/bookstore-solution-tiered.png
  57. BIN
      docs/en/solution-templates/layered-web-application/images/database-connection-strings-modal.png
  58. BIN
      docs/en/solution-templates/layered-web-application/images/database-connection-strings.png
  59. BIN
      docs/en/solution-templates/layered-web-application/images/file-management-index-page.png
  60. BIN
      docs/en/solution-templates/layered-web-application/images/helm-folder.png
  61. BIN
      docs/en/solution-templates/layered-web-application/images/kubernetes.png
  62. BIN
      docs/en/solution-templates/layered-web-application/images/layered-project-dependencies.png
  63. BIN
      docs/en/solution-templates/layered-web-application/images/layered-solution-in-explorer.png
  64. BIN
      docs/en/solution-templates/layered-web-application/images/mobile-applications.png
  65. BIN
      docs/en/solution-templates/layered-web-application/images/new-solution-openiddict-module.png
  66. BIN
      docs/en/solution-templates/layered-web-application/images/open-solution-with-explorer.png
  67. BIN
      docs/en/solution-templates/layered-web-application/images/openiddict-ui.png
  68. BIN
      docs/en/solution-templates/layered-web-application/images/run-solution.png
  69. BIN
      docs/en/solution-templates/layered-web-application/images/saas-module-selection.png
  70. BIN
      docs/en/solution-templates/layered-web-application/images/solution-folders.png
  71. BIN
      docs/en/solution-templates/layered-web-application/images/solutionrunner-maui-targetframework.png
  72. BIN
      docs/en/solution-templates/layered-web-application/images/tiered-solution-applications-authserver.png
  73. BIN
      docs/en/solution-templates/layered-web-application/images/tiered-solution-servers.png
  74. BIN
      docs/en/solution-templates/layered-web-application/images/web-applications.png
  75. 490
      docs/en/solution-templates/layered-web-application/index.md
  76. 35
      docs/en/solution-templates/layered-web-application/logging.md
  77. 21
      docs/en/solution-templates/layered-web-application/main-components.md
  78. 122
      docs/en/solution-templates/layered-web-application/mobile-applications.md
  79. 74
      docs/en/solution-templates/layered-web-application/multi-tenancy.md
  80. 108
      docs/en/solution-templates/layered-web-application/overview.md
  81. 216
      docs/en/solution-templates/layered-web-application/solution-structure.md
  82. 19
      docs/en/solution-templates/layered-web-application/swagger-integration.md
  83. 178
      docs/en/solution-templates/layered-web-application/web-applications.md
  84. 10
      docs/en/solution-templates/microservice/grpc-calls.md
  85. 4
      docs/en/solution-templates/microservice/microservices.md
  86. 59
      docs/en/solution-templates/single-layer-web-application/_index.md
  87. 52
      docs/en/solution-templates/single-layer-web-application/authentication.md
  88. 51
      docs/en/solution-templates/single-layer-web-application/blob-storing.md
  89. 25
      docs/en/solution-templates/single-layer-web-application/built-in-features.md
  90. 32
      docs/en/solution-templates/single-layer-web-application/cors-configuration.md
  91. 190
      docs/en/solution-templates/single-layer-web-application/database-configurations.md
  92. 107
      docs/en/solution-templates/single-layer-web-application/db-migrator.md
  93. BIN
      docs/en/solution-templates/single-layer-web-application/images/account-external-provider.png
  94. BIN
      docs/en/solution-templates/single-layer-web-application/images/apply-database-migrations.png
  95. BIN
      docs/en/solution-templates/single-layer-web-application/images/database-connection-strings-modal.png
  96. BIN
      docs/en/solution-templates/single-layer-web-application/images/database-connection-strings.png
  97. BIN
      docs/en/solution-templates/single-layer-web-application/images/file-management-index-page.png
  98. BIN
      docs/en/solution-templates/single-layer-web-application/images/new-solution-openiddict-module.png
  99. BIN
      docs/en/solution-templates/single-layer-web-application/images/openiddict-ui.png
  100. BIN
      docs/en/solution-templates/single-layer-web-application/images/saas-module-selection.png

135
Directory.Packages.props

@ -13,8 +13,8 @@
<PackageVersion Include="AutoMapper" Version="13.0.1" /> <PackageVersion Include="AutoMapper" Version="13.0.1" />
<PackageVersion Include="Asp.Versioning.Mvc" Version="8.1.0" /> <PackageVersion Include="Asp.Versioning.Mvc" Version="8.1.0" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" /> <PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
<PackageVersion Include="AWSSDK.S3" Version="3.7.400.30" /> <PackageVersion Include="AWSSDK.S3" Version="3.7.410.9" />
<PackageVersion Include="AWSSDK.SecurityToken" Version="3.7.400.30" /> <PackageVersion Include="AWSSDK.SecurityToken" Version="3.7.401.16" />
<PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.18.1" /> <PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.18.1" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.22.1" /> <PackageVersion Include="Azure.Storage.Blobs" Version="12.22.1" />
<PackageVersion Include="Blazorise" Version="1.6.2" /> <PackageVersion Include="Blazorise" Version="1.6.2" />
@ -51,64 +51,65 @@
<PackageVersion Include="Magick.NET-Q16-AnyCPU" Version="13.4.0" /> <PackageVersion Include="Magick.NET-Q16-AnyCPU" Version="13.4.0" />
<PackageVersion Include="MailKit" Version="4.8.0" /> <PackageVersion Include="MailKit" Version="4.8.0" />
<PackageVersion Include="Markdig.Signed" Version="0.37.0" /> <PackageVersion Include="Markdig.Signed" Version="0.37.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authorization" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Authorization" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Components" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.33" /> <PackageVersion Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.33" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.WebUtilities" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.AspNetCore.WebUtilities" Version="9.0.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" /> <PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" /> <PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Proxies" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.Proxies" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="9.0.0-preview.7.24406.2" /> <PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="9.0.0-preview.7.24406.2" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Composite" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.FileProviders.Composite" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Localization" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Localization" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0.0" /> <PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> <PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.1.0" /> <PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.1.0" /> <PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.3.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.1.0" /> <PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.3.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.3.0" />
<PackageVersion Include="Minio" Version="6.0.3" /> <PackageVersion Include="Minio" Version="6.0.3" />
<PackageVersion Include="MongoDB.Driver" Version="2.29.0" /> <PackageVersion Include="MongoDB.Driver" Version="2.29.0" />
<PackageVersion Include="NEST" Version="7.17.5" /> <PackageVersion Include="NEST" Version="7.17.5" />
@ -120,15 +121,15 @@
<PackageVersion Include="NUglify" Version="1.21.9" /> <PackageVersion Include="NUglify" Version="1.21.9" />
<PackageVersion Include="Nullable" Version="1.3.1" /> <PackageVersion Include="Nullable" Version="1.3.1" />
<PackageVersion Include="Octokit" Version="13.0.1" /> <PackageVersion Include="Octokit" Version="13.0.1" />
<PackageVersion Include="OpenIddict.Abstractions" Version="5.8.0" /> <PackageVersion Include="OpenIddict.Abstractions" Version="6.0.0" />
<PackageVersion Include="OpenIddict.Core" Version="5.8.0" /> <PackageVersion Include="OpenIddict.Core" Version="6.0.0" />
<PackageVersion Include="OpenIddict.Server.AspNetCore" Version="5.8.0" /> <PackageVersion Include="OpenIddict.Server.AspNetCore" Version="6.0.0" />
<PackageVersion Include="OpenIddict.Validation.AspNetCore" Version="5.8.0" /> <PackageVersion Include="OpenIddict.Validation.AspNetCore" Version="6.0.0" />
<PackageVersion Include="OpenIddict.Validation.ServerIntegration" Version="5.8.0" /> <PackageVersion Include="OpenIddict.Validation.ServerIntegration" Version="6.0.0" />
<PackageVersion Include="Oracle.EntityFrameworkCore" Version="9.23.60" /> <PackageVersion Include="Oracle.EntityFrameworkCore" Version="9.23.60" />
<PackageVersion Include="Polly" Version="8.4.2" /> <PackageVersion Include="Polly" Version="8.4.2" />
<PackageVersion Include="Polly.Extensions.Http" Version="3.0.0" /> <PackageVersion Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.1" /> <PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.2.efcore.9.0.0" />
<PackageVersion Include="Quartz" Version="3.13.0" /> <PackageVersion Include="Quartz" Version="3.13.0" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.13.0" /> <PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.13.0" />
<PackageVersion Include="Quartz.Plugins.TimeZoneConverter" Version="3.13.0" /> <PackageVersion Include="Quartz.Plugins.TimeZoneConverter" Version="3.13.0" />
@ -155,19 +156,19 @@
<PackageVersion Include="Spectre.Console" Version="0.49.1" /> <PackageVersion Include="Spectre.Console" Version="0.49.1" />
<PackageVersion Include="StackExchange.Redis" Version="2.8.16" /> <PackageVersion Include="StackExchange.Redis" Version="2.8.16" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.8.1" /> <PackageVersion Include="Swashbuckle.AspNetCore" Version="6.8.1" />
<PackageVersion Include="System.Collections.Immutable" Version="9.0.0.0" /> <PackageVersion Include="System.Collections.Immutable" Version="9.0.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" /> <PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Linq.Dynamic.Core" Version="1.4.5" /> <PackageVersion Include="System.Linq.Dynamic.Core" Version="1.4.5" />
<PackageVersion Include="System.Linq.Queryable" Version="4.3.0" /> <PackageVersion Include="System.Linq.Queryable" Version="4.3.0" />
<PackageVersion Include="System.Runtime.Loader" Version="4.3.0" /> <PackageVersion Include="System.Runtime.Loader" Version="4.3.0" />
<PackageVersion Include="System.Security.Permissions" Version="9.0.0.0" /> <PackageVersion Include="System.Security.Permissions" Version="9.0.0" />
<PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" /> <PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.0.0" /> <PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.0" />
<PackageVersion Include="System.Text.Encodings.Web" Version="9.0.0.0" /> <PackageVersion Include="System.Text.Encodings.Web" Version="9.0.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.0.0" /> <PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" /> <PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.1.0" /> <PackageVersion Include="TencentCloudSDK.Sms" Version="3.0.1142" />
<PackageVersion Include="TimeZoneConverter" Version="6.1.0" /> <PackageVersion Include="TimeZoneConverter" Version="6.1.0" />
<PackageVersion Include="Unidecode.NET" Version="2.1.0" /> <PackageVersion Include="Unidecode.NET" Version="2.1.0" />
<PackageVersion Include="xunit" Version="2.9.2" /> <PackageVersion Include="xunit" Version="2.9.2" />
@ -177,4 +178,4 @@
<PackageVersion Include="ConfigureAwait.Fody" Version="3.3.2" /> <PackageVersion Include="ConfigureAwait.Fody" Version="3.3.2" />
<PackageVersion Include="Fody" Version="6.8.2" /> <PackageVersion Include="Fody" Version="6.8.2" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
README.md

@ -1,7 +1,7 @@
# ABP Framework # ABP Framework
![build and test](https://img.shields.io/github/actions/workflow/status/abpframework/abp/build-and-test.yml?branch=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 (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://abp.io/docs/latest/release-info/nightly-builds) 🔹 ![build and test](https://img.shields.io/github/actions/workflow/status/abpframework/abp/build-and-test.yml?branch=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 (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://abp.io/docs/latest/release-info/nightly-builds) 🔹
[![NuGet Download](https://img.shields.io/nuget/dt/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) 🔹 [![Code of Conduct](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](https://github.com/abpframework/abp/blob/dev/CODE_OF_CONDUCT.md) 🔹 [![CLA Signed](https://cla-assistant.io/readme/badge/abpframework/abp)](https://cla-assistant.io/abpframework/abp) 🔹 [![Discord Shield](https://discord.com/api/guilds/951497912645476422/widget.png?style=shield)](https://discord.gg/abp) [![NuGet Download](https://img.shields.io/nuget/dt/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) 🔹 [![Code of Conduct](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](https://github.com/abpframework/abp/blob/dev/CODE_OF_CONDUCT.md) 🔹 [![CLA Signed](https://cla-assistant.io/readme/badge/abpframework/abp)](https://cla-assistant.io/abpframework/abp) 🔹 [![Discord Shield](https://discord.com/api/guilds/951497912645476422/widget.png?style=shield)](https://abp.io/join-discord)
[ABP](https://abp.io/) offers an **opinionated architecture** to build enterprise software solutions with **best practices** on top of the **.NET** and the **ASP.NET Core** platforms. It provides the fundamental infrastructure, production-ready startup templates, pre-built application modules, UI themes, tooling, guides and documentation to implement that architecture properly and **automate the details** and repetitive works as much as possible. [ABP](https://abp.io/) offers an **opinionated architecture** to build enterprise software solutions with **best practices** on top of the **.NET** and the **ASP.NET Core** platforms. It provides the fundamental infrastructure, production-ready startup templates, pre-built application modules, UI themes, tooling, guides and documentation to implement that architecture properly and **automate the details** and repetitive works as much as possible.
@ -121,4 +121,4 @@ GitHub repository stars are an important indicator of popularity and the size of
## Discord Server ## Discord Server
We have a Discord server where you can chat with other ABP users. Share your ideas, report technical issues, showcase your creations, share the tips that worked for you and catch up with the latest news and announcements about ABP Framework. Join 👉 https://discord.gg/abp. We have a Discord server where you can chat with other ABP users. Share your ideas, report technical issues, showcase your creations, share the tips that worked for you and catch up with the latest news and announcements about ABP Framework. Join 👉 https://abp.io/join-discord.

2
docs/en/Blog-Posts/2022-05-09 v5_3_Preview/POST.md

@ -255,4 +255,4 @@ We've created an official ABP Discord server so the ABP Community can interact w
Thanks to the ABP Community, **700+** people joined our Discord Server so far and it grows every day. Thanks to the ABP Community, **700+** people joined our Discord Server so far and it grows every day.
You can join our Discord Server from [here](https://discord.gg/abp), if you haven't yet. You can join our Discord Server from [here](https://abp.io/join-discord), if you haven't yet.

67
docs/en/Blog-Posts/2024-12-15-ABP-Studio-R2R/POST.md

@ -0,0 +1,67 @@
# ABP Studio Goes AOT: Faster Startups with Ready-to-Run (R2R) Publishing
We're excited that [ABP Studio](https://abp.io/studio) now supports [Ready-to-Run (R2R) publishing](https://learn.microsoft.com/en-us/dotnet/core/deploying/ready-to-run) (starting from v0.9.16+), a hybrid form of ahead-of-time (AOT) compilation. This enhancement significantly improves the startup time and overall performance of ABP Studio, making it faster and more performant than ever before.
Let's dive into what R2R publishing is, how it works, and the benefits it brings to ABP Studio.
## What is Ready-to-Run (R2R) Publishing?
Ready-to-Run (R2R) is a form of AOT compilation available in the .NET ecosystem. Unlike traditional just-in-time (JIT) compilation, R2R precompiles parts of your application to native code before deployment. This precompiled code helps reduce the startup time by minimizing the work needed during runtime.
However, R2R isn't a complete AOT compilation. Instead, it's a hybrid approach because it stores both:
* **Native code for precompiled methods** (to improve startup time and performance)
* **Intermediate Language (IL) code** for methods that may need further JIT compilation
This hybrid nature is why R2R binaries are typically larger. For ABP Studio, the storage size increased by ~150 MB with R2R enabled, but the trade-off is well worth it for the performance and startup-time gains.
## How R2R (Ready-to-Run) Improves ABP Studio
### Faster Startup Time 🚀
One of the biggest advantages of R2R publishing is its impact on startup times. In our local tests, enabling R2R resulted in startup times being **reduced by 2.5x** ⬇️.
This means you can get to work faster, without waiting for the application to being startup from the beginning. Whether you're launching ABP Studio to manage projects, generate code, or deploy applications, the improved responsiveness is noticeable.
### Performance Enhancements 📈
In addition to faster startups, R2R publishing contributes to overall performance improvements. By precompiling frequently used methods, R2R reduces the workload on the JIT compiler during execution, leading to smoother and more efficient operations.
### Trade-offs: Increased Storage Size 🆙
With great performance comes a slight trade-off: storage size. R2R binaries include both **native** and **IL code**, which increases the file size. In the case of ABP Studio, the storage footprint increased by ~150 MB. However, the substantial improvements in speed and responsiveness make this a worthwhile investment.
## How to Enable R2R Publishing in Your Applications?
If you're developing applications and want to benefit from R2R, here's a quick guide on how to enable it in your .NET projects:
1. You can add the following configuration to your final project's `.csproj` file:
```xml
<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
```
2. Then, publish your application with the `dotnet publish` command:
```bash
dotnet publish -c Release
```
Alternatively, you can specify the _PublishReadyToRun_ flag directly to the `dotnet publish` command as follows:
```bash
dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=true
```
That's it! Your application will now include precompiled native code for faster startup and great performance benefits.
> Please refer to the [official documentation](https://learn.microsoft.com/en-us/dotnet/core/deploying/ready-to-run) before publishing your application with R2R.
## Conclusion
As ABP team, we're always looking for ways to improve the developer experience. By adopting **Ready-to-Run (R2R) publishing** for ABP Studio, we're aiming to deliver a faster and more efficient tool for your development needs.
Stay tuned for more updates and enhancements as we continue to optimize ABP Studio and please provide us with your invaluable feedback.

4
docs/en/Community-Articles/2022-09-15-Grpc-Demo/POST.md

@ -240,3 +240,7 @@ gRPC on .NET has different approaches, features, configurations and more details
* You can find the completed source code here: https://github.com/abpframework/abp-samples/tree/master/GrpcDemo2 * You can find the completed source code here: https://github.com/abpframework/abp-samples/tree/master/GrpcDemo2
* You can also see all the changes I've done in this article here: https://github.com/abpframework/abp-samples/pull/200/files * You can also see all the changes I've done in this article here: https://github.com/abpframework/abp-samples/pull/200/files
## See Also
* [Consuming gRPC Services from Blazor WebAssembly Application Using gRPC-Web](https://abp.io/community/articles/consuming-grpc-services-from-blazor-webassembly-application-using-grpcweb-dqjry3rv)

16
docs/en/Community-Articles/2024-01-18-ABP-Now-Supports-Keyed-Services/POST.md

@ -187,11 +187,21 @@ On the other hand, resolving keyed services from `LazyServiceProvider` is not su
### Automatically Registering Keyed Services ### Automatically Registering Keyed Services
Currently, if you want to register a keyed service, you need to do it manually as we see in the previous sections by using one of the overloads (`.AddKeyedTransient`, `.AddKeyedScoped` and `.AddKeyedSingleton`). ABP provides the `ExposeKeyedServiceAttribute` to control which keyed services are provided by the related class.
It would be good if we could make this process automatically and not need to manually register services, and for that purpose, I have [created an issue](https://github.com/abpframework/abp/issues/18794) that aims to introduce an attribute, which allows us to automatically register multiple services as keyed services. For example, if you want to register a keyed service as a transient dependency, you can do it as follows:
You can [follow the issue](https://github.com/abpframework/abp/issues/18794) if you are considering using keyed services in your application and don't want to register them manually. ```csharp
[ExposeKeyedService<ITaxCalculator>("taxCalculator")]
[ExposeKeyedService<ICalculator>("calculator")]
public class TaxCalculator: ICalculator, ITaxCalculator, ICanCalculate, ITransientDependency
{
}
```
> Notice that the ExposeKeyedServiceAttribute only exposes the keyed services. So, you can not inject the ITaxCalculator or ICalculator interfaces in your application without using the FromKeyedServicesAttribute as shown in the example above. If you want to expose both keyed and non-keyed services, you can use the ExposeServicesAttribute and ExposeKeyedServiceAttribute attributes altogether.
Please refer to the [Dependency Injection document](https://abp.io/docs/latest/framework/fundamentals/dependency-injection#exposekeyedservice-attribute) for further info.
## Summary ## Summary

309
docs/en/Community-Articles/2024-11-25-Global-Assets/POST.md

@ -0,0 +1,309 @@
# ABP Global Assets - New way to bundle JavaScript/CSS files in Blazor WebAssembly app
We have introduced a new feature in the ABP framework to bundle the `JavaScript/CSS` files in the Blazor wasm app. This feature is called `Global Assets`.
With this feature, you don't need to run the `abp bundle` command to manually create/maintain the `global.js` and `global.css` files in your Blazor wasm app.
## How Global Assets works?
The new `Blazor wasm app` has two projects:
1. `MyProjectName` (ASP.NET Core app)
2. `MyProjectName.Client` (Blazor wasm app)
The `MyProjectName` reference the `MyProjectName.Client` project, and will be the entry point of the application, which means the `MyProjectName` project will be the `host` project of the `MyProjectName.Client` project.
The static/virtual files of `MyProjectName` can be accessed by the `MyProjectName.Client` project, so we can create dynamic global assets in the `MyProjectName` project and use them in the `MyProjectName.Client` project.
## How it works in ABP?
We have created a new package `WebAssembly.Theme.Bundling` for the theme `WebAssembly` module and used the `Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleContributor` to add `JavaScript/CSS` files to the bundling system.
* LeptonXLiteTheme: `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule`
* LeptonXTheme: `AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule`
* LeptonTheme: `AbpAspNetCoreComponentsWebAssemblyLeptonThemeBundlingModule`
* BasicTheme: `AbpAspNetCoreComponentsWebAssemblyBasicThemeBundlingModule`
The new `ThemeBundlingModule` only depends on `AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule(new package)`. It's an `abstractions module`, which only depends on `AbpAspNetCoreMvcUiBundlingAbstractionsModule`.
We will get all `JavaScript/CSS` files on `OnApplicationInitializationAsync` method of `AbpAspNetCoreMvcUiBundlingModule` from bundling system and add them to `IDynamicFileProvider` service. After that, we can access the `JavaScript/CSS` files in the Blazor wasm app.
## Add the Global Assets in the module
If your module has `JavaScript/CSS` files that need to the bundling system, You have to create a new project(`YourModuleName.Blazor.WebAssembly.Bundling`) to your module solution, and reference the new project in the `MyProjectName` project and module dependencies.
The new project should **only** depend on the `AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule` and define `BundleContributor` classes to contribute the `JavaScript/CSS` files.
> Q: The new project(`YourModuleName.Blazor.WebAssembly.Bundling`) doesn't have the `libs/myscript.js` and `libs/myscript.css` files why the files can be added to the bundling system?
> A: Because the `MyProjectName.Client` will depend on the `MyBlazorModule(YourModuleName.Blazor)` that contains the `JavaScript/CSS` files, The `MyProjectName` is referencing the `MyProjectName.Client` project, so the `MyProjectName` project can access the `JavaScript/CSS` files in the `MyProjectName.Client` project and add them to the bundling system.
```csharp
[DependsOn(
typeof(AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule)
)]
public class MyBlazorWebAssemblyBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBundlingOptions>(options =>
{
// Script Bundles
options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global).AddContributors(typeof(MyModuleBundleScriptContributor));
// Style Bundles
options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global).AddContributors(typeof(MyModuleBundleStyleBundleContributor));
});
}
}
```
```csharp
public class MyModuleBundleScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/MyModule.Blazor/libs/myscript.js");
}
}
public class MyModuleBundleStyleBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/MyModule.Blazor/libs/myscript.css");
}
}
```
## Use the Global Assets in the Blazor WASM
### MyCompanyName.MyProjectName.Blazor
Convert your `MyCompanyName.MyProjectName.Blazor` project to integrate the `ABP module` system and depend on the `AbpAspNetCoreMvcUiBundlingModule` and `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule/AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule`:
* The `AbpAspNetCoreMvcUiBundlingModule` uses to create the `JavaScript/CSS` files to virtual files.
* The `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule/AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule` uses to add theme `JavaScript/CSS` to the bundling system.
Here is how your project files look like:
**`Program.cs`:**
```csharp
public class Program
{
public async static Task<int> Main(string[] args)
{
//...
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<MyProjectNameBlazorModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
//...
}
}
```
**`MyProjectNameBlazorModule.cs`:**
```csharp
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAspNetCoreMvcUiBundlingModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule/AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule) //Should be added!
)]
public class MyProjectNameBlazorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//https://github.com/dotnet/aspnetcore/issues/52530
Configure<RouteOptions>(options =>
{
options.SuppressCheckForUnhandledSecurityMetadata = true;
});
// Add services to the container.
context.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
// Configure the HTTP request pipeline.
if (env.IsDevelopment())
{
app.UseWebAssemblyDebugging();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.MapAbpStaticAssets();
app.UseRouting();
app.UseAntiforgery();
app.UseConfiguredEndpoints(builder =>
{
builder.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(WebAppAdditionalAssembliesHelper.GetAssemblies<MyProjectNameBlazorClientModule>());
});
}
}
```
**`MyCompanyName.MyProjectName.Blazor.csproj`:**
```xml
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="9.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Bundling" Version="9.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling" Version="9.0.0" />
<!-- <PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme.Bundling" Version="9.0.0" /> --> if you're using LeptonXTheme
<ProjectReference Include="..\MyProjectName.Blazor.Client\MyProjectName.Blazor.Client.csproj" />
</ItemGroup>
```
### BlazorWebAssemblyBundlingModule in the ABP commercial
Here is the list of `Bundling Modules` in the ABP commercial. If you're using the pro template, you should add them to the `MyCompanyName.MyProjectName.Blazor` project.
| BundlingModules | Nuget Package |
|---------------------------------------------|-----------------------------------------------------|
| AbpAuditLoggingBlazorWebAssemblyBundlingModule | Volo.Abp.AuditLogging.Blazor.WebAssembly.Bundling |
| FileManagementBlazorWebAssemblyBundlingModule | Volo.FileManagement.Blazor.WebAssembly.Bundling |
| SaasHostBlazorWebAssemblyBundlingModule | Volo.Saas.Host.Blazor.WebAssembly.Bundling |
| ChatBlazorWebAssemblyBundlingModule | Volo.Chat.Blazor.WebAssembly.Bundling |
| CmsKitProAdminBlazorWebAssemblyBundlingModule | Volo.CmsKit.Pro.Admin.Blazor.WebAssembly.Bundling |
### MyCompanyName.MyProjectName.Blazor.Client
1. Remove the `global.JavaScript/CSS` files from the `MyCompanyName.MyProjectName.Blazor`'s `wwwroot` folder.
2. Remove the `AbpCli:Bundle` section from the `appsettings.json` file.
3. Remove all BundleContributor classes that inherit from IBundleContributor. Then, create `MyProjectNameStyleBundleContributor` and `MyProjectNameScriptBundleContributor` classes to add your style and JavaScript files. Finally, add them to `AbpBundlingOptions`.
```cs
public class MyProjectNameStyleBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add(new BundleFile("main.css", true));
}
}
public class MyProjectNameScriptBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add(new BundleFile("main.js", true));
}
}
```
```cs
Configure<AbpBundlingOptions>(options =>
{
var globalStyles = options.StyleBundles.Get(BlazorWebAssemblyStandardBundles.Styles.Global);
globalStyles.AddContributors(typeof(MyProjectNameStyleBundleContributor));
var globalScripts = options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global);
globalScripts.AddContributors(typeof(MyProjectNameScriptBundleContributor));
});
```
## Use the Global Assets in the Blazor WebApp
### MyCompanyName.MyProjectName.Blazor.WebApp
Depending on the `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule/AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule` in your `MyCompanyName.MyProjectName.Blazor.WebApp` project.
* The `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule/AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule` uses to add theme `JavaScript/CSS` to the bundling system.
### BlazorWebAssemblyBundlingModule in the ABP commercial
Here is the list of `Bundling Modules` in the ABP commercial. If you're using the pro template, you should add them to the `MyCompanyName.MyProjectName.Blazor.WebApp` project.
| BundlingModules | Nuget Package |
|---------------------------------------------|-----------------------------------------------------|
| AbpAuditLoggingBlazorWebAssemblyBundlingModule | Volo.Abp.AuditLogging.Blazor.WebAssembly.Bundling |
| FileManagementBlazorWebAssemblyBundlingModule | Volo.FileManagement.Blazor.WebAssembly.Bundling |
| SaasHostBlazorWebAssemblyBundlingModule | Volo.Saas.Host.Blazor.WebAssembly.Bundling |
| ChatBlazorWebAssemblyBundlingModule | Volo.Chat.Blazor.WebAssembly.Bundling |
| CmsKitProAdminBlazorWebAssemblyBundlingModule | Volo.CmsKit.Pro.Admin.Blazor.WebAssembly.Bundling |
### MyCompanyName.MyProjectName.Blazor.WebApp.Client
1. Remove the `global.JavaScript/CSS` files from the `MyCompanyName.MyProjectName.Blazor.WebApp.Client`'s `wwwroot` folder.
2. Remove the `AbpCli:Bundle` section from the `appsettings.json` file.
3. Remove all BundleContributor classes that inherit from IBundleContributor. Then, create `MyProjectNameStyleBundleContributor` and `MyProjectNameScriptBundleContributor` classes to add your style and JavaScript files. Finally, add them to `AbpBundlingOptions`.
```cs
public class MyProjectNameStyleBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add(new BundleFile("main.css", true));
}
}
public class MyProjectNameScriptBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add(new BundleFile("main.js", true));
}
}
```
```cs
Configure<AbpBundlingOptions>(options =>
{
var globalStyles = options.StyleBundles.Get(BlazorWebAssemblyStandardBundles.Styles.Global);
globalStyles.AddContributors(typeof(MyProjectNameStyleBundleContributor));
var globalScripts = options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global);
globalScripts.AddContributors(typeof(MyProjectNameScriptBundleContributor));
});
```
### Check the Global Assets
Run the `MyProject` project and check the `https://localhost/global.js` and `https://localhost/global.css` files. You should be able to see the `JavaScript/CSS` files content from the Bundling system:
![global](image.png)
## GlobalAssets(AbpBundlingGlobalAssetsOptions)
You can configure the JavaScript and CSS file names in the `GlobalAssets` property of the `AbpBundlingOptions` class.
The default values are `global.js` and `global.css`.
## Conclusion
With the new `Global Assets` feature, you can easily bundle the `JavaScript/CSS` files in the Blazor wasm app. This feature is very useful for the Blazor wasm app, and it will save you a lot of time and effort. We hope you will enjoy this feature and use it in your projects.
## References
* [Virtual Files](https://docs.abp.io/en/abp/latest/Virtual-Files)
* [Bundle Contributors](https://abp.io/docs/latest/framework/ui/mvc-razor-pages/bundling-minification#bundle-contributors)
* [Global Assets Pull Request](https://github.com/abpframework/abp/pull/19968)

BIN
docs/en/Community-Articles/2024-11-25-Global-Assets/image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

2
docs/en/cli/index.md

@ -112,7 +112,7 @@ abp cli clear-cache
### new ### new
Generates a new solution based on the ABP [startup templates](../solution-templates). Generates a new solution based on the ABP [startup templates](../solution-templates). See [new solution create sample commands](new-command-samples.md)
Usage: Usage:

2
docs/en/cli/new-command-samples.md

@ -21,7 +21,7 @@ The following commands are for creating Angular UI projects:
* **Entity Framework Core**, **custom connection string**, creates the project in a new folder: * **Entity Framework Core**, **custom connection string**, creates the project in a new folder:
```bash ```bash
abp new Acme.BookStore -u angular -csf --connection-string Server=localhost;Database=MyDatabase;Trusted_Connection=True abp new Acme.BookStore -u angular -csf --connection-string "Server=localhost;Database=MyDatabase;Trusted_Connection=True"
``` ```
* **MongoDB**, default app template, mobile project included, creates solution in `C:\MyProjects\Acme.BookStore` * **MongoDB**, default app template, mobile project included, creates solution in `C:\MyProjects\Acme.BookStore`

458
docs/en/docs-nav.json

@ -5,7 +5,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "get-started" "path": "get-started",
"isIndex": true
}, },
{ {
"text": "Single Layer Web Application", "text": "Single Layer Web Application",
@ -39,6 +40,10 @@
"path": "get-started/console.md" "path": "get-started/console.md"
} }
] ]
},
{
"text": "Pre-Requirements",
"path": "get-started/pre-requirements.md"
} }
] ]
}, },
@ -47,14 +52,18 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "tutorials" "path": "tutorials",
"isIndex": true
}, },
{ {
"text": "TODO Application", "text": "TODO Application",
"isLazyExpandable": true,
"path": "tutorials/todo",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "tutorials/todo" "path": "tutorials/todo",
"isIndex": true
}, },
{ {
"text": "Single-Layer Solution", "text": "Single-Layer Solution",
@ -68,10 +77,13 @@
}, },
{ {
"text": "Book Store Application", "text": "Book Store Application",
"isLazyExpandable": true,
"path": "tutorials/book-store",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "tutorials/book-store" "path": "tutorials/book-store",
"isIndex": true
}, },
{ {
"text": "1: Creating the Server Side", "text": "1: Creating the Server Side",
@ -120,7 +132,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "tutorials/book-store-with-abp-suite" "path": "tutorials/book-store-with-abp-suite",
"isIndex": true
}, },
{ {
"text": "1: Creating the Solution", "text": "1: Creating the Solution",
@ -146,10 +159,13 @@
}, },
{ {
"text": "Modular Monolith Application", "text": "Modular Monolith Application",
"isLazyExpandable": true,
"path": "tutorials/modular-crm/index.md",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "tutorials/modular-crm/index.md" "path": "tutorials/modular-crm/index.md",
"isIndex": true
}, },
{ {
"text": "1: Creating the Initial Solution", "text": "1: Creating the Initial Solution",
@ -190,7 +206,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "tutorials/microservice/index.md" "path": "tutorials/microservice/index.md",
"isIndex": true
}, },
{ {
"text": "1: Creating the initial solution", "text": "1: Creating the initial solution",
@ -222,6 +239,23 @@
} }
] ]
}, },
{
"text": "Mobile Application Development",
"items": [
{
"text": "Overview",
"path": "tutorials/mobile/index.md"
},
{
"text": "MAUI",
"path": "tutorials/mobile/maui/index.md"
},
{
"text": "React Native",
"path": "tutorials/mobile/react-native/index.md"
}
]
},
{ {
"text": "Community Articles", "text": "Community Articles",
"path": "https://abp.io/community" "path": "https://abp.io/community"
@ -233,14 +267,16 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "tools.md" "path": "tools.md",
"isIndex": true
}, },
{ {
"text": "ABP CLI", "text": "ABP CLI",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "cli" "path": "cli",
"isIndex": true
}, },
{ {
"text": "New Solution Sample Commands", "text": "New Solution Sample Commands",
@ -253,7 +289,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "studio" "path": "studio",
"isIndex": true
}, },
{ {
"text": "Installation", "text": "Installation",
@ -264,7 +301,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "studio/overview.md" "path": "studio/overview.md",
"isIndex": true
}, },
{ {
"text": "Solution Explorer", "text": "Solution Explorer",
@ -307,7 +345,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "suite" "path": "suite",
"isIndex": true
}, },
{ {
"text": "How to Install", "text": "How to Install",
@ -330,7 +369,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "suite/generating-crud-page.md" "path": "suite/generating-crud-page.md",
"isIndex": true
}, },
{ {
"text": "Creating Many-To-Many Relationship", "text": "Creating Many-To-Many Relationship",
@ -382,7 +422,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/fundamentals" "path": "framework/fundamentals",
"isIndex": true
}, },
{ {
"text": "Application Startup", "text": "Application Startup",
@ -393,7 +434,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/fundamentals/authorization.md" "path": "framework/fundamentals/authorization.md",
"isIndex": true
}, },
{ {
"text": "Dynamic Claims", "text": "Dynamic Claims",
@ -406,7 +448,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/fundamentals/caching.md" "path": "framework/fundamentals/caching.md",
"isIndex": true
}, },
{ {
"text": "Redis Cache", "text": "Redis Cache",
@ -427,7 +470,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/fundamentals/dependency-injection.md" "path": "framework/fundamentals/dependency-injection.md",
"isIndex": true
}, },
{ {
"text": "AutoFac Integration", "text": "AutoFac Integration",
@ -460,7 +504,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/fundamentals/validation.md" "path": "framework/fundamentals/validation.md",
"isIndex": true
}, },
{ {
"text": "FluentValidation Integration", "text": "FluentValidation Integration",
@ -475,7 +520,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure" "path": "framework/infrastructure",
"isIndex": true
}, },
{ {
"text": "Audit Logging", "text": "Audit Logging",
@ -486,7 +532,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure/background-jobs" "path": "framework/infrastructure/background-jobs",
"isIndex": true
}, },
{ {
"text": "Hangfire Integration", "text": "Hangfire Integration",
@ -507,7 +554,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure/background-workers" "path": "framework/infrastructure/background-workers",
"isIndex": true
}, },
{ {
"text": "Quartz Integration", "text": "Quartz Integration",
@ -524,7 +572,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure/blob-storing" "path": "framework/infrastructure/blob-storing",
"isIndex": true
}, },
{ {
"text": "Storage Providers", "text": "Storage Providers",
@ -598,7 +647,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure/emailing.md" "path": "framework/infrastructure/emailing.md",
"isIndex": true
}, },
{ {
"text": "MailKit Integration", "text": "MailKit Integration",
@ -615,7 +665,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure/event-bus" "path": "framework/infrastructure/event-bus",
"isIndex": true
}, },
{ {
"text": "Local Event Bus", "text": "Local Event Bus",
@ -626,7 +677,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure/event-bus/distributed" "path": "framework/infrastructure/event-bus/distributed",
"isIndex": true
}, },
{ {
"text": "Azure Service Bus Integration", "text": "Azure Service Bus Integration",
@ -693,7 +745,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/infrastructure/text-templating" "path": "framework/infrastructure/text-templating",
"isIndex": true
}, },
{ {
"text": "Razor Integration", "text": "Razor Integration",
@ -720,14 +773,16 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture" "path": "framework/architecture",
"isIndex": true
}, },
{ {
"text": "Module Development Best Practices", "text": "Module Development Best Practices",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/best-practices" "path": "framework/architecture/best-practices",
"isIndex": true
}, },
{ {
"text": "Module Architecture", "text": "Module Architecture",
@ -738,7 +793,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/best-practices/domain-layer-overview.md" "path": "framework/architecture/best-practices/domain-layer-overview.md",
"isIndex": true
}, },
{ {
"text": "Entities", "text": "Entities",
@ -759,7 +815,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/best-practices/application-layer-overview.md" "path": "framework/architecture/best-practices/application-layer-overview.md",
"isIndex": true
}, },
{ {
"text": "Application Services", "text": "Application Services",
@ -776,7 +833,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/best-practices/data-access-overview.md" "path": "framework/architecture/best-practices/data-access-overview.md",
"isIndex": true
}, },
{ {
"text": "Entity Framework Core Integration", "text": "Entity Framework Core Integration",
@ -795,7 +853,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/modularity/basics.md" "path": "framework/architecture/modularity/basics.md",
"isIndex": true
}, },
{ {
"text": "Plug-In Modules", "text": "Plug-In Modules",
@ -806,7 +865,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/modularity/extending/customizing-application-modules-guide.md" "path": "framework/architecture/modularity/extending/customizing-application-modules-guide.md",
"isIndex": true
}, },
{ {
"text": "Module Entity Extension System", "text": "Module Entity Extension System",
@ -829,14 +889,16 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/domain-driven-design" "path": "framework/architecture/domain-driven-design",
"isIndex": true
}, },
{ {
"text": "Domain Layer", "text": "Domain Layer",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/domain-driven-design/domain-layer.md" "path": "framework/architecture/domain-driven-design/domain-layer.md",
"isIndex": true
}, },
{ {
"text": "Entities & Aggregate Roots", "text": "Entities & Aggregate Roots",
@ -865,7 +927,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/architecture/domain-driven-design/application-layer.md" "path": "framework/architecture/domain-driven-design/application-layer.md",
"isIndex": true
}, },
{ {
"text": "Application Services", "text": "Application Services",
@ -894,6 +957,74 @@
{ {
"text": "Microservices", "text": "Microservices",
"path": "framework/architecture/microservices" "path": "framework/architecture/microservices"
},
{
"text": "Module Development Best Practices",
"items": [
{
"text": "Overview",
"path": "framework/architecture/best-practices"
},
{
"text": "Module Architecture",
"path": "framework/architecture/best-practices/module-architecture.md"
},
{
"text": "Domain Layer",
"items": [
{
"text": "Overview",
"path": "framework/architecture/best-practices/domain-layer-overview.md"
},
{
"text": "Entities",
"path": "framework/architecture/best-practices/entities.md"
},
{
"text": "Repositories",
"path": "framework/architecture/best-practices/repositories.md"
},
{
"text": "Domain Services",
"path": "framework/architecture/best-practices/domain-services.md"
}
]
},
{
"text": "Application Layer",
"items": [
{
"text": "Overview",
"path": "framework/architecture/best-practices/application-layer-overview.md"
},
{
"text": "Application Services",
"path": "framework/architecture/best-practices/application-services.md"
},
{
"text": "Data Transfer Objects",
"path": "framework/architecture/best-practices/data-transfer-objects.md"
}
]
},
{
"text": "Data Access",
"items": [
{
"text": "Overview",
"path": "framework/architecture/best-practices/data-access-overview.md"
},
{
"text": "Entity Framework Core Integration",
"path": "framework/architecture/best-practices/entity-framework-core-integration.md"
},
{
"text": "MongoDB Integration",
"path": "framework/architecture/best-practices/mongodb-integration.md"
}
]
}
]
} }
] ]
}, },
@ -902,14 +1033,16 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/api-development" "path": "framework/api-development",
"isIndex": true
}, },
{ {
"text": "ABP Endpoints", "text": "ABP Endpoints",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/api-development/standard-apis" "path": "framework/api-development/standard-apis",
"isIndex": true
}, },
{ {
"text": "Application Configuration", "text": "Application Configuration",
@ -952,14 +1085,16 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui" "path": "framework/ui",
"isIndex": true
}, },
{ {
"text": "MVC / Razor Pages", "text": "MVC / Razor Pages",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/mvc-razor-pages/overall.md" "path": "framework/ui/mvc-razor-pages/overall.md",
"isIndex": true
}, },
{ {
"text": "Navigation / Menus", "text": "Navigation / Menus",
@ -1006,7 +1141,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/mvc-razor-pages/tag-helpers" "path": "framework/ui/mvc-razor-pages/tag-helpers",
"isIndex": true
}, },
{ {
"text": "Form Elements", "text": "Form Elements",
@ -1047,7 +1183,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/mvc-razor-pages/theming.md" "path": "framework/ui/mvc-razor-pages/theming.md",
"isIndex": true
}, },
{ {
"text": "The Basic Theme", "text": "The Basic Theme",
@ -1064,7 +1201,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/mvc-razor-pages/javascript-api" "path": "framework/ui/mvc-razor-pages/javascript-api",
"isIndex": true
}, },
{ {
"text": "Localization", "text": "Localization",
@ -1125,7 +1263,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/mvc-razor-pages/customization-user-interface.md" "path": "framework/ui/mvc-razor-pages/customization-user-interface.md",
"isIndex": true
}, },
{ {
"text": "Entity Action Extensions", "text": "Entity Action Extensions",
@ -1157,7 +1296,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/blazor/overall.md" "path": "framework/ui/blazor/overall.md",
"isIndex": true
}, },
{ {
"text": "Navigation / Menu", "text": "Navigation / Menu",
@ -1176,7 +1316,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/blazor/theming.md" "path": "framework/ui/blazor/theming.md",
"isIndex": true
}, },
{ {
"text": "The Basic Theme", "text": "The Basic Theme",
@ -1298,7 +1439,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/angular/overview.md" "path": "framework/ui/angular/overview.md",
"isIndex": true
}, },
{ {
"text": "Quick Start", "text": "Quick Start",
@ -1492,7 +1634,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/angular/theming.md" "path": "framework/ui/angular/theming.md",
"isIndex": true
}, },
{ {
"text": "Configuration", "text": "Configuration",
@ -1529,7 +1672,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/angular/extensions-overall.md" "path": "framework/ui/angular/extensions-overall.md",
"isIndex": true
}, },
{ {
"text": "Entity Action Extensions", "text": "Entity Action Extensions",
@ -1591,7 +1735,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/react-native" "path": "framework/ui/react-native",
"isIndex": true
} }
] ]
}, },
@ -1600,7 +1745,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/ui/maui" "path": "framework/ui/maui",
"isIndex": true
} }
] ]
}, },
@ -1629,14 +1775,16 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/data" "path": "framework/data",
"isIndex": true
}, },
{ {
"text": "Entity Framework Core", "text": "Entity Framework Core",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "framework/data/entity-framework-core" "path": "framework/data/entity-framework-core",
"isIndex": true
}, },
{ {
"text": "Database Migrations", "text": "Database Migrations",
@ -1706,7 +1854,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "solution-templates" "path": "solution-templates",
"isIndex": true
}, },
{ {
"text": "Template Guide", "text": "Template Guide",
@ -1767,7 +1916,170 @@
}, },
{ {
"text": "Microservice Solution", "text": "Microservice Solution",
"path": "solution-templates/microservice" "isLazyExpandable": true,
"path": "solution-templates/microservice",
"items":[
{
"text": "Overview",
"path": "solution-templates/microservice"
},
{
"text": "Solution Structure",
"path": "solution-templates/microservice/solution-structure.md"
},
{
"text": "Main Components",
"items": [
{
"text": "Overview",
"path": "solution-templates/microservice/main-components"
},
{
"text": "Microservices",
"path": "solution-templates/microservice/microservices.md"
},
{
"text": "API Gateways",
"path": "solution-templates/microservice/api-gateways.md"
},
{
"text": "Web Applications",
"path": "solution-templates/microservice/web-applications.md"
},
{
"text": "Mobile Applications",
"path": "solution-templates/microservice/mobile-applications.md"
}
]
},
{
"text": "Built-In Features",
"items": [
{
"text": "Overview",
"path": "solution-templates/microservice/built-in-features.md"
},
{
"text": "Authentication",
"path": "solution-templates/microservice/authentication.md"
},
{
"text": "Database configurations",
"path": "solution-templates/microservice/database-configurations.md"
},
{
"text": "Logging (with Serilog and Elasticsearch)",
"path": "solution-templates/microservice/logging.md"
},
{
"text": "Monitoring (with Prometheus and Grafana)",
"path": "solution-templates/microservice/monitoring.md"
},
{
"text": "Swagger integration",
"path": "solution-templates/microservice/swagger.md"
},
{
"text": "Permission management",
"path": "solution-templates/microservice/permission-management.md"
},
{
"text": "Feature management",
"path": "solution-templates/microservice/feature-management.md"
},
{
"text": "Localization system",
"path": "solution-templates/microservice/localization-system.md"
},
{
"text": "Background Jobs",
"path": "solution-templates/microservice/background-jobs.md"
},
{
"text": "Background Workers",
"path": "solution-templates/microservice/background-workers.md"
},
{
"text": "Distributed Locking",
"path": "solution-templates/microservice/distributed-locking.md"
},
{
"text": "Distributed Cache",
"path": "solution-templates/microservice/distributed-cache.md"
},
{
"text": "Multi-Tenancy",
"path": "solution-templates/microservice/multi-tenancy.md"
},
{
"text": "BLOB Storing",
"path": "solution-templates/microservice/blob-storing.md"
},
{
"text": "CORS configuration",
"path": "solution-templates/microservice/cors-configuration.md"
}
]
},
{
"text": "Communication",
"items":[
{
"text": "Overview",
"path": "solution-templates/microservice/communication.md"
},
{
"text": "HTTP API Calls",
"path": "solution-templates/microservice/http-api-calls.md"
},
{
"text": "gRPC Calls",
"path": "solution-templates/microservice/grpc-calls.md"
},
{
"text": "Distributed Events",
"path": "solution-templates/microservice/distributed-events.md"
}
]
},
{
"text": "Helm Charts and Kubernetes",
"path": "solution-templates/microservice/helm-charts-and-kubernetes.md"
},
{
"text": "Guides",
"items": [
{
"text": "Overview",
"path": "solution-templates/microservice/guides.md"
},
{
"text": "Adding new microservices",
"path": "solution-templates/microservice/adding-new-microservices.md"
},
{
"text": "Adding new applications",
"path": "solution-templates/microservice/adding-new-applications.md"
},
{
"text": "Adding new API gateways",
"path": "solution-templates/microservice/adding-new-api-gateways.md"
},
{
"text": "Mono-repo vs multiple repository approaches",
"path": "solution-templates/microservice/mono-repo-vs-multiple-repository-approaches.md"
},
{
"text": "Authoring unit and integration tests",
"path": "solution-templates/microservice/authoring-unit-and-integration-tests.md"
},
{
"text": "How to use with ABP Suite",
"path": "solution-templates/microservice/how-to-use-with-abp-suite.md"
}
]
}
]
}, },
{ {
"text": "Application Module", "text": "Application Module",
@ -1780,7 +2092,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "modules" "path": "modules",
"isIndex": true
}, },
{ {
"text": "Account", "text": "Account",
@ -1791,7 +2104,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "modules/account-pro.md" "path": "modules/account-pro.md",
"isIndex": true
}, },
{ {
"text": "Tenant impersonation & User impersonation", "text": "Tenant impersonation & User impersonation",
@ -1853,10 +2167,13 @@
}, },
{ {
"text": "IdentityServer", "text": "IdentityServer",
"isLazyExpandable": true,
"path": "modules/identity-server.md",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "modules/identity-server.md" "path": "modules/identity-server.md",
"isIndex": true
}, },
{ {
"text": "IdentityServer Migration Guide", "text": "IdentityServer Migration Guide",
@ -1874,10 +2191,13 @@
}, },
{ {
"text": "OpenIddict", "text": "OpenIddict",
"isLazyExpandable": true,
"path": "modules/openiddict.md",
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "modules/openiddict.md" "path": "modules/openiddict.md",
"isIndex": true
}, },
{ {
"text": "OpenIddict Migration Guide", "text": "OpenIddict Migration Guide",
@ -1937,11 +2257,12 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "ui-themes" "path": "ui-themes",
"isIndex": true
}, },
{ {
"text": "The Basic Theme", "text": "The Basic Theme",
"path": "framework/ui/mvc-razor-pages/basic-theme.md" "path": "ui-themes/basic-theme"
}, },
{ {
"text": "LeptonX Theme", "text": "LeptonX Theme",
@ -1954,7 +2275,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "testing/overall.md" "path": "testing/overall.md",
"isIndex": true
}, },
{ {
"text": "Unit tests", "text": "Unit tests",
@ -1975,7 +2297,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "deployment" "path": "deployment",
"isIndex": true
}, },
{ {
"text": "Configuring SSL certificate(HTTPS)", "text": "Configuring SSL certificate(HTTPS)",
@ -2008,7 +2331,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "samples" "path": "samples",
"isIndex": true
}, },
{ {
"text": "EventHub", "text": "EventHub",
@ -2033,7 +2357,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "https://abp.io/books" "path": "https://abp.io/books",
"isIndex": true
}, },
{ {
"text": "Mastering ABP Framework", "text": "Mastering ABP Framework",
@ -2050,7 +2375,8 @@
"items": [ "items": [
{ {
"text": "Overview", "text": "Overview",
"path": "release-info" "path": "release-info",
"isIndex": true
}, },
{ {
"text": "Release Notes", "text": "Release Notes",

1
docs/en/docs-params.json

@ -8,6 +8,7 @@
"Blazor": "Blazor WebAssembly", "Blazor": "Blazor WebAssembly",
"BlazorServer": "Blazor Server", "BlazorServer": "Blazor Server",
"BlazorWebApp": "Blazor WebApp", "BlazorWebApp": "Blazor WebApp",
"MAUIBlazor": "MAUI Blazor (Hybrid)",
"NG": "Angular" "NG": "Angular"
} }
}, },

44
docs/en/framework/architecture/best-practices/application-services.md

@ -1,8 +1,14 @@
# Application Services Best Practices & Conventions # Application Services Best Practices & Conventions
> This document offers best practices for implementing Application Services classes in your modules and applications based on Domain-Driven-Design principles.
>
> **Ensure you've read the [*Application Services*](../domain-driven-design/application-services.md) document first.**
## General
* **Do** create an application service for each **aggregate root**. * **Do** create an application service for each **aggregate root**.
### Application Service Interface ## Application Service Interface
* **Do** define an `interface` for each application service in the **application contracts** package. * **Do** define an `interface` for each application service in the **application contracts** package.
* **Do** inherit from the `IApplicationService` interface. * **Do** inherit from the `IApplicationService` interface.
@ -11,11 +17,11 @@
* **Do not** get/return entities for the service methods. * **Do not** get/return entities for the service methods.
* **Do** define DTOs based on the [DTO best practices](data-transfer-objects.md). * **Do** define DTOs based on the [DTO best practices](data-transfer-objects.md).
#### Outputs ### Outputs
* **Avoid** to define too many output DTOs for same or related entities. Instead, define a **basic** and a **detailed** DTO for an entity. * **Avoid** to define too many output DTOs for same or related entities. Instead, define a **basic** and a **detailed** DTO for an entity.
##### Basic DTO #### Basic DTO
**Do** define a **basic** DTO for an aggregate root. **Do** define a **basic** DTO for an aggregate root.
@ -44,7 +50,7 @@ public class IssueLabelDto
} }
``` ```
##### Detailed DTO #### Detailed DTO
**Do** define a **detailed** DTO for an entity if it has reference(s) to other aggregate roots. **Do** define a **detailed** DTO for an entity if it has reference(s) to other aggregate roots.
@ -81,20 +87,20 @@ public class LabelDto : ExtensibleEntityDto<Guid>
} }
```` ````
#### Inputs ### Inputs
* **Do not** define any property in an input DTO that is not used in the service class. * **Do not** define any property in an input DTO that is not used in the service class.
* **Do not** share input DTOs between application service methods. * **Do not** share input DTOs between application service methods.
* **Do not** inherit an input DTO class from another one. * **Do not** inherit an input DTO class from another one.
* **May** inherit from an abstract base DTO class and share some properties between different DTOs in that way. However, should be very careful in that case because manipulating the base DTO would effect all related DTOs and service methods. Avoid from that as a good practice. * **May** inherit from an abstract base DTO class and share some properties between different DTOs in that way. However, should be very careful in that case because manipulating the base DTO would effect all related DTOs and service methods. Avoid from that as a good practice.
#### Methods ### Methods
* **Do** define service methods as asynchronous with **Async** postfix. * **Do** define service methods as asynchronous with **Async** postfix.
* **Do not** repeat the entity name in the method names. * **Do not** repeat the entity name in the method names.
* Example: Define `GetAsync(...)` instead of `GetProductAsync(...)` in the `IProductAppService`. * Example: Define `GetAsync(...)` instead of `GetProductAsync(...)` in the `IProductAppService`.
##### Getting A Single Entity #### Getting A Single Entity
* **Do** use the `GetAsync` **method name**. * **Do** use the `GetAsync` **method name**.
* **Do** get Id with a **primitive** method parameter. * **Do** get Id with a **primitive** method parameter.
@ -104,7 +110,7 @@ public class LabelDto : ExtensibleEntityDto<Guid>
Task<QuestionWithDetailsDto> GetAsync(Guid id); Task<QuestionWithDetailsDto> GetAsync(Guid id);
```` ````
##### Getting A List Of Entities #### Getting A List Of Entities
* **Do** use the `GetListAsync` **method name**. * **Do** use the `GetListAsync` **method name**.
* **Do** get a single DTO argument for **filtering**, **sorting** and **paging** if necessary. * **Do** get a single DTO argument for **filtering**, **sorting** and **paging** if necessary.
@ -117,7 +123,7 @@ Task<QuestionWithDetailsDto> GetAsync(Guid id);
Task<List<QuestionWithDetailsDto>> GetListAsync(QuestionListQueryDto queryDto); Task<List<QuestionWithDetailsDto>> GetListAsync(QuestionListQueryDto queryDto);
```` ````
##### Creating A New Entity #### Creating A New Entity
* **Do** use the `CreateAsync` **method name**. * **Do** use the `CreateAsync` **method name**.
* **Do** get a **specialized input** DTO to create the entity. * **Do** get a **specialized input** DTO to create the entity.
@ -151,7 +157,7 @@ public class CreateQuestionDto : ExtensibleObject
} }
```` ````
##### Updating An Existing Entity #### Updating An Existing Entity
- **Do** use the `UpdateAsync` **method name**. - **Do** use the `UpdateAsync` **method name**.
- **Do** get a **specialized input** DTO to update the entity. - **Do** get a **specialized input** DTO to update the entity.
@ -167,7 +173,7 @@ Example:
Task<QuestionWithDetailsDto> UpdateAsync(Guid id, UpdateQuestionDto updateQuestionDto); Task<QuestionWithDetailsDto> UpdateAsync(Guid id, UpdateQuestionDto updateQuestionDto);
```` ````
##### Deleting An Existing Entity #### Deleting An Existing Entity
- **Do** use the `DeleteAsync` **method name**. - **Do** use the `DeleteAsync` **method name**.
- **Do** get Id with a **primitive** method parameter. Example: - **Do** get Id with a **primitive** method parameter. Example:
@ -176,7 +182,7 @@ Task<QuestionWithDetailsDto> UpdateAsync(Guid id, UpdateQuestionDto updateQuesti
Task DeleteAsync(Guid id); Task DeleteAsync(Guid id);
```` ````
##### Other Methods #### Other Methods
* **Can** define additional methods to perform operations on the entity. Example: * **Can** define additional methods to perform operations on the entity. Example:
@ -186,7 +192,7 @@ Task<int> VoteAsync(Guid id, VoteType type);
This method votes a question and returns the current score of the question. This method votes a question and returns the current score of the question.
### Application Service Implementation ## Application Service Implementation
* **Do** develop the application layer **completely independent from the web layer**. * **Do** develop the application layer **completely independent from the web layer**.
* **Do** implement application service interfaces in the **application layer**. * **Do** implement application service interfaces in the **application layer**.
@ -195,30 +201,30 @@ This method votes a question and returns the current score of the question.
* **Do** make all public methods **virtual**, so developers may inherit and override them. * **Do** make all public methods **virtual**, so developers may inherit and override them.
* **Do not** make **private** methods. Instead make them **protected virtual**, so developers may inherit and override them. * **Do not** make **private** methods. Instead make them **protected virtual**, so developers may inherit and override them.
#### Using Repositories ### Using Repositories
* **Do** use the specifically designed repositories (like `IProductRepository`). * **Do** use the specifically designed repositories (like `IProductRepository`).
* **Do not** use generic repositories (like `IRepository<Product>`). * **Do not** use generic repositories (like `IRepository<Product>`).
#### Querying Data ### Querying Data
* **Do not** use LINQ/SQL for querying data from database inside the application service methods. It's repository's responsibility to perform LINQ/SQL queries from the data source. * **Do not** use LINQ/SQL for querying data from database inside the application service methods. It's repository's responsibility to perform LINQ/SQL queries from the data source.
#### Extra Properties ### Extra Properties
* **Do** use either `MapExtraPropertiesTo` extension method ([see](../../fundamentals/object-extensions.md)) or configure the object mapper (`MapExtraProperties`) to allow application developers to be able to extend the objects and services. * **Do** use either `MapExtraPropertiesTo` extension method ([see](../../fundamentals/object-extensions.md)) or configure the object mapper (`MapExtraProperties`) to allow application developers to be able to extend the objects and services.
#### Manipulating / Deleting Entities ### Manipulating / Deleting Entities
* **Do** always get all the related entities from repositories to perform the operations on them. * **Do** always get all the related entities from repositories to perform the operations on them.
* **Do** call repository's Update/UpdateAsync method after updating an entity. Because, not all database APIs support change tracking & auto update. * **Do** call repository's Update/UpdateAsync method after updating an entity. Because, not all database APIs support change tracking & auto update.
#### Handle files ### Handle files
* **Do not** use any web components like `IFormFile` or `Stream` in the application services. If you want to serve a file you can use `byte[]`. * **Do not** use any web components like `IFormFile` or `Stream` in the application services. If you want to serve a file you can use `byte[]`.
* **Do** use a `Controller` to handle file uploading then pass the `byte[]` of the file to the application service method. * **Do** use a `Controller` to handle file uploading then pass the `byte[]` of the file to the application service method.
#### Using Other Application Services ### Using Other Application Services
* **Do not** use other application services of the same module/application. Instead; * **Do not** use other application services of the same module/application. Instead;
* Use domain layer to perform the required task. * Use domain layer to perform the required task.

6
docs/en/framework/architecture/best-practices/data-transfer-objects.md

@ -1,5 +1,11 @@
# Data Transfer Objects Best Practices & Conventions # Data Transfer Objects Best Practices & Conventions
> This document offers best practices for implementing Data Transfer Object classes in your modules and applications based on Domain-Driven-Design principles.
>
> **Ensure you've read the [*Data Transfer Objects*](../domain-driven-design/data-transfer-objects.md) document first.**
## General
* **Do** define DTOs in the **application contracts** package. * **Do** define DTOs in the **application contracts** package.
* **Do** inherit from the pre-built **base DTO classes** where possible and necessary (like `EntityDto<TKey>`, `CreationAuditedEntityDto<TKey>`, `AuditedEntityDto<TKey>`, `FullAuditedEntityDto<TKey>` and so on). * **Do** inherit from the pre-built **base DTO classes** where possible and necessary (like `EntityDto<TKey>`, `CreationAuditedEntityDto<TKey>`, `AuditedEntityDto<TKey>`, `FullAuditedEntityDto<TKey>` and so on).
* **Do** inherit from the **extensible DTO** classes for the **aggregate roots** (like `ExtensibleAuditedEntityDto<TKey>`), because aggregate roots are extensible objects and extra properties are mapped to DTOs in this way. * **Do** inherit from the **extensible DTO** classes for the **aggregate roots** (like `ExtensibleAuditedEntityDto<TKey>`), because aggregate roots are extensible objects and extra properties are mapped to DTOs in this way.

10
docs/en/framework/architecture/best-practices/domain-services.md

@ -1,6 +1,10 @@
# Domain Services Best Practices & Conventions # Domain Services Best Practices & Conventions
### Domain Service > This document offers best practices for implementing Domain Service classes in your modules and applications based on Domain-Driven-Design principles.
>
> **Ensure you've read the [*Domain Services*](../domain-driven-design/domain-services.md) document first.**
## Domain Services
- **Do** define domain services in the **domain layer**. - **Do** define domain services in the **domain layer**.
- **Do not** create interfaces for the domain services **unless** you have a good reason to (like mock and test different implementations). - **Do not** create interfaces for the domain services **unless** you have a good reason to (like mock and test different implementations).
@ -14,7 +18,7 @@ public class IssueManager : DomainService
} }
``` ```
### Domain Service Methods ## Domain Service Methods
- **Do not** define `GET` methods. `GET` methods do not change the state of an entity. Hence, use the repository directly in the Application Service instead of Domain Service method. - **Do not** define `GET` methods. `GET` methods do not change the state of an entity. Hence, use the repository directly in the Application Service instead of Domain Service method.
@ -57,8 +61,6 @@ public async Task AssignToAsync(Issue issue, IdentityUser user)
- **Do not** return `DTO`. Return only domain objects when you need. - **Do not** return `DTO`. Return only domain objects when you need.
- **Do not** involve authenticated user logic. Instead, define extra parameter and send the related data of ` CurrentUser` from the Application Service layer. - **Do not** involve authenticated user logic. Instead, define extra parameter and send the related data of ` CurrentUser` from the Application Service layer.
## See Also ## See Also
* [Video tutorial](https://abp.io/video-courses/essentials/domain-services) * [Video tutorial](https://abp.io/video-courses/essentials/domain-services)

33
docs/en/framework/architecture/best-practices/entities.md

@ -1,12 +1,16 @@
# Entity Best Practices & Conventions # Entity Best Practices & Conventions
### Entities > This document offers best practices for implementing Aggregate Root and Entity classes in your modules and applications based on Domain-Driven-Design principles.
>
> **Ensure you've read the [*Entities*](../domain-driven-design/entities.md) document first.**
## Entities
Every aggregate root is also an entity. So, these rules are valid for aggregate roots too unless aggregate root rules override them. Every aggregate root is also an entity. So, these rules are valid for aggregate roots too unless aggregate root rules override them.
- **Do** define entities in the **domain layer**. - **Do** define entities in the **domain layer**.
#### Primary Constructor ### Primary Constructor
* **Do** define a **primary constructor** that ensures the validity of the entity on creation. Primary constructors are used to create a new instance of the entity by the application code. * **Do** define a **primary constructor** that ensures the validity of the entity on creation. Primary constructors are used to create a new instance of the entity by the application code.
@ -14,15 +18,15 @@ Every aggregate root is also an entity. So, these rules are valid for aggregate
- **Do** always initialize sub collections in the primary constructor. - **Do** always initialize sub collections in the primary constructor.
- **Do not** generate `Guid` keys inside the constructor. Get it as a parameter, so the calling code will use `IGuidGenerator` to generate a new `Guid` value. - **Do not** generate `Guid` keys inside the constructor. Get it as a parameter, so the calling code will use `IGuidGenerator` to generate a new `Guid` value.
#### Parameterless Constructor ### Parameterless Constructor
- **Do** always define a `protected` parameterless constructor to be compatible with ORMs. - **Do** always define a `protected` parameterless constructor to be compatible with ORMs.
#### References ### References
- **Do** always **reference** to other aggregate roots **by Id**. Never add navigation properties to other aggregate roots. - **Do** always **reference** to other aggregate roots **by Id**. Never add navigation properties to other aggregate roots.
#### Other Class Members ### Other Class Members
- **Do** always define properties and methods as `virtual` (except `private` methods, obviously). Because some ORMs and dynamic proxy tools require it. - **Do** always define properties and methods as `virtual` (except `private` methods, obviously). Because some ORMs and dynamic proxy tools require it.
- **Do** keep the entity as always **valid** and **consistent** within its own boundary. - **Do** keep the entity as always **valid** and **consistent** within its own boundary.
@ -30,27 +34,27 @@ Every aggregate root is also an entity. So, these rules are valid for aggregate
- **Do** define `public `, `internal` or `protected internal` (virtual) **methods** to change the properties (with non-public setters) if necessary. - **Do** define `public `, `internal` or `protected internal` (virtual) **methods** to change the properties (with non-public setters) if necessary.
- **Do** return the entity object (`this`) from the setter methods. - **Do** return the entity object (`this`) from the setter methods.
### Aggregate Roots ## Aggregate Roots
#### Primary Keys ### Primary Keys
* **Do** always use a **Id** property for the aggregate root key. * **Do** always use a **Id** property for the aggregate root key.
* **Do not** use **composite keys** for aggregate roots. * **Do not** use **composite keys** for aggregate roots.
* **Do** use **Guid** as the **primary key** of all aggregate roots. * **Do** use **Guid** as the **primary key** of all aggregate roots.
#### Base Class ### Base Class
* **Do** inherit from the `AggregateRoot<TKey>` or one of the audited classes (`CreationAuditedAggregateRoot<TKey>`, `AuditedAggregateRoot<TKey>` or `FullAuditedAggregateRoot<TKey>`) based on requirements. * **Do** inherit from the `AggregateRoot<TKey>` or one of the audited classes (`CreationAuditedAggregateRoot<TKey>`, `AuditedAggregateRoot<TKey>` or `FullAuditedAggregateRoot<TKey>`) based on requirements.
#### Aggregate Boundary ### Aggregate Boundary
* **Do** keep aggregates **as small as possible**. Most of the aggregates will only have primitive properties and will not have sub collections. Consider these as design decisions: * **Do** keep aggregates **as small as possible**. Most of the aggregates will only have primitive properties and will not have sub collections. Consider these as design decisions:
* **Performance** & **memory** cost of loading & saving aggregates (keep in mind that an aggregate is normally loaded & saved as a single unit). Larger aggregates will consume more CPU & memory. * **Performance** & **memory** cost of loading & saving aggregates (keep in mind that an aggregate is normally loaded & saved as a single unit). Larger aggregates will consume more CPU & memory.
* **Consistency** & **validity** boundary. * **Consistency** & **validity** boundary.
### Example ## Example
#### Aggregate Root ### Aggregate Root
````C# ````C#
public class Issue : FullAuditedAggregateRoot<Guid> //Using Guid as the key/identifier public class Issue : FullAuditedAggregateRoot<Guid> //Using Guid as the key/identifier
@ -130,7 +134,7 @@ public class Issue : FullAuditedAggregateRoot<Guid> //Using Guid as the key/iden
} }
```` ````
#### The Entity ### Entity
````C# ````C#
public class IssueLabel : Entity public class IssueLabel : Entity
@ -151,11 +155,12 @@ public class IssueLabel : Entity
} }
```` ````
### References ## References
* Effective Aggregate Design by Vaughn Vernon * Effective Aggregate Design by Vaughn Vernon
http://dddcommunity.org/library/vernon_2011 http://dddcommunity.org/library/vernon_2011
## See Also
## See Also
* [Video tutorial](https://abp.io/video-courses/essentials/entities) * [Video tutorial](https://abp.io/video-courses/essentials/entities)

18
docs/en/framework/architecture/best-practices/entity-framework-core-integration.md

@ -1,12 +1,16 @@
# Entity Framework Core Integration Best Practices # Entity Framework Core Integration Best Practices
> See [Entity Framework Core Integration document](../../data/entity-framework-core) for the basics of the EF Core integration. > This document offers best practices for implementing Entity Framework Core integration in your modules and applications.
>
> **Ensure you've read the [*Entity Framework Core Integration*](../../data/entity-framework-core/index.md) document first.**
## General
- **Do** define a separated `DbContext` interface and class for each module. - **Do** define a separated `DbContext` interface and class for each module.
- **Do not** rely on lazy loading on the application development. - **Do not** rely on lazy loading on the application development.
- **Do not** enable lazy loading for the `DbContext`. - **Do not** enable lazy loading for the `DbContext`.
### DbContext Interface ## DbContext Interface
- **Do** define an **interface** for the `DbContext` that inherits from `IEfCoreDbContext`. - **Do** define an **interface** for the `DbContext` that inherits from `IEfCoreDbContext`.
- **Do** add a `ConnectionStringName` **attribute** to the `DbContext` interface. - **Do** add a `ConnectionStringName` **attribute** to the `DbContext` interface.
@ -23,7 +27,7 @@ public interface IIdentityDbContext : IEfCoreDbContext
* **Do not** define `set;` for the properties in this interface. * **Do not** define `set;` for the properties in this interface.
### DbContext class ## DbContext class
* **Do** inherit the `DbContext` from the `AbpDbContext<TDbContext>` class. * **Do** inherit the `DbContext` from the `AbpDbContext<TDbContext>` class.
* **Do** add a `ConnectionStringName` attribute to the `DbContext` class. * **Do** add a `ConnectionStringName` attribute to the `DbContext` class.
@ -46,7 +50,7 @@ public class IdentityDbContext : AbpDbContext<IdentityDbContext>, IIdentityDbCon
} }
```` ````
### Table Prefix and Schema ## Table Prefix and Schema
- **Do** add static `TablePrefix` and `Schema` **properties** to the `DbContext` class. Set default value from a constant. Example: - **Do** add static `TablePrefix` and `Schema` **properties** to the `DbContext` class. Set default value from a constant. Example:
@ -58,7 +62,7 @@ public static string Schema { get; set; } = AbpIdentityConsts.DefaultDbSchema;
- **Do** always use a short `TablePrefix` value for a module to create **unique table names** in a shared database. `Abp` table prefix is reserved for ABP core modules. - **Do** always use a short `TablePrefix` value for a module to create **unique table names** in a shared database. `Abp` table prefix is reserved for ABP core modules.
- **Do** set `Schema` to `null` as default. - **Do** set `Schema` to `null` as default.
### Model Mapping ## Model Mapping
- **Do** explicitly **configure all entities** by overriding the `OnModelCreating` method of the `DbContext`. Example: - **Do** explicitly **configure all entities** by overriding the `OnModelCreating` method of the `DbContext`. Example:
@ -100,7 +104,7 @@ public static class IdentityDbContextModelBuilderExtensions
* **Do** call `b.ConfigureByConvention();` for each entity mapping (as shown above). * **Do** call `b.ConfigureByConvention();` for each entity mapping (as shown above).
### Repository Implementation ## Repository Implementation
- **Do** **inherit** the repository from the `EfCoreRepository<TDbContext, TEntity, TKey>` class and implement the corresponding repository interface. Example: - **Do** **inherit** the repository from the `EfCoreRepository<TDbContext, TEntity, TKey>` class and implement the corresponding repository interface. Example:
@ -168,7 +172,7 @@ public override async Task<IQueryable<IdentityUser>> WithDetailsAsync()
} }
```` ````
### Module Class ## Module Class
- **Do** define a module class for the Entity Framework Core integration package. - **Do** define a module class for the Entity Framework Core integration package.
- **Do** add `DbContext` to the `IServiceCollection` using the `AddAbpDbContext<TDbContext>` method. - **Do** add `DbContext` to the `IServiceCollection` using the `AddAbpDbContext<TDbContext>` method.

4
docs/en/framework/architecture/best-practices/module-architecture.md

@ -1,13 +1,13 @@
# Module Architecture Best Practices & Conventions # Module Architecture Best Practices & Conventions
### Solution Structure ## Solution Structure
* **Do** create a separated Visual Studio solution for every module. * **Do** create a separated Visual Studio solution for every module.
* **Do** name the solution as *CompanyName.ModuleName* (for core ABP modules, it's *Volo.Abp.ModuleName*). * **Do** name the solution as *CompanyName.ModuleName* (for core ABP modules, it's *Volo.Abp.ModuleName*).
* **Do** develop the module as layered, so it has several packages (projects) those are related to each other. * **Do** develop the module as layered, so it has several packages (projects) those are related to each other.
* Every package has its own module definition file and explicitly declares the dependencies for the depended packages/modules. * Every package has its own module definition file and explicitly declares the dependencies for the depended packages/modules.
### Layers & Packages ## Layers & Packages
The following diagram shows the packages of a well-layered module and dependencies of those packages between them: The following diagram shows the packages of a well-layered module and dependencies of those packages between them:

18
docs/en/framework/architecture/best-practices/mongodb-integration.md

@ -1,8 +1,14 @@
# MongoDB Integration # MongoDB Integration
> This document offers best practices for implementing MongoDB integration in your modules and applications.
>
> **Ensure you've read the [*MongoDB Integration*](../../data/entity-framework-core/index.md) document first.**
## General
* Do define a separated `MongoDbContext` interface and class for each module. * Do define a separated `MongoDbContext` interface and class for each module.
### MongoDbContext Interface ## MongoDbContext Interface
- **Do** define an **interface** for the `MongoDbContext` that inherits from `IAbpMongoDbContext`. - **Do** define an **interface** for the `MongoDbContext` that inherits from `IAbpMongoDbContext`.
- **Do** add a `ConnectionStringName` **attribute** to the `MongoDbContext` interface. - **Do** add a `ConnectionStringName` **attribute** to the `MongoDbContext` interface.
@ -17,7 +23,7 @@ public interface IAbpIdentityMongoDbContext : IAbpMongoDbContext
} }
```` ````
### MongoDbContext class ## MongoDbContext class
- **Do** inherit the `MongoDbContext` from the `AbpMongoDbContext` class. - **Do** inherit the `MongoDbContext` from the `AbpMongoDbContext` class.
- **Do** add a `ConnectionStringName` attribute to the `MongoDbContext` class. - **Do** add a `ConnectionStringName` attribute to the `MongoDbContext` class.
@ -34,7 +40,7 @@ public class AbpIdentityMongoDbContext : AbpMongoDbContext, IAbpIdentityMongoDbC
} }
``` ```
### Collection Prefix ## Collection Prefix
- **Do** add static `CollectionPrefix` **property** to the `DbContext` class. Set default value from a constant. Example: - **Do** add static `CollectionPrefix` **property** to the `DbContext` class. Set default value from a constant. Example:
@ -46,7 +52,7 @@ Used the same constant defined for the EF Core integration table prefix in this
- **Do** always use a short `CollectionPrefix` value for a module to create **unique collection names** in a shared database. `Abp` collection prefix is reserved for ABP core modules. - **Do** always use a short `CollectionPrefix` value for a module to create **unique collection names** in a shared database. `Abp` collection prefix is reserved for ABP core modules.
### Collection Mapping ## Collection Mapping
- **Do** explicitly **configure all aggregate roots** by overriding the `CreateModel` method of the `MongoDbContext`. Example: - **Do** explicitly **configure all aggregate roots** by overriding the `CreateModel` method of the `MongoDbContext`. Example:
@ -83,7 +89,7 @@ public static class AbpIdentityMongoDbContextExtensions
} }
``` ```
### Repository Implementation ## Repository Implementation
- **Do** **inherit** the repository from the `MongoDbRepository<TMongoDbContext, TEntity, TKey>` class and implement the corresponding repository interface. Example: - **Do** **inherit** the repository from the `MongoDbRepository<TMongoDbContext, TEntity, TKey>` class and implement the corresponding repository interface. Example:
@ -124,7 +130,7 @@ public async Task<IdentityUser> FindByNormalizedUserNameAsync(
* Using `IQueryable<TEntity>` makes the code as much as similar to the EF Core repository implementation and easy to write and read. * Using `IQueryable<TEntity>` makes the code as much as similar to the EF Core repository implementation and easy to write and read.
* **Do** implement data filtering if it is not possible to use the `GetMongoQueryable()` method. * **Do** implement data filtering if it is not possible to use the `GetMongoQueryable()` method.
### Module Class ## Module Class
- **Do** define a module class for the MongoDB integration package. - **Do** define a module class for the MongoDB integration package.
- **Do** add `MongoDbContext` to the `IServiceCollection` using the `AddMongoDbContext<TMongoDbContext>` method. - **Do** add `MongoDbContext` to the `IServiceCollection` using the `AddMongoDbContext<TMongoDbContext>` method.

10
docs/en/framework/architecture/best-practices/repositories.md

@ -1,6 +1,10 @@
# Repository Best Practices & Conventions # Repository Best Practices & Conventions
### Repository Interfaces > This document offers best practices for implementing Repository classes in your modules and applications based on Domain-Driven-Design principles.
>
> **Ensure you've read the [*Repositories*](../domain-driven-design/repositories.md) document first.**
## Repository Interfaces
* **Do** define repository interfaces in the **domain layer**. * **Do** define repository interfaces in the **domain layer**.
* **Do** define a repository interface (like `IIdentityUserRepository`) and create its corresponding implementations for **each aggregate root**. * **Do** define a repository interface (like `IIdentityUserRepository`) and create its corresponding implementations for **each aggregate root**.
@ -30,7 +34,7 @@ public interface IIdentityUserRepository : IBasicRepository<IdentityUser, Guid>
* **Do** inherit the repository interface from `IBasicRepository<TEntity, TKey>` (as normally) or a lower-featured interface, like `IReadOnlyRepository<TEntity, TKey>` (if it's needed). * **Do** inherit the repository interface from `IBasicRepository<TEntity, TKey>` (as normally) or a lower-featured interface, like `IReadOnlyRepository<TEntity, TKey>` (if it's needed).
* **Do not** define repositories for entities those are **not aggregate roots**. * **Do not** define repositories for entities those are **not aggregate roots**.
### Repository Methods ## Repository Methods
* **Do** define all repository methods as **asynchronous**. * **Do** define all repository methods as **asynchronous**.
* **Do** add an **optional** `cancellationToken` parameter to every method of the repository. Example: * **Do** add an **optional** `cancellationToken` parameter to every method of the repository. Example:
@ -68,7 +72,7 @@ Task<List<IdentityUser>> GetListByNormalizedRoleNameAsync(
* **Avoid** to create projection classes for entities to get less property of an entity from the repository. Example: Avoid to create BasicUserView class to select a few properties needed for the use case needs. Instead, directly use the aggregate root class. However, there may be some exceptions for this rule, where: * **Avoid** to create projection classes for entities to get less property of an entity from the repository. Example: Avoid to create BasicUserView class to select a few properties needed for the use case needs. Instead, directly use the aggregate root class. However, there may be some exceptions for this rule, where:
* Performance is so critical for the use case and getting the whole aggregate root highly impacts the performance. * Performance is so critical for the use case and getting the whole aggregate root highly impacts the performance.
### See Also ## See Also
* [Entity Framework Core Integration](./entity-framework-core-integration.md) * [Entity Framework Core Integration](./entity-framework-core-integration.md)
* [MongoDB Integration](./mongodb-integration.md) * [MongoDB Integration](./mongodb-integration.md)

2
docs/en/framework/architecture/domain-driven-design/data-transfer-objects.md

@ -1,7 +1,5 @@
# Data Transfer Objects # Data Transfer Objects
## Introduction
**Data Transfer Objects** (DTO) are used to transfer data between the **Application Layer** and the **Presentation Layer** or other type of clients. **Data Transfer Objects** (DTO) are used to transfer data between the **Application Layer** and the **Presentation Layer** or other type of clients.
Typically, an [application service](./application-services.md) is called from the presentation layer (optionally) with a **DTO** as the parameter. It uses domain objects to **perform some specific business logic** and (optionally) returns a DTO back to the presentation layer. Thus, the presentation layer is completely **isolated** from domain layer. Typically, an [application service](./application-services.md) is called from the presentation layer (optionally) with a **DTO** as the parameter. It uses domain objects to **perform some specific business logic** and (optionally) returns a DTO back to the presentation layer. Thus, the presentation layer is completely **isolated** from domain layer.

2
docs/en/framework/architecture/domain-driven-design/domain-services.md

@ -1,7 +1,5 @@
# Domain Services # Domain Services
## Introduction
In a [Domain Driven Design](../domain-driven-design) (DDD) solution, the core business logic is generally implemented in aggregates ([entities](./entities.md)) and the Domain Services. Creating a Domain Service is especially needed when; In a [Domain Driven Design](../domain-driven-design) (DDD) solution, the core business logic is generally implemented in aggregates ([entities](./entities.md)) and the Domain Services. Creating a Domain Service is especially needed when;
* You implement a core domain logic that depends on some services (like repositories or other external services). * You implement a core domain logic that depends on some services (like repositories or other external services).

44
docs/en/framework/fundamentals/caching.md

@ -1,14 +1,14 @@
# Distributed Caching # Distributed Caching
ABP extends the [ASP.NET Core distributed cache](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed). ABP extends the [ASP.NET Core distributed cache](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) to provide a more comfortable and easy-to-use cache service.
> **Default implementation of the `IDistributedCache` interface is` MemoryDistributedCache` which works in-memory.** See [ASP.NET Core's documentation](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) to see how to switch to Redis or another cache provider. Also, see the [Redis Cache](./redis-cache.md) document if you want to use Redis as the distributed cache server. > **Default implementation of the `IDistributedCache` interface is` MemoryDistributedCache` which works in-memory.** Memory cache is only useful if you are building a monolith application and you run a single instance of your application. For other cases, consider using a distributed cache server. See the ***[When to Use a Distributed Cache Server](../../kb/when-to-use-a-distributed-cache-server.md)*** document for more details.
## Installation ## Installation
> This package is already installed by default with the [application startup template](../../solution-templates/layered-web-application). So, most of the time, you don't need to install it manually. > This package is already installed by default in [startup templates](../../solution-templates/index.md). So, most of the time, you don't need to install it manually.
[Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching) is the main package of the caching system. You can install it a project using the add-package command of the [ABP CLI](../../cli): [Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching) is the main package of the caching system. You can install it as a project using the add-package command of the [ABP CLI](../../cli):
```bash ```bash
abp add-package Volo.Abp.Caching abp add-package Volo.Abp.Caching
@ -24,10 +24,10 @@ ASP.NET Core defines the `IDistributedCache` interface to get/set the cache valu
* It works with **byte arrays** rather than .NET objects. So, you need to **serialize/deserialize** the objects you need to cache. * It works with **byte arrays** rather than .NET objects. So, you need to **serialize/deserialize** the objects you need to cache.
* It provides a **single key pool** for all cache items, so; * It provides a **single key pool** for all cache items, so;
* You need to care about the keys to distinguish **different type of objects**. * You need to care about the keys to distinguish **different types of objects**.
* You need to care about the cache items of **different tenants** in a [multi-tenant](../architecture/multi-tenancy) system. * You need to care about the cache items of **different tenants** in a [multi-tenant](../architecture/multi-tenancy) system.
> `IDistributedCache` is defined in the `Microsoft.Extensions.Caching.Abstractions` package. That means it is not only usable for ASP.NET Core applications, but also available to **any type of applications**. > `IDistributedCache` is defined in the `Microsoft.Extensions.Caching.Abstractions` package. That means it is not only usable for ASP.NET Core applications but also available to **any type of applications**.
See [ASP.NET Core's distributed caching document](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) for more information. See [ASP.NET Core's distributed caching document](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) for more information.
@ -37,12 +37,12 @@ ABP defines the generic `IDistributedCache<TCacheItem>` interface in the [Volo.A
`IDistributedCache<TCacheItem>` solves the difficulties explained above; `IDistributedCache<TCacheItem>` solves the difficulties explained above;
* It internally **serializes/deserializes** the cached objects. Uses **JSON** serialization by default, but can be overridden by replacing the `IDistributedCacheSerializer` service in the [dependency injection](./dependency-injection.md) system. * It internally **serializes/deserializes** the cached objects. It uses **JSON** serialization by default but can be overridden by replacing the `IDistributedCacheSerializer` service in the [dependency injection](./dependency-injection.md) system.
* It automatically adds a **cache name** prefix to the cache keys based on the object type stored in the cache. Default cache name is the full name of the cache item class (`CacheItem` postfix is removed if your cache item class ends with it). You can use the **`CacheName` attribute** on the cache item class to set the cache name. * It automatically adds a **cache name** prefix to the cache keys based on the object type stored in the cache. The default cache name is the full name of the cache item class (`CacheItem` postfix is removed if your cache item class ends with it). You can use the **`CacheName` attribute** on the cache item class to set the cache name.
* It automatically adds the **current tenant id** to the cache key to distinguish cache items for different tenants (if your application is [multi-tenant](../architecture/multi-tenancy)). Define `IgnoreMultiTenancy` attribute on the cache item class to disable this if you want to share the cached objects among all tenants in a multi-tenant application. * It automatically adds the **current tenant id** to the cache key to distinguish cache items for different tenants (if your application is [multi-tenant](../architecture/multi-tenancy)). Define `IgnoreMultiTenancy` attribute on the cache item class to disable this if you want to share the cached objects among all tenants in a multi-tenant application.
* Allows to define a **global cache key prefix** per application, so different applications can use their isolated key pools in a shared distributed cache server. * Allows defining a **global cache key prefix** per application so different applications can use their isolated key pools in a shared distributed cache server.
* It **can tolerate errors** wherever possible and bypasses the cache. This is useful when you have temporary problems on the cache server. * It **can tolerate errors** wherever possible and bypasses the cache. This is useful when you have temporary problems on the cache server.
* It has methods like `GetManyAsync` and `SetManyAsync` which significantly improve the performance on **batch operations**. * It has methods like `GetManyAsync` and `SetManyAsync` which significantly improve the performance of **batch operations**.
**Example: Store Book names and prices in the cache** **Example: Store Book names and prices in the cache**
@ -167,7 +167,7 @@ namespace MyProject
```` ````
* This sample service uses the `GetOrAddAsync()` method to get a book item from the cache. * This sample service uses the `GetOrAddAsync()` method to get a book item from the cache.
* Since cache explicitly implemented as using `Guid` as cache key, `Guid` value passed to `_cache_GetOrAddAsync()` method. * Since the cache is explicitly implemented as using `Guid` as the cache key, the `Guid` value is passed to the `_cache_GetOrAddAsync()` method.
#### Complex Types as the Cache Key #### Complex Types as the Cache Key
@ -228,29 +228,29 @@ Configure<AbpDistributedCacheOptions>(options =>
* `HideErrors` (`bool`, default: `true`): Enables/disables hiding the errors on writing/reading values from the cache server. * `HideErrors` (`bool`, default: `true`): Enables/disables hiding the errors on writing/reading values from the cache server.
* `KeyPrefix` (`string`, default: `null`): If your cache server is shared by multiple applications, you can set a prefix for the cache keys for your application. In this case, different applications can not overwrite each other's cache items. * `KeyPrefix` (`string`, default: `null`): If your cache server is shared by multiple applications, you can set a prefix for the cache keys for your application. In this case, different applications can not overwrite each other's cache items.
* `GlobalCacheEntryOptions` (`DistributedCacheEntryOptions`): Used to set default distributed cache options (like `AbsoluteExpiration` and `SlidingExpiration`) used when you don't specify the options while saving cache items. Default value uses the `SlidingExpiration` as 20 minutes. * `GlobalCacheEntryOptions` (`DistributedCacheEntryOptions`): Used to set default distributed cache options (like `AbsoluteExpiration` and `SlidingExpiration`) used when you don't specify the options while saving cache items. The default value uses the `SlidingExpiration` as 20 minutes.
## Error Handling ## Error Handling
When you design a cache for your objects, you typically try to get the value from cache first. If not found in the cache, you query the object from the **original source**. It may be located in a **database** or may require to perform an HTTP call to a remote server. When you design a cache for your objects, you typically try to get the value from the cache first. If not found in the cache, you query the object from the **original source**. It may be located in a **database** or may require an HTTP call to a remote server to be performed.
In most cases, you want to **tolerate the cache errors**; If you get error from the cache server you don't want to cancel the operation. Instead, you silently hide (and log) the error and **query from the original source**. This is what the ABP does by default. In most cases, you want to **tolerate the cache errors**; If you get an error from the cache server, you don't want to cancel the operation. Instead, you silently hide (and log) the error and **query from the original source**. This is what the ABP does by default.
ABP's Distributed Cache [handle](./exception-handling.md), log and hide errors by default. There is an option to change this globally (see the options below). ABP's Distributed Cache [handle](./exception-handling.md), log and hide errors by default. There is an option to change this globally (see the options below).
In addition, all of the `IDistributedCache<TCacheItem>` (and `IDistributedCache<TCacheItem, TCacheKey>`) methods have an optional `hideErrors` parameter, which is `null` by default. The global value is used if this parameter left as `null`, otherwise you can decide to hide or throw the exceptions for individual method calls. In addition, all of the `IDistributedCache<TCacheItem>` (and `IDistributedCache<TCacheItem, TCacheKey>`) methods have an optional `hideErrors` parameter, which is `null` by default. The global value is used if this parameter is left as `null`; otherwise, you can decide to hide or throw the exceptions for individual method calls.
## Batch Operations ## Batch Operations
ABP's distributed cache interfaces provide methods to perform batch methods those improves the performance when you want to batch operation multiple cache items in a single method call. ABP's distributed cache interfaces provide methods to perform batch operations that improve performance when you want to batch operation multiple cache items in a single method call.
* `SetManyAsync` and `SetMany` methods can be used to set multiple values to the cache. * `SetManyAsync` and `SetMany` methods can be used to set multiple values to the cache.
* `GetManyAsync` and `GetMany` methods can be used to retrieve multiple values from the cache. * `GetManyAsync` and `GetMany` methods can be used to retrieve multiple values from the cache.
* `GetOrAddManyAsync` and `GetOrAddMany` methods can be used to retrieve multiple values and set missing values from the cache * `GetOrAddManyAsync` and `GetOrAddMany` methods can be used to retrieve multiple values and set missing values from the cache
* `RefreshManyAsync` and `RefreshMany` methods can be used to resets the sliding expiration timeout of multiple values from the cache * `RefreshManyAsync` and `RefreshMany` methods can be used to reset the sliding expiration timeout of multiple values from the cache
* `RemoveManyAsync` and `RemoveMany` methods can be used to remove multiple values from the cache * `RemoveManyAsync` and `RemoveMany` methods can be used to remove multiple values from the cache
> These are not standard methods of the ASP.NET Core caching. So, some providers may not support them. They are supported by the [ABP Redis Cache integration package](./redis-cache.md). If the provider doesn't support, it fallbacks to `SetAsync` and `GetAsync` ... methods (called once for each item). > These are not standard methods of the ASP.NET Core caching. So, some providers may not support them. They are supported by the [ABP Redis Cache integration package](./redis-cache.md). If the provider doesn't support it, it falls back to `SetAsync` and `GetAsync` ... methods (called once for each item).
## Caching Entities ## Caching Entities
@ -266,17 +266,17 @@ It's designed as read-only and automatically invalidates a cached entity if the
Distributed cache service provides an interesting feature. Assume that you've updated the price of a book in the database, then set the new price to the cache, so you can use the cached value later. What if you have an exception after setting the cache and you **rollback the transaction** that updates the price of the book? In this case, cache value will be incorrect. Distributed cache service provides an interesting feature. Assume that you've updated the price of a book in the database, then set the new price to the cache, so you can use the cached value later. What if you have an exception after setting the cache and you **rollback the transaction** that updates the price of the book? In this case, cache value will be incorrect.
`IDistributedCache<..>` methods gets an optional parameter, named `considerUow`, which is `false` by default. If you set it to `true`, then the changes you made for the cache are not actually applied to the real cache store, but associated with the current [unit of work](../architecture/domain-driven-design/unit-of-work.md). You get the value you set in the same unit of work, but the changes are applied **only if the current unit of work succeed**. `IDistributedCache<..>` methods gets an optional parameter, named `considerUow`, which is `false` by default. If you set it to `true`, then the changes you made for the cache are not actually applied to the real cache store, but associated with the current [unit of work](../architecture/domain-driven-design/unit-of-work.md). You get the value you set in the same unit of work, but the changes are applied **only if the current unit of work succeeds**.
### IDistributedCacheSerializer ### IDistributedCacheSerializer
`IDistributedCacheSerializer` service is used to serialize and deserialize the cache items. Default implementation is the `Utf8JsonDistributedCacheSerializer` class that uses `IJsonSerializer` service to convert objects to [JSON](../../json-serialization.md) and vice verse. Then it uses UTC8 encoding to convert the JSON string to a byte array which is accepted by the distributed cache. `IDistributedCacheSerializer` service is used to serialize and deserialize the cache items. The default implementation is the `Utf8JsonDistributedCacheSerializer` class that uses `IJsonSerializer` service to convert objects to [JSON](../../json-serialization.md) and vice verse. Then it uses UTC8 encoding to convert the JSON string to a byte array which is accepted by the distributed cache.
You can [replace](./dependency-injection.md) this service by your own implementation if you want to implement your own serialization logic. You can [replace](./dependency-injection.md) this service with your own implementation if you want to implement your own serialization logic.
### IDistributedCacheKeyNormalizer ### IDistributedCacheKeyNormalizer
`IDistributedCacheKeyNormalizer` is implemented by the `DistributedCacheKeyNormalizer` class by default. It adds cache name, application cache prefix and current tenant id to the cache key. If you need a more advanced key normalization, you can [replace](./dependency-injection.md) this service by your own implementation. `IDistributedCacheKeyNormalizer` is implemented by the `DistributedCacheKeyNormalizer` class by default. It adds the cache name, application cache prefix and current tenant ID to the cache key. If you need a more advanced key normalization, you can [replace](./dependency-injection.md) this service with your own implementation.
## See Also ## See Also

7
docs/en/framework/infrastructure/background-jobs/index.md

@ -221,6 +221,13 @@ public class MyModule : AbpModule
} }
```` ````
* `JobPollPeriod` is used to determine the interval between two job polling operations. Default is 5000 ms (5 seconds).
* `MaxJobFetchCount` is used to determine the maximum job count to fetch in a single polling operation. Default is 1000.
* `DefaultFirstWaitDuration` is used to determine the duration to wait before the first retry. Default is 60 seconds.
* `DefaultTimeout` is used to determine the timeout duration for a job. Default is 172800 seconds (2 days).
* `DefaultWaitFactor` is used to determine the factor to increase the wait duration between retries. Default is 2.0.
* `DistributedLockName` is used to determine the distributed lock name to use. Default is `AbpBackgroundJobWorker`.
### Data Store ### Data Store
The default background job manager needs a data store to save and read jobs. It defines `IBackgroundJobStore` as an abstraction to store the jobs. The default background job manager needs a data store to save and read jobs. It defines `IBackgroundJobStore` as an abstraction to store the jobs.

12
docs/en/framework/infrastructure/features.md

@ -161,8 +161,16 @@ namespace FeaturesDemo
{ {
var myGroup = context.AddGroup("MyApp"); var myGroup = context.AddGroup("MyApp");
myGroup.AddFeature("MyApp.PdfReporting", defaultValue: "false"); myGroup.AddFeature(
myGroup.AddFeature("MyApp.MaxProductCount", defaultValue: "10"); "MyApp.PdfReporting",
defaultValue: "false"
);
myGroup.AddFeature(
"MyApp.MaxProductCount",
defaultValue: "10",
valueType: new FreeTextStringValueType(new NumericValueValidator())
);
} }
} }
} }

109
docs/en/framework/ui/blazor/global-scripts-styles.md

@ -1,83 +1,72 @@
# Blazor UI: Managing Global Scripts & Styles # Blazor UI: Managing Global Scripts & Styles
Some modules may require additional styles or scripts that need to be referenced in **index.html** file. It's not easy to find and update these types of references in Blazor apps. ABP offers a simple, powerful, and modular way to manage global style and scripts in Blazor apps. You can add your JavaScript and CSS files from your modules or applications to the Blazor global assets system. All the JavaScript and CSS files will be added to the `global.js` and `global.css` files. You can access these files via the following URL in a Blazor WASM project:
To update script & style references without worrying about dependencies, ordering, etc in a project, you can use the [bundle command](../../../cli#bundle). - https://localhost/global.js
- https://localhost/global.css
You can also add custom styles and scripts and let ABP manage them for you. In your Blazor project, you can create a class implementing `IBundleContributor` interface. ## Add JavaScript and CSS to the global assets system in the module
`IBundleContributor` interface contains two methods. Your module project solution will have two related Blazor projects:
* `AddScripts(...)` * `MyModule.Blazor`:This project includes the JavaScript/CSS files required for your Blazor components. The `MyApp.Blazor.Client (Blazor WASM)` project will reference this project.
* `AddStyles(...)` * `MyModule.Blazor.WebAssembly.Bundling`:This project is used to add your JavaScript/CSS files to the Blazor global resources. The `MyModule.Blazor (ASP.NET Core)` project will reference this project.
Both methods get `BundleContext` as a parameter. You can add scripts and styles to the `BundleContext` and run [bundle command](../../../cli#bundle). Bundle command detects custom styles and scripts with module dependencies and updates `index.html` file. You need to define JavaScript and CSS contributor classes in the `MyModule.Blazor.WebAssembly.Bundling` project to add the files to the global assets system.
## Example Usage > Please use `BlazorWebAssemblyStandardBundles.Scripts.Global` and `BlazorWebAssemblyStandardBundles.Styles.Global` for the bundle name.
```csharp
namespace MyProject.Blazor ```cs
public class MyModuleBundleScriptContributor : BundleContributor
{ {
public class MyProjectBundleContributor : IBundleContributor public override void ConfigureBundle(BundleConfigurationContext context)
{ {
public void AddScripts(BundleContext context) context.Files.AddIfNotContains("_content/MyModule.Blazor/libs/myscript.js");
{
context.Add("site.js");
}
public void AddStyles(BundleContext context)
{
context.Add("main.css");
context.Add("custom-styles.css");
}
} }
} }
``` ```
> There is a BundleContributor class implementing `IBundleContributor` interface coming by default with the startup templates. So, most of the time, you don't need to add it manually. ```cs
public class MyModuleBundleStyleContributor : BundleContributor
## Bundling And Minification
`abp bundle` command offers bundling and minification support for client-side resources(JavaScript and CSS files). `abp bundle` command reads the `appsettings.json` file inside the Blazor project and bundles the resources according to the configuration. You can find the bundle configurations inside `AbpCli.Bundle` element.
Here are the options that you can control inside the `appsettings.json` file.
`Mode`: Bundling and minification mode. Possible values are
* `BundleAndMinify`: Bundle all the files into a single file and minify the content.
* `Bundle`: Bundle all files into a single file, but not minify.
* `None`: Add files individually, do not bundle.
`Name`: Bundle file name. Default value is `global`.
`Parameters`: You can define additional key/value pair parameters inside this section. `abp bundle` command automatically sends these parameters to the bundle contributors, and you can check these parameters inside the bundle contributor, take some actions according to these values.
Let's say that you want to exclude some resources from the bundle and control this action using the bundle parameters. You can add a parameter to the bundle section like below.
```json
"AbpCli": {
"Bundle": {
"Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */
"Name": "global",
"Parameters": {
"ExcludeThemeFromBundle":"true"
}
}
}
```
You can check this parameter and take action like below.
```csharp
public class MyProjectNameBundleContributor : IBundleContributor
{ {
public void AddScripts(BundleContext context) public override void ConfigureBundle(BundleConfigurationContext context)
{ {
context.Files.AddIfNotContains("_content/MyModule.Blazor/libs/mystyle.css");
} }
}
```
public void AddStyles(BundleContext context) ```cs
[DependsOn(
typeof(AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule)
)]
public class MyBlazorWebAssemblyBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{ {
var excludeThemeFromBundle = bool.Parse(context.Parameters.GetValueOrDefault("ExcludeThemeFromBundle")); Configure<AbpBundlingOptions>(options =>
context.Add("mytheme.css", excludeFromBundle: excludeThemeFromBundle); {
context.Add("main.css"); // Add script bundle
options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global)
.AddContributors(typeof(MyModuleBundleScriptContributor));
// Add style bundle
options.StyleBundles.Get(BlazorWebAssemblyStandardBundles.Styles.Global)
.AddContributors(typeof(MyModuleBundleStyleContributor));
});
} }
} }
``` ```
## Add JavaScript and CSS to the global assets system in the application
This is similar to the module. You need to define JavaScript and CSS contributor classes in the `MyApp.Blazor.Client` project to add the files to the global assets system.
## AbpBundlingGlobalAssetsOptions
You can configure the JavaScript and CSS file names in the `GlobalAssets` property of the `AbpBundlingOptions` class. The default values are `global.js` and `global.css`.
## Reference
- [ASP.NET Core MVC Bundling & Minification](../mvc-razor-pages/bundling-minification#bundle-contributorsg)
- [ABP Global Assets - New way to bundle JavaScript/CSS files in Blazor WebAssembly app](https://github.com/abpframework/abp/blob/dev/docs/en/Community-Articles/2024-11-25-Global-Assets/POST.md)

6
docs/en/framework/ui/mvc-razor-pages/tag-helpers/dynamic-forms.md

@ -23,7 +23,7 @@ public class DynamicFormsModel : PageModel
new SelectListItem { Value = "CA", Text = "Canada"}, new SelectListItem { Value = "CA", Text = "Canada"},
new SelectListItem { Value = "US", Text = "USA"}, new SelectListItem { Value = "US", Text = "USA"},
new SelectListItem { Value = "UK", Text = "United Kingdom"}, new SelectListItem { Value = "UK", Text = "United Kingdom"},
new SelectListItem { Value = "RU", Text = "Russia"} new SelectListItem { Value = "RU", Text = "Turkey"}
}; };
public void OnGet() public void OnGet()
@ -217,7 +217,7 @@ public class DynamicFormsModel : PageModel
new SelectListItem { Value = "CA", Text = "Canada"}, new SelectListItem { Value = "CA", Text = "Canada"},
new SelectListItem { Value = "US", Text = "USA"}, new SelectListItem { Value = "US", Text = "USA"},
new SelectListItem { Value = "UK", Text = "United Kingdom"}, new SelectListItem { Value = "UK", Text = "United Kingdom"},
new SelectListItem { Value = "RU", Text = "Russia"} new SelectListItem { Value = "RU", Text = "Turkey"}
}; };
public void OnGet() public void OnGet()
@ -278,4 +278,4 @@ public string Name { get; set; }
## See Also ## See Also
* [Form Elements](form-elements.md) * [Form Elements](form-elements.md)

34
docs/en/get-started/layered-web-application.md

@ -13,31 +13,15 @@ In this quick start guide, you will learn how to create and run a layered (and p
## Setup your development environment ## Setup your development environment
First things first! Let's setup your development environment before creating the first project. First things first! Let's setup your development environment before creating the first project. The following tools should be installed on your development machine:
### Pre-requirements * [Visual Studio 2022](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet){{ if UI != "Blazor" }}
* [Node v22.11+](https://nodejs.org/)
* [Yarn v1.22+ (not v2+)](https://classic.yarnpkg.com/en/docs/install) or npm v10+ (already installed with Node){{ end }}
* [Docker Desktop](https://www.docker.com/products/docker-desktop/)
The following tools should be installed on your development machine: > Check the [Pre-requirements document](pre-requirements.md) for more detailed information about these tools.
* [Visual Studio 2022](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development. <sup id="a-editor">[1](#f-editor)</sup>
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
{{ if UI != "Blazor" }}
* [Node v20.11+](https://nodejs.org/)
* [Yarn v1.22+ (not v2)](https://classic.yarnpkg.com/en/docs/install) <sup id="a-yarn">[2](#f-yarn)</sup> or npm v10+ (already installed with Node)
{{ end }}
{{ if Tiered == "Yes" }}
* [Redis](https://redis.io/) (as the [distributed cache](../framework/fundamentals/caching.md)).
{{ else }}
* [Redis](https://redis.io/) (as the [distributed cache](../framework/fundamentals/caching.md)) is required if you select the Public website option.
{{ end }}
<sup id="f-editor"><b>1</b></sup> _You can use another editor instead of Visual Studio as long as it supports .NET Core and ASP.NET Core._ <sup>[↩](#a-editor)</sup>
{{ if UI != "Blazor" }}
<sup id="f-yarn"><b>2</b></sup> _Yarn v2 works differently and is not supported._ <sup>[↩](#a-yarn)</sup>
{{ end }}
## Creating a New Solution ## Creating a New Solution
@ -147,7 +131,7 @@ In the Solution Runner section (on the left side) you can see all the runnable a
You can run all the applications or start them one by one. To start an application, either click the *Play* icon near to the application or right-click and select the *Run* -> *Start* context menu item. You can run all the applications or start them one by one. To start an application, either click the *Play* icon near to the application or right-click and select the *Run* -> *Start* context menu item.
> For the first run, you'll need to build the application. You can achieve this by selecting *Run* -> *Build & Start* from the context menu. > ABP Studio builds the application by default. So, you don't need to manually build the application before running it.
You can start the following application(s): You can start the following application(s):
@ -229,7 +213,7 @@ You can start the following application(s):
{{ else }} {{ else }}
- `Acme.BookStore.Web` - `Acme.BookStore.Web`
{{ end }} {{ end }}
Before starting the mobile application, ensure that you configure it for [react-native](../framework/ui/react-native) or [MAUI](../framework/ui/maui). Before starting the mobile application, ensure that you configure it for [react-native](../framework/ui/react-native) or [MAUI](../framework/ui/maui).
![mobile-sample](images/abp-studio-mobile-sample.gif) ![mobile-sample](images/abp-studio-mobile-sample.gif)

23
docs/en/get-started/microservice.md

@ -4,6 +4,21 @@
In this quick start guide, you will learn how to create and run a microservice solution using [ABP Studio](../studio/index.md). In this quick start guide, you will learn how to create and run a microservice solution using [ABP Studio](../studio/index.md).
## Setup your development environment
First things first! Let's setup your development environment before creating the first project. The following tools should be installed on your development machine:
* [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) or another IDE that supports .NET development
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
* [Node v22.11+](https://nodejs.org/)
* [Yarn v1.22+ (not v2+)](https://classic.yarnpkg.com/en/docs/install) or npm v10+ (already installed with Node)
* [Docker Desktop (with Kubernetes enabled)](https://www.docker.com/products/docker-desktop/)
* [Helm](https://helm.sh/docs/intro/install/)
* [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx/deploy/)
* [mkcert](https://github.com/FiloSottile/mkcert#installation)
> Check the [Pre-requirements document](pre-requirements.md) for more detailed information about these tools.
## Creating a New Solution ## Creating a New Solution
> 🛈 This document uses [ABP Studio](../studio/index.md) to create new ABP solutions. **ABP Studio** is in the beta version now. If you have any issues, you can use the [ABP CLI](../cli/index.md) to create new solutions. You can also use the [getting started page](https://abp.io/get-started) to easily build ABP CLI commands for new project creations. > 🛈 This document uses [ABP Studio](../studio/index.md) to create new ABP solutions. **ABP Studio** is in the beta version now. If you have any issues, you can use the [ABP CLI](../cli/index.md) to create new solutions. You can also use the [getting started page](https://abp.io/get-started) to easily build ABP CLI commands for new project creations.
@ -127,13 +142,11 @@ In the *Solution Runner* section (on the left side) you can see all the runnable
As shown in the figure above, the executable applications are grouped into folders like `apps`, `gateways`, `infrastructure`, and `services`. You can start/stop them all, a group (folder) of them, or one by one. As shown in the figure above, the executable applications are grouped into folders like `apps`, `gateways`, `infrastructure`, and `services`. You can start/stop them all, a group (folder) of them, or one by one.
Before running the applications, it is good to be sure that all applications are built. To do that, right-click the root item in the *Solution Runner* and select *Build* -> *Build All* action. Before running the applications, you can run the all application by right-clicking the root item in the *Solution Runner* and select *Build* -> *Build All* action. However, you don't need to do that, because ABP Studio builds the applications before running them by default.
![abp-studio-microservice-solution-runner-build-all](images/abp-studio-microservice-solution-runner-build-all.png)
> *Solution Runner* doesn't build an application before running it. That provides a great performance gain because most of the time you will work on one or a few services and you don't need to build all of the other applications in every run. However, if you want to build before running, you can right-click an item in the *Solution Runner* tree and select *Run* -> *Build & Start* command. > If you want to change this behavior, and don't want ABP Studio to build before running the applications, you can click the *Manage start actions* button in the *Solution Runner*, which you can see from the root item or per folder.
It will take some time to build all. Once all is done, you can start the system. You can click the *Play* button on the root item in Solution Runner to start all the applications. You can click the *Play* button on the root item in *Solution Runner* to start all the applications.
> **About the Docker Containers** > **About the Docker Containers**
> >

107
docs/en/get-started/pre-requirements.md

@ -0,0 +1,107 @@
# Prerequisites for Developing ABP Applications
This document will guide you through preparing your development environment for ABP based application development.
## Notices
The prerequisites mentioned in this document are not necessary for every project type;
* You don't need to install the EF Core CLI if your application uses MongoDB instead of EF Core.
* You don't need to install Helm, NGINX Ingress, or mkcert if you are developing a non-microservice application.
`README.MD` files in new solutions contain specific requirements for your solution. Please refer to the `README.MD` file of your solution.
## IDE
You need to use an IDE that supports .NET development. The following IDEs are the most popular ones for .NET development.
### Visual Studio
Visual Studio is Microsoft's IDE and is the de facto tool for developing .NET projects. You can download Visual Studio from the [Visual Studio official website](https://visualstudio.microsoft.com/). It also has a **free Community edition** which is more than enough for ABP projects.
### Visual Studio Code
Visual Studio Code is a **free and cross-platform** lightweight code editor that supports .NET development. You can [download from here](https://code.visualstudio.com/download).
### JetBrains Rider
[JetBrains Rider](https://www.jetbrains.com/rider/download) is a cross-platform IDE by [JetBrains](https://www.jetbrains.com/) that supports .NET development. It is **[free for non-commercial use](https://blog.jetbrains.com/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/)**.
## .NET SDK
ABP is based on NET, so you need to install the .NET SDK. You can download the .NET SDK from the [.NET official website](https://dotnet.microsoft.com/en-us/download/dotnet/9.0).
> Installing Visual Studio or JetBrains Rider may automatically install the .NET SDK.
### EF Core CLI
If you are using [Entity Framework Core](https://learn.microsoft.com/en-us/ef/core/) as your database access provider, you need to install the [EF Core CLI](https://learn.microsoft.com/en-us/ef/core/cli/dotnet). You can install it by running the following command:
```bash
dotnet tool install --global dotnet-ef
```
If you have already installed the `EF Core CLI`, you can update it by running the following command:
```bash
dotnet tool update --global dotnet-ef
```
## Node.js and Yarn
ABP projects include some frontend resource packages, so you need to install Node.js and Yarn to manage these resource packages. You can download Node.js from the [official Node.js website](https://nodejs.org/). We recommend installing version v20.11+.
Using Yarn (classic) to manage frontend resource packages is faster and more stable than using npm. You can download `Yarn` from the [Yarn official website](https://classic.yarnpkg.com/en/docs/install). We recommend installing Yarn v1.22+ (make sure to install the Classic version, not v2+).
To install Yarn using npm, run the following command:
```bash
npm install --global yarn
```
## Docker Engine or Docker Desktop
ABP's [Layered Solution](../solution-templates/layered-web-application/index.md) and [Microservice Solution](../solution-templates/microservice/index.md) use Docker to run infrastructure services (e.g. SQL Server, Redis, RabbitMQ) required by your application. You can install Docker Engine or Docker Desktop (recommended) on Windows, macOS and Linux.
* [Docker Desktop](https://www.docker.com/products/docker-desktop/) (recommended)
* [Docker Engine](https://docs.docker.com/engine/install/)
### Is Docker Engine or Docker Desktop Free?
Docker Engine is an open-source and free containerization technology for building and containerizing your applications. [`Docker Engine` follows the Apache License 2.0](https://docs.docker.com/engine/#licensing).
Docker Desktop is free [for small businesses (fewer than 250 employees and less than $10 million in annual revenue), personal use, education, and non-commercial open-source projects](https://docs.docker.com/subscription/desktop-license/).
## PowerShell
ABP startup solution templates and tools use some PowerShell scripts (`*.ps1`) to perform certain tasks. You can refer to the [PowerShell documentation](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell) for guidance on how to install PowerShell on Windows, macOS, and Linux.
* [Install PowerShell on Windows](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows)
* [Install PowerShell on macOS](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos)
* [Install PowerShell on Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux)
## MicroService Solution
The following tools are only required to develop ABP's [microservice solution](../solution-templates/microservice/index.md)
### Helm
[Helm](https://helm.sh/) is a package manager for Kubernetes. You can install Helm by following the [Helm installation guide](https://helm.sh/docs/intro/install/).
See [Helm Deployment on Local Kubernetes Cluster](../solution-templates/microservice/helm-charts-and-kubernetes.md) for more information.
### NGINX Ingress or NGINX Ingress using Helm
[NGINX Ingress](https://kubernetes.github.io/ingress-nginx/deploy/) is an Ingress controller for Kubernetes. You can install NGINX Ingress by following the [NGINX Ingress installation guide](https://kubernetes.github.io/ingress-nginx/deploy/).
If you are using Helm, you can install NGINX Ingress using the following commands:
```cs
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm upgrade --install --version=4.0.19 ingress-nginx ingress-nginx/ingress-nginx
```
### mkcert
Use mkcert to generate trusted certificates for local development. You can install mkcert by following the [official mkcert installation guide](https://github.com/FiloSottile/mkcert#installation).

31
docs/en/get-started/single-layer-web-application.md

@ -12,31 +12,14 @@ In this quick start guide, you will learn how to create and run a single layer w
## Setup your development environment ## Setup your development environment
First things first! Let's setup your development environment before creating the first project. First things first! Let's setup your development environment before creating the first project. The following tools should be installed on your development machine:
### Pre-requirements * [Visual Studio 2022](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet){{ if UI != "Blazor" }}
* [Node v22.11+](https://nodejs.org/)
* [Yarn v1.22+ (not v2+)](https://classic.yarnpkg.com/en/docs/install) or npm v10+ (already installed with Node){{ end }}
The following tools should be installed on your development machine: > Check the [Pre-requirements document](pre-requirements.md) for more detailed information about these tools.
* [Visual Studio 2022](https://visualstudio.microsoft.com/) or another IDE that supports [.NET 9.0+](https://dotnet.microsoft.com/download/dotnet) development. <sup id="a-editor">[1](#f-editor)</sup>
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
{{ if UI != "Blazor" }}
* [Node v20.11+](https://nodejs.org/)
* [Yarn v1.22+ (not v2)](https://classic.yarnpkg.com/en/docs/install) <sup id="a-yarn">[2](#f-yarn)</sup> or npm v10+ (already installed with Node)
{{ end }}
{{ if Tiered == "Yes" }}
* [Redis](https://redis.io/) (as the [distributed cache](../framework/fundamentals/caching.md)).
{{ else }}
* [Redis](https://redis.io/) (as the [distributed cache](../framework/fundamentals/caching.md)) is required if you select the Public website option.
{{ end }}
<sup id="f-editor"><b>1</b></sup> _You can use another editor instead of Visual Studio as long as it supports .NET Core and ASP.NET Core._ <sup>[↩](#a-editor)</sup>
{{ if UI != "Blazor" }}
<sup id="f-yarn"><b>2</b></sup> _Yarn v2 works differently and is not supported._ <sup>[↩](#a-yarn)</sup>
{{ end }}
## Creating a New Solution ## Creating a New Solution
@ -116,8 +99,6 @@ In the Solution Runner section (on the left side) you can see all the runnable a
To start an application, either click the *Play* icon near to the application or right-click and select the *Run* -> *Start* context menu item. To start an application, either click the *Play* icon near to the application or right-click and select the *Run* -> *Start* context menu item.
> For the first run, you'll need to build the application. You can achieve this by selecting *Run* -> *Build & Start* from the context menu.
You can start the `Acme.BookStore`{{ if UI == "NG" }} and `Acme.BookStore.Angular`{{ end }}. You can start the `Acme.BookStore`{{ if UI == "NG" }} and `Acme.BookStore.Angular`{{ end }}.
Once the `Acme.BookStore{{ if UI == "NG" }}.Angular{{ end }}` application started, you can right-click it and select the *Browse* command: Once the `Acme.BookStore{{ if UI == "NG" }}.Angular{{ end }}` application started, you can right-click it and select the *Browse* command:

6
docs/en/kb/index.md

@ -0,0 +1,6 @@
# ABP Knowledge Base
The following documents provide useful information about several topics you might need to know.
* [How to Fix "Filename too long" Error on Windows](windows-path-too-long-fix.md)
* [When to Use a Distributed Cache Server](when-to-use-a-distributed-cache-server.md)

49
docs/en/kb/when-to-use-a-distributed-cache-server.md

@ -0,0 +1,49 @@
# When to Use a Distributed Cache Server
ABP provides a [distributed cache service](../framework/fundamentals/caching.md) that is based on [ASP.NET Core's distributed cache](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed). This document explains when you need to have a separate cache server for your applications.
## Understanding the Default Cache Service
**Default implementation of the cache service works in-memory**. Memory cache is only useful if you are building a monolith application and you run a single instance of your application. For other cases, **you should use a real distributed cache server**.
Here are a few example cases where you should use a distributed cache server:
* You have a **monolith application**, but you run **multiple instances** of that application concurrently, for example, in a [clustered environment](../deployment/clustered-environment.md)
* You build a **microservice** or any kind of **distributed** system
* You have web **multiple applications** in your solution and they should share the same cache
The problem is obvious: If each application instance uses its internal in-memory cache, and if two or more applications cache the same data, it is probable that they will cache different copies of the data. In that case, there is no way to **invalidate/refresh** that data in every application's memory when the data changes.
## What is a Distributed Cache Server
A **distributed cache server** (e.g. [Redis](../framework/fundamentals/redis-cache.md)) stores cache objects in a separate server application and allows multiple applications/processes to share the same cache objects. In that way;
* All applications/services and all their instances use the same cache store and share the same cached objects. Once an application instance refreshes a cached object, all others use the new object.
* Even if your applications stop and restart, the cached objects are not lost, since they are managed by a separate cache server.
## How to Use a Distributed Cache Server
ABP [solution templates](../solution-templates/index.md) come with Redis configured when it is certainly necessary. For example;
* The [microservice startup template](../solution-templates/microservice/index.md) always comes with [Redis configured](../solution-templates/microservice/distributed-cache.md) and also included as a docker container.
* The application startup template comes with Redis configured when you select multiple applications, tiered architecture, or some other configuration that requires a distributed cache server.
In other cases, to keep the dependencies minimal, they come with the default (in-memory) cache configuration. In those cases, if you need a distributed cache server, you should manually switch to a distributed cache provider for your application.
See the *[Redis Cache](../framework/fundamentals/redis-cache.md)* document if you need to use Redis as the distributed cache server. See [ASP.NET Core's documentation](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) to see how to switch to another cache provider.
### Installing a Redis Server to Your Local Environment
If you want to use Redis as your distributed cache provider in your development environment, you can simply use the [official Redis docker image](https://hub.docker.com/_/redis). Once you have [Docker](https://www.docker.com/products/docker-desktop/) in your local machine, you can use the following command to run a Redis container and map the default Redis port:
````bash
docker run -p 6379:6379 --name RedisServer -d redis
````
You can check the [official Redis docker image](https://hub.docker.com/_/redis) document for more options.
## See Also
* [ABP Distributed Cache](../framework/fundamentals/caching.md)
* [ASP.NET Core Distributed Cache](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed)

28
docs/en/release-info/migration-guides/openiddict5-to-6.md

@ -0,0 +1,28 @@
# OpenIddict 5.x to 6.x Migration Guide
The 6.0 release of OpenIddict is a major release that introduces breaking changes.
Check this blog [OpenIddict 6.0 general availability](https://kevinchalet.com/2024/12/17/openiddict-6-0-general-availability/) for the new features introduced in OpenIddict 6.0. and the [Migrate to OpenIddict 6.0](https://documentation.openiddict.com/guides/migration/50-to-60) for more information about the changes.
In this guide, we will explain the changes you need to make to your ABP application.
## Constant changes
The following constants have been renamed:
| Old Constant Name | New Constant Name |
|---------------------------------------------------------------|-----------------------------------------------------------------|
| `OpenIddictConstants.Permissions.Endpoints.Logout` | `OpenIddictConstants.Permissions.Endpoints.EndSession` |
| `OpenIddictConstants.Permissions.Endpoints.Device` | `OpenIddictConstants.Permissions.Endpoints.DeviceAuthorization` |
## IdentityModel packages
If you have a reference to `IdentityModel` directly, please upgrade the necessary package versions to the latest stable version, which is currently 8.3.0:
* [System.IdentityModel.Tokens.Jwt](https://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/)
* [Microsoft.IdentityModel.Protocols.OpenIdConnect](https://www.nuget.org/packages/Microsoft.IdentityModel.Protocols.OpenIdConnect/)
* [Microsoft.IdentityModel.Tokens](https://www.nuget.org/packages/Microsoft.IdentityModel.Tokens/)
* [Microsoft.IdentityModel.JsonWebTokens](https://www.nuget.org/packages/Microsoft.IdentityModel.JsonWebTokens/)
That's all, it's a simple migration! If you have advanced usage of OpenIddict, please check the [official migration guide](https://documentation.openiddict.com/guides/migration/50-to-60) for more information.

BIN
docs/en/solution-templates/application-module/images/additional-options.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
docs/en/solution-templates/application-module/images/create-new-module.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
docs/en/solution-templates/application-module/images/issuemanagement-module-solution.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
docs/en/solution-templates/application-module/images/new-module.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
docs/en/solution-templates/application-module/images/new-solution.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
docs/en/solution-templates/application-module/images/select-database-provider.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
docs/en/solution-templates/application-module/images/select-user-interface.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

BIN
docs/en/solution-templates/application-module/images/solution-properties.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

48
docs/en/solution-templates/application-module/index.md

@ -4,43 +4,51 @@ This template can be used to create a **reusable [application module](../../modu
## How to Start With? ## How to Start With?
You can use the [ABP CLI](../../cli) to create a new project using this startup template. Alternatively, you can generate a CLI command from the [Get Started](https://abp.io/get-started) page. CLI approach is used here. You can use the [ABP CLI](../../cli) or [ABP Studio](../../studio/overview.md) to create a new project using this startup template. Alternatively, you can generate a CLI command from the [Get Started](https://abp.io/get-started) page. We will use the ABP Studio for this guide.
First, install the ABP CLI if you haven't installed before: First, install the ABP Studio if you haven't installed before. You can follow the [installation guide](../../studio/installation.md) for this.
```bash ### Creating a New Empty Solution
dotnet tool install -g Volo.Abp.Studio.Cli
```
Then use the `abp new` command in an empty folder to create a new solution: Open the ABP Studio and click the `New solution` button in the welcome page or the `File > New Solution` top menu item. Select the `Empty Solution` template and click the `Next` button.
```bash ![New Solution](images/new-solution.png)
abp new-module Acme.BookStore
``` Enter the solution name, select the solution folder and click the `Create` button.
![Solution Properties](images/solution-properties.png)
- `Acme.IssueManagement` is the solution name, like *YourCompany.YourProduct*. You can use single level, two-levels or three-levels naming. - `Acme.IssueManagement` is the solution name, like *YourCompany.YourProduct*. You can use single level, two-levels or three-levels naming.
### Specifying the User Interface > To understand the terms solution, module, and package, refer to the ABP Studio [concepts](../../studio/concepts.md) document.
### Creating a New DDD Module
When you create a new solution, the solution explorer on the left side of the screen will appear empty. Right-click on the root of the solution and select `Add > New Module > DDD Module` from the context menu.
![New Module](images/new-module.png)
The `Create New Module` dialog will open. Enter the module name and click the `Next` button.
![Create New Module](images/create-new-module.png)
Now, you can select the user interface options or leave it empty to create a module without a user interface. A module can support multiple user interfaces, such as MVC, Blazor, Angular, etc., or none at all. Click the `Next` button to specify the database provider.
The template comes without a user interface by default. You can use the `mvc`, `blazor`, `blazor-server`, or `angular` options to include any of these UI layers. You can also combine them. For example, you can use `mvc,angular` to include both MVC and Angular UI. To create a module without a user interface, don't specify any value. ![Select User Interface](images/select-user-interface.png)
````bash Select the database provider(s) you want to use in your module. You can choose `EntityFrameworkCore`, `MongoDB`, or both. Unlike the user interface options, you must select at least one database provider. Click the `Next` button to see the additional options.
abp new-module Acme.IssueManagement -u mvc,angular
````
#### Specifying the Database Provider ![Select Database Provider](images/select-database-provider.png)
The template comes with the *EntityFrameworkCore* database provider by default. You can use the `ef` or `mongodb` options to include either of these providers. You can also combine them. For example, you can use `ef,mongodb` to include both EntityFrameworkCore and MongoDB. You can exclude the test projects from the module by unchecking the `Include Tests` option. Click the `Create` button to create the module.
````bash ![Additional Options](images/additional-options.png)
abp new-module Acme.IssueManagement -d ef,mongodb
````
## Solution Structure ## Solution Structure
Based on the options you've specified, you will get a slightly different solution structure. If you don't specify any option, you will have a solution like shown below: Based on the options you've specified, you will get a slightly different solution structure. If you don't specify any option, you will have a solution like shown below:
![issuemanagement-module-solution](../../images/issuemanagement-module-solution.png) ![issuemanagement-module-solution](images/issuemanagement-module-solution.png)
Projects are organized as `src` and`test` folders: Projects are organized as `src` and`test` folders:

2
docs/en/solution-templates/index.md

@ -1,4 +1,4 @@
# Solution Templates # Startup Solution Templates
ABP provides pre-architected and production-ready templates to jump start a new solution. ABP provides pre-architected and production-ready templates to jump start a new solution.

56
docs/en/solution-templates/layered-web-application/authentication.md

@ -0,0 +1,56 @@
# Layered Solution: Authentication
```json
//[doc-nav]
{
"Previous": {
"Name": "Built-In Features",
"Path": "solution-templates/layered-web-application/built-in-features"
},
"Next": {
"Name": "Database configurations in the Layered solution",
"Path": "solution-templates/layered-web-application/database-configurations"
}
}
```
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
The [Layered solution template](index.md) is fully configured for authentication. All the services and applications are configured to use the [OpenIddict](https://documentation.openiddict.com) library for authentication. They are configured in a common way for authentication. This document explains that common authentication structure.
If you choose the *Tiered* option while [creating](../../get-started/layered-web-application.md#creating-a-new-solution) the solution, the solution will have the `*.AuthServer` project.
## OpenIddict
[OpenIddict](https://documentation.openiddict.com) is an open-source library that provides a simple and easy way to implement an OpenID Connect server in your application. ABP has built-in modules ([OpenIddict](../../modules/openiddict.md), [OpenIddict UI **\***](../../modules/openiddict-pro.md)) to integrate OpenIddict into the solution.
## Domain Layer
The layered solution template *Domain* layer is the responsible for the OpenIddict definitions (Applications, Scopes, etc.). Also, it provides the *OpenIddictDataSeedContributor* class to seed the initial data. It creates the default clients (applications) and scopes for the solution.
The [OpenIddict UI **\***](../../modules/openiddict-pro.md) module is added only if you choose the OpenIddict UI module while creating the solution.
![new-solution-openiddict-module](images/new-solution-openiddict-module.png)
The OpenIddict UI **\*** module provides a user interface to manage the OpenIddict entities such as applications, scopes, etc. You can manage these entities from the application UI.
![openiddict-ui](images/openiddict-ui.png)
## The Authentication Application
The solution may include an external authentication server (`auth-server`) application if you select the *Tiered* option during solution creation. Otherwise, the authentication server is integrated into one of the [Web Applications](web-applications.md).
The authentication server handles token generation, validation, and user account management (e.g., login, registration). It uses the [Account](../../modules/account.md) or [Account Pro **\***](../../modules/account-pro.md) module. The [Account Pro **\***](../../modules/account-pro.md) module additionally supports [social logins](../../modules/account-pro.md#social--external-logins) (e.g., Google, Facebook). Social logins can be enabled, disabled, and configured directly from the application's user interface.
![account-external-provider](images/account-external-provider.png)
## Authentication Flows
Applications in the solution use different authentication flows depending on the application type:
- **MVC UI Web Application**:
Uses the [Hybrid Flow](https://openid.net/specs/openid-connect-core-1_0.html#HybridFlowAuth) (OpenID Connect Authentication) for user authentication.
- **SPA and Swagger Applications**:
Use the [Authorization Code Flow](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth) to authenticate users.
Once a user logs into the system and obtains a token from the authentication server, the `*.HttpApi.Host` application use [JWT Bearer Authentication](https://jwt.io/introduction/) to authorize the user's actions.

51
docs/en/solution-templates/layered-web-application/blob-storing.md

@ -0,0 +1,51 @@
# Layered Solution: BLOB Storing
```json
//[doc-nav]
{
"Previous": {
"Name": "Multi-Tenancy",
"Path": "solution-templates/layered-web-application/multi-tenancy"
},
"Next": {
"Name": "CORS Configuration",
"Path": "solution-templates/layered-web-application/cors-configuration"
}
}
```
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
This document explains how to store BLOBs (Binary Large Objects) in a layered solution. It is common to store files, images, videos, and other large objects in a distributed system. You can learn more about BLOB storage in the [BLOB Storing System](../../framework/infrastructure/blob-storing/index.md) documentation.
In the layered solution template, the [Database Provider](../../framework/infrastructure/blob-storing/database.md) is used to store BLOBs in the database. The `Volo.Abp.BlobStoring.Database.EntityFrameworkCore` or `Volo.Abp.BlobStoring.Database.MongoDB` package provides the necessary implementations to store and retrieve BLOBs in the database. This setup is integrated into the layered solution template and is used in all related projects. You can change the database configuration in the `appsettings.json` file of the related project.
You can use the `IBlobContainer` or `IBlobContainer<T>` service to store and retrieve BLOBs. Here is an example of storing a BLOB:
```csharp
public class MyService : ITransientDependency
{
private readonly IBlobContainer _blobContainer;
public MyService(IBlobContainer blobContainer)
{
_blobContainer = blobContainer;
}
public async Task SaveBytesAsync(byte[] bytes)
{
await _blobContainer.SaveAsync("my-blob-1", bytes);
}
public async Task<byte[]> GetBytesAsync()
{
return await _blobContainer.GetAllBytesOrNullAsync("my-blob-1");
}
}
```
## File Management Module
The *File Management* module is optional and can be added to the solution during the creation process. It provides a user interface to manage folders and files. You can learn more about the module in the [File Management *](../../modules/file-management.md) document.
![file-management](images/file-management-index-page.png)

25
docs/en/solution-templates/layered-web-application/built-in-features.md

@ -0,0 +1,25 @@
# Layered Solution: Built-In Features
```json
//[doc-nav]
{
"Previous": {
"Name": "Mobile Applications",
"Path": "solution-templates/layered-web-application/mobile-applications"
},
"Next": {
"Name": "Authentication",
"Path": "solution-templates/layered-web-application/authentication"
}
}
```
The Layered solution template includes several built-in features to help you get started with your layered web application. These features are designed to provide a solid foundation for your application and help you focus on your business logic. This document provides an overview of the built-in features included in the Layered solution template. The following documents explains these features in details:
* [Authentication](authentication.md)
* [Database configurations](database-configurations.md)
* [Logging (with Serilog)](logging.md)
* [Swagger integration](swagger-integration.md)
* [Multi-Tenancy](multi-tenancy.md)
* [BLOB storing](blob-storing.md)
* [CORS configuration](cors-configuration.md)

37
docs/en/solution-templates/layered-web-application/cors-configuration.md

@ -0,0 +1,37 @@
# Layered Solution: CORS Configuration
```json
//[doc-nav]
{
"Previous": {
"Name": "BLOB Storing",
"Path": "solution-templates/layered-web-application/blob-storing"
},
"Next": {
"Name": "Helm Charts and Kubernetes",
"Path": "solution-templates/layered-web-application/helm-charts-and-kubernetes"
}
}
```
Cross-Origin Resource Sharing (CORS) is a security feature that allows web applications to make requests to a different domain than the one that served the web page.
In the layered solution template, CORS configuration is applied in the following cases:
- If you select the [Tiered solution](solution-structure.md#tiered-structure-).
- If you choose [Angular](web-applications.md#angular) as the web application type.
- If you choose [Blazor WebAssembly](web-applications.md#blazor-webassembly) as the web application type.
- If you choose [No UI](web-applications.md#no-ui) as the web application type.
The CORS settings are configured in the `appsettings.json` file of the corresponding project. Typically, the web application serves as the entry point for front-end applications, so it must be configured to accept requests from different origins.
The default configuration in `appsettings.json` is as follows:
```json
{
"App": {
"CorsOrigins": "https://*.MyProjectName.com"
}
}
```
You can modify the `CorsOrigins` property to include additional domains or wildcard subdomains as required by your application.

266
docs/en/solution-templates/layered-web-application/database-configurations.md

@ -0,0 +1,266 @@
# Layered Solution: Database configurations
```json
//[doc-nav]
{
"Previous": {
"Name": "Authentication",
"Path": "solution-templates/layered-web-application/authentication"
},
"Next": {
"Name": "Logging (with Serilog)",
"Path": "solution-templates/layered-web-application/logging"
}
}
```
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
ABP Studio's Layered Solution Template includes pre-configured database settings. This document explains how to manage database configurations in your solution.
## Connection Strings
Connection strings are stored in the `appsettings.json` file. You can customize them for different environments by modifying the respective `appsettings.json` files. The `*.DbMigrator` project and one of the [Web Application](web-applications.md) projects use the `Default` connection string by default.
To change the connection string for the `Default` key, update the `appsettings.json` file in your project. Connection strings are defined under the `ConnectionStrings` section, as shown below:
```json
{
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=Bookstore;Trusted_Connection=True;TrustServerCertificate=true"
}
}
```
### The DbContext Class
In the `*.EntityFrameworkCore` project, the `DbContext` class is defined. The `DbContext` class is derived from the `AbpDbContext` class, which is a part of the ABP Framework.
```csharp
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ReplaceDbContext(typeof(ISaasDbContext))]
[ConnectionStringName("Default")]
public class BookstoreDbContext :
AbpDbContext<BookstoreDbContext>,
ISaasDbContext,
IIdentityProDbContext
{
#region Entities from the modules
// Identity
public DbSet<IdentityUser> Users { get; set; }
public DbSet<IdentityRole> Roles { get; set; }
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
public DbSet<IdentityUserDelegation> UserDelegations { get; set; }
public DbSet<IdentitySession> Sessions { get; set; }
// SaaS
public DbSet<Tenant> Tenants { get; set; }
public DbSet<Edition> Editions { get; set; }
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
#endregion
public BookstoreDbContext(DbContextOptions<BookstoreDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureFeatureManagement();
builder.ConfigureIdentityPro();
builder.ConfigureOpenIddictPro();
builder.ConfigureLanguageManagement();
builder.ConfigureSaas();
builder.ConfigureTextTemplateManagement();
builder.ConfigureGdpr();
builder.ConfigureCmsKit();
builder.ConfigureCmsKitPro();
builder.ConfigureBlobStoring();
/* Configure your own tables/entities inside here */
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(BookstoreConsts.DbTablePrefix + "YourEntities", BookstoreConsts.DbSchema);
// b.ConfigureByConvention(); //auto configure for the base class props
// //...
//});
}
}
```
#### ConnectionStringName Attribute
We're using the *Default* connection string in the `BookstoreDbContext` class. You can change the connection string name by updating the `ConnectionStringName` attribute.
```csharp
[ConnectionStringName("Default")]
```
[The `ConnectionStringName` attribute](../../framework/fundamentals/connection-strings.md#set-the-connection-string-name) defines the unique name of the connection string that is being used by that `DbContext` class. It matches with the connection string defined in the `appsettings.json` file. That name is also used in database migrations to distinguish different database schemas, and used as the key while storing tenant connection strings for a multi-tenant system.
#### ReplaceDbContext Attribute
```csharp
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ReplaceDbContext(typeof(ISaasDbContext))]
```
The application DbContext utilizes the [Identity](../../modules/identity.md) and [Saas **\***](../../modules/saas.md) modules and creates a single database that contains these modules database schemas. These modules define their own `DbContext` class normally. But [the `ReplaceDbContext` attribute](../../framework/data/entity-framework-core/index.md#replace-other-dbcontextes) tells to ABP to use this (`BookstoreDbContext`) `DbContext` class instead of the `DbContext` classes defined by these modules. Technically, it replaces the given `DbContext` classes on runtime. We are doing that to ensure that we have a single (merged) database schema, single database migration path and a single database transaction operation when we work these multiple modules. When we replace a `DbContext`, we should implement its interface as done with the `BookstoreDbContext` class:
````csharp
public class BookstoreDbContext :
AbpDbContext<BookstoreDbContext>,
ISaasDbContext,
IIdentityProDbContext
````
* That class implements `ISaasDbContext` and `IIdentityProDbContext`, so these modules can use it.
As the next part, the `BookstoreDbContext` class defines the following properties those are forced by the implemented interfaces:
```csharp
// Identity
public DbSet<IdentityUser> Users { get; set; }
public DbSet<IdentityRole> Roles { get; set; }
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
public DbSet<IdentityUserDelegation> UserDelegations { get; set; }
public DbSet<IdentitySession> Sessions { get; set; }
// SaaS
public DbSet<Tenant> Tenants { get; set; }
public DbSet<Edition> Editions { get; set; }
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
```
#### OnModelCreating Method
The `OnModelCreating` method is used to configure the database schema. It calls the `Configure*` methods of the ABP Framework to configure the database schema for the modules. You can also configure your own tables/entities inside this method.
```csharp
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureFeatureManagement();
builder.ConfigureIdentityPro();
builder.ConfigureOpenIddictPro();
builder.ConfigureLanguageManagement();
builder.ConfigureSaas();
builder.ConfigureTextTemplateManagement();
builder.ConfigureGdpr();
builder.ConfigureCmsKit();
builder.ConfigureCmsKitPro();
builder.ConfigureBlobStoring();
/* Configure your own tables/entities inside here */
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(BookstoreConsts.DbTablePrefix + "YourEntities", BookstoreConsts.DbSchema);
// b.ConfigureByConvention(); //auto configure for the base class props
// //...
//});
}
```
> The `Configure*` methods are extension methods defined in each module's `EntityFrameworkCore` project. These methods are used to configure the database schema for their respective modules. At runtime, the `DbContext` class is replaced by the `BookstoreDbContext` class only for the `DbContext` classes that use the `ReplaceDbContext` attribute. For other modules, their own dedicated `DbContext` classes are used without replacement.
### The `IDesignTimeDbContextFactory` Implementation
The `IDesignTimeDbContextFactory` interface is used to create a `DbContext` instance at design time. It is used by EF Core tools to create migrations and update the database. The `BookstoreDbContextFactory` class implements the `IDesignTimeDbContextFactory` interface to create a `BookstoreMigrationsDbContext` instance.
```csharp
public class BookstoreDbContextFactory : IDesignTimeDbContextFactory<BookstoreDbContext>
{
public BookstoreDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
BookstoreEfCoreEntityExtensionMappings.Configure();
var builder = new DbContextOptionsBuilder<BookstoreDbContext>()
.UseSqlServer(configuration.GetConnectionString("Default"));
return new BookstoreDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../Acme.Bookstore.DbMigrator/"))
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();
}
}
```
### Configuration
In the `*.EntityFrameworkCore` project, the `BookstoreEntityFrameworkCoreModule` class is used to configure the database context.
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<BookstoreDbContext>(options =>
{
/* Remove "includeAllEntities: true" to create
* default repositories only for aggregate roots */
options.AddDefaultRepositories(includeAllEntities: true);
});
Configure<AbpDbContextOptions>(options =>
{
/* The main point to change your DBMS.
* See also BookstoreDbContextFactory for EF Core tooling. */
options.UseSqlServer();
});
}
```
We are basically setting the SQL Server as the default DBMS for this application. and registering the `BookstoreDbContext` class to the [dependency injection](../../framework/fundamentals/dependency-injection.md) system.
### SaaS Module: The Tenant Management UI **\***
SaaS module provides the necessary UI to set and change connection string for tenants and trigger the database migrations.
#### The Connection String Management Modal
You can click to the *Database Connection Strings* command in the *Actions* dropdown button for a tenant in the *Tenants* page of the SaaS module:
![Database Connection Strings](images/database-connection-strings.png)
It opens the *Database Connection Strings* modal as shown below:
![Database Connection Strings Modal](images/database-connection-strings-modal.png)
Here, we can set a *Default connection string* for the tenant.
When you make the changes and save the dialog, the database is automatically created and migrated. If you later update the connection string (for example if you change the database name), it will also trigger the database migration process again.
#### Manually Applying the Database Migrations
If you need to manually trigger the database migrations for a specific tenant, click the *Actions* dropdown for the related tenant and select the *Apply Database Migrations* command on the *Tenant Management* page of the SaaS module:
![Apply Database Migrations](images/apply-database-migrations.png)

41
docs/en/solution-templates/layered-web-application/db-migrator.md

@ -0,0 +1,41 @@
# Layered Solution: Db Migrator
````json
//[doc-nav]
{
"Previous": {
"Name": "Web Applications",
"Path": "solution-templates/layered-web-application/web-applications"
},
"Next": {
"Name": "Mobile Applications",
"Path": "solution-templates/layered-web-application/mobile-applications"
}
}
````
## Db Migrator Project
The Db Migrator project is a console application designed to handle database schema migrations and seed data population. It operates as a standalone application that can be executed on-demand or integrated into a CI/CD pipeline.
### Usage
You can run the Db Migrator application:
- From the command line.
- Directly from Visual Studio.
### Configuration
The Db Migrator project maintains its own configuration, separate from the main application. If you need to update the database connection string or any related settings, ensure that changes are applied consistently to both the main application and the Db Migrator to avoid discrepancies.
## Folder Structure
In the `*.DbMigrator` project, you will find the `DbMigratorHostedService` class, which is responsible for executing database migrations and seeding data. This class is registered in the `Program` class and starts running when the application is launched.
### Layers and Responsibilities
- **`*.Domain` Layer**:
Contains the `Data` folder, which holds the necessary classes for managing database migrations and seed data. However, since the `*.Domain` layer does not reference the `EntityFrameworkCore` package, it only defines the abstraction for data migration.
- **`*.EntityFrameworkCore` Layer**:
This layer is responsible for implementing database schema migrations. It includes the `EntityFrameworkCore[ProjectName]DbSchemaMigrator` class, which handles the actual migration logic using the `EntityFrameworkCore` package.

65
docs/en/solution-templates/layered-web-application/helm-charts-and-kubernetes.md

@ -0,0 +1,65 @@
# Layered Solution: Helm Charts and Kubernetes
````json
//[doc-nav]
{
"Previous": {
"Name": "CORS configuration",
"Path": "solution-templates/layered-web-application/cors-configuration"
}
}
````
> You must have an ABP Business or a higher license to be able to use the Kubernetes features.
This document explains how to deploy the layered solution to a Kubernetes cluster using [Helm](https://helm.sh/) charts. The layered solution template includes Helm charts for each application and infrastructure (Redis, RabbitMQ, etc). You can use these charts to deploy the solution to a Kubernetes cluster. You can see the Helm charts in the `etc/helm` folder of the solution.
## Folder Structure
The folder structure of the Helm charts is as follows:
![helm-folder](images/helm-folder.png)
> You might have different charts based on the solution template options you selected while creating the solution.
* **bookstore**: The Helm chart for the `Bookstore` solution. The folder name should be the same as your project name.
* **charts**: The sub-charts of the solution. Each application and infrastructure has its own chart.
* **templates**: The templates of the solution. It includes the ingress host URLs.
* **Chart.yaml**: The chart metadata.
* **values.bookstore-local.yaml**: The override values file for the [Kubernetes profile](../../studio/kubernetes.md#profile). It should follow the naming convention for your project name.
* **values.yaml**: The default values file for the chart.
* **build-all-images.ps1**: A PowerShell script to build all Docker images of the solution.
* **build-image.ps1**: A PowerShell script to build a Docker image of a specified project.
* **create-tls-secrets.ps1**: A PowerShell script to create local TLS secrets for the ingress controller. It's important when you try to [intercept a service](../../studio/kubernetes.md#intercept-a-service) and run it locally.
* **install.ps1**: A PowerShell script to install the solution to a Kubernetes cluster. You can override the default argument values.
* **uninstall.ps1**: A PowerShell script to uninstall the solution from a Kubernetes cluster. You can override the default argument values.
## Installing the Helm Charts
You can install the solution to a Kubernetes cluster using the `install.ps1` script. The script has the following arguments:
* **ChartName**: Default value is the project name. You can create different charts and specify the chart name. In ABP Studio [Kubernetes Main Chart](../../studio/kubernetes.md#main-chart) *Install Chart(s)* command automatically sets the chart name.
* **Namespace**: The namespace to install the Kubernetes resources. Default value is the project name with the `-local` suffix.
* **ReleaseName**: The release name of the Helm chart. Default value is the project name with the `-local` suffix.
* **DotnetEnvironment**: The environment to run the application. Default value is `Staging`.
* **User**: The user responsible for installing the Kubernetes resources. The application will automatically set the user name if you configure it under [Specify the User](../../studio/kubernetes.md#specify-the-user).
Before running the script, you need to build the Docker images of the solution. You can use the `build-all-images.ps1` script to build all Docker images of the solution. Afterwards, make sure that you have a Kubernetes TLS secret for the ingress controller. It is automatically created when you create the solution; however, if you clone the solution from a repository, you need to create it manually. You can use the `create-tls-secrets.ps1` script to create the TLS secret. Then you can run the `install.ps1` script to install the solution to a Kubernetes cluster.
## Uninstalling the Helm Charts
You can uninstall the solution from a Kubernetes cluster using the `uninstall.ps1` script. The script has the following arguments:
* **Namespace**: The namespace to uninstall the helm chart. Default value is the project name with the `-local` suffix.
* **ReleaseName**: The release name of the Helm chart. Default value is the project name with the `-local` suffix.
* **User**: The user responsible for uninstalling the Kubernetes resources. The application will automatically set the user name if you configure it under [Specify the User](../../studio/kubernetes.md#specify-the-user).
You can run the `uninstall.ps1` script to uninstall the solution from a Kubernetes cluster.
```bash
./uninstall.ps1
```
Additionally, in ABP Studio [Kubernetes](../../studio/kubernetes.md) feature, you can do the same operations more easily. You can use the Install Chart(s) and Uninstall Chart(s) commands to install and uninstall the solution to a Kubernetes cluster. Also, use the Build Docker Image(s) command to build the Docker images of the solution.
![kubernetes](images/kubernetes.png)

BIN
docs/en/solution-templates/layered-web-application/images/account-external-provider.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
docs/en/solution-templates/layered-web-application/images/angular-folder-structure.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
docs/en/solution-templates/layered-web-application/images/angular-template-structure-diagram.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
docs/en/solution-templates/layered-web-application/images/apply-database-migrations.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
docs/en/solution-templates/layered-web-application/images/bookstore-solution-tiered.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
docs/en/solution-templates/layered-web-application/images/database-connection-strings-modal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/en/solution-templates/layered-web-application/images/database-connection-strings.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
docs/en/solution-templates/layered-web-application/images/file-management-index-page.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
docs/en/solution-templates/layered-web-application/images/helm-folder.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
docs/en/solution-templates/layered-web-application/images/kubernetes.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
docs/en/solution-templates/layered-web-application/images/layered-project-dependencies.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
docs/en/solution-templates/layered-web-application/images/layered-solution-in-explorer.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
docs/en/solution-templates/layered-web-application/images/mobile-applications.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

BIN
docs/en/solution-templates/layered-web-application/images/new-solution-openiddict-module.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
docs/en/solution-templates/layered-web-application/images/open-solution-with-explorer.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
docs/en/solution-templates/layered-web-application/images/openiddict-ui.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
docs/en/solution-templates/layered-web-application/images/run-solution.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
docs/en/solution-templates/layered-web-application/images/saas-module-selection.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
docs/en/solution-templates/layered-web-application/images/solution-folders.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
docs/en/solution-templates/layered-web-application/images/solutionrunner-maui-targetframework.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
docs/en/solution-templates/layered-web-application/images/tiered-solution-applications-authserver.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
docs/en/solution-templates/layered-web-application/images/tiered-solution-servers.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
docs/en/solution-templates/layered-web-application/images/web-applications.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

490
docs/en/solution-templates/layered-web-application/index.md

@ -1,465 +1,35 @@
# Layered Application Solution Template # ABP Studio: Layered Solution Template
This template provides a layered application structure based on the [Domain Driven Design](../../framework/architecture/domain-driven-design) (DDD) practices. ````json
//[doc-nav]
## Getting Started
This document explains **the solution structure** and projects in details. If you want to start quickly, follow the guides below:
* [The getting started document](../../get-started/layered-web-application.md) explains how to create a new application in a few minutes.
* [The application development tutorial](../../tutorials/book-store/part-01.md) explains step by step application development.
## How to Start With?
You can use the [ABP CLI](../../cli) to create a new project using this startup template. Alternatively, you can generate a CLI command from the [Get Started](https://abp.io/get-started) page. CLI approach is used here.
First, install the ABP CLI if you haven't installed it before:
````bash
dotnet tool install -g Volo.Abp.Studio.Cli
````
Then use the `abp new` command in an empty folder to create a new solution:
````bash
abp new Acme.BookStore -t app
````
* `Acme.BookStore` is the solution name, like *YourCompany.YourProduct*. You can use single-level, two-level or three-level naming.
* This example specified the template name (`-t` or `--template` option). However, `app` is already the default template if you didn't specify it.
### Specify the UI Framework
This template provides multiple UI frameworks:
* `mvc`: ASP.NET Core MVC UI with Razor Pages (default)
* `blazor`: Blazor UI
* `blazor-server`: Blazor Server UI
* `angular`: Angular UI
Use the `-u` or `--ui` option to specify the UI framework:
````bash
abp new Acme.BookStore -u angular
````
### Specify the Database Provider
This template supports the following database providers:
- `ef`: Entity Framework Core (default)
- `mongodb`: MongoDB
Use `-d` (or `--database-provider`) option to specify the database provider:
````bash
abp new Acme.BookStore -d mongodb
````
### Specify the Mobile Application Framework
This template supports the following mobile application frameworks:
- `react-native`: React Native (*Available for* ***Team*** *or higher licenses*)
Use the `-m` (or `--mobile`) option to specify the mobile application framework:
````bash
abp new Acme.BookStore -m react-native
````
* [The getting started document](../../get-started/layered-web-application.md) explains how to create a new application with this startup template.
* [The application development tutorial](../../tutorials/book-store/part-01.md) explains step by step application development with this startup template.
## Solution Structure
Based on the options you've specified, you will get a slightly different solution structure.
### Default Structure
If you don't specify any additional options, you will have a solution as shown below:
![bookstore-rider-solution-v6](../../images/solution-structure-solution-explorer-rider.png)
Projects are organized in `src` and `test` folders. `src` folder contains the actual application which is layered based on [DDD](../../framework/architecture/domain-driven-design) principles as mentioned before.
The diagram below shows the layers & project dependencies of the application:
![layered-project-dependencies](../../images/layered-project-dependencies.png)
Each section below will explain the related project & its dependencies.
#### .Domain.Shared Project
This project contains constants, enums and other objects these are actually a part of the domain layer, but needed to be used by all layers/projects in the solution.
A `BookType` enum and a `BookConsts` class (which may have some constant fields for the `Book` entity, like `MaxNameLength`) are good candidates for this project.
* This project has no dependency on other projects in the solution. All other projects depend on this one directly or indirectly.
#### .Domain Project
This is the domain layer of the solution. It mainly contains [entities, aggregate roots](../../framework/architecture/domain-driven-design/entities.md), [domain services](../../framework/architecture/domain-driven-design/domain-services.md), [value objects](../../framework/architecture/domain-driven-design/value-objects.md), [repository interfaces](../../framework/architecture/domain-driven-design/repositories.md) and other domain objects.
A `Book` entity, a `BookManager` domain service and an `IBookRepository` interface are good candidates for this project.
* Depends on the `.Domain.Shared` because it uses constants, enums and other objects defined in that project.
#### .Application.Contracts Project
This project mainly contains [application service](../../framework/architecture/domain-driven-design/application-services.md) **interfaces** and [Data Transfer Objects](../../framework/architecture/domain-driven-design/data-transfer-objects.md) (DTO) of the application layer. It exists to separate the interface & implementation of the application layer. In this way, the interface project can be shared to the clients as a contract package.
An `IBookAppService` interface and a `BookCreationDto` class are good candidates for this project.
* Depends on the `.Domain.Shared` because it may use constants, enums and other shared objects of this project in the application service interfaces and DTOs.
#### .Application Project
This project contains the [application service](../../framework/architecture/domain-driven-design/application-services.md) **implementations** of the interfaces defined in the `.Application.Contracts` project.
A `BookAppService` class is a good candidate for this project.
* Depends on the `.Application.Contracts` project to be able to implement the interfaces and use the DTOs.
* Depends on the `.Domain` project to be able to use domain objects (entities, repository interfaces... etc.) to perform the application logic.
#### .EntityFrameworkCore Project
This is the integration project for the EF Core. It defines the `DbContext` and implements repository interfaces defined in the `.Domain` project.
* Depends on the `.Domain` project to be able to reference to entities and repository interfaces.
> This project is available only if you are using EF Core as the database provider. If you select another database provider, its name will be different.
#### .DbMigrator Project
This is a console application that simplifies the execution of database migrations on development and production environments. When you run this application, it:
* Creates the database if necessary.
* Applies the pending database migrations.
* Seeds initial data if needed.
> This project has its own `appsettings.json` file. So, if you want to change the database connection string, remember to change this file too.
Especially, seeding initial data is important at this point. ABP has a modular data seed infrastructure. See [its documentation](../../framework/infrastructure/data-seeding.md) for more about the data seeding.
While creating database & applying migrations seem only necessary for relational databases, this project comes even if you choose a NoSQL database provider (like MongoDB). In that case, it still seeds the initial data which is necessary for the application.
* Depends on the `.EntityFrameworkCore` project (for EF Core) since it needs to access to the migrations.
* Depends on the `.Application.Contracts` project to be able to access permission definitions, because the initial data seeder grants all permissions to the admin role by default.
#### .HttpApi Project
This project is used to define your API Controllers.
Most of the time you don't need to manually define API Controllers since ABP's [Auto API Controllers](../../framework/api-development/auto-controllers.md) feature creates them automagically based on your application layer. However, in case of you need to write API controllers, this is the best place to do it.
* Depends on the `.Application.Contracts` project to be able to inject the application service interfaces.
#### .HttpApi.Client Project
This is a project that defines C# client proxies to use the HTTP APIs of the solution. You can share this library to 3rd-party clients, so they can easily consume your HTTP APIs in their Dotnet applications (For other types of applications, they can still use your APIs, either manually or using a tool in their own platform)
Most of the time you don't need to manually create C# client proxies, thanks to ABP's [Dynamic C# API Clients](../../framework/api-development/dynamic-csharp-clients.md) feature.
`.HttpApi.Client.ConsoleTestApp` project is a console application created to demonstrate the usage of the client proxies.
* Depends on the `.Application.Contracts` project to be able to share the same application service interfaces and DTOs with the remote service.
> You can delete this project & dependencies if you don't need to create C# client proxies for your APIs.
#### .Web Project
This project contains the User Interface (UI) of the application if you are using ASP.NET Core MVC UI. It contains Razor pages, JavaScript files, CSS files, images and so on...
This project contains the main `appsettings.json` file that contains the connection string and other configurations of the application.
* Depends on the `.HttpApi` project since the UI layer needs to use APIs and the application service interfaces of the solution.
> If you check the source code of the `.Web.csproj` file, you will see the references to the `.Application` and the `.EntityFrameworkCore` projects.
>
> These references are actually not needed while coding your UI layer, because the UI layer normally doesn't depend on the EF Core or the Application layer's implementation. These startup templates are ready for tiered deployment, where the API layer is hosted on a separate server than the UI layer.
>
> However, if you don't choose the `--tiered` option, these references will be in the .Web project to be able to host the Web, API and application layers in a single application endpoint.
>
> This gives you the ability to use domain entities & repositories in your presentation layer. However, this is considered as a bad practice according to DDD.
#### Test Projects
The solution has multiple test projects, one for each layer:
* `.Domain.Tests` is used to test the domain layer.
* `.Application.Tests` is used to test the application layer.
* `.EntityFrameworkCore.Tests` is used to test EF Core configuration and custom repositories.
* `.Web.Tests` is used to test the UI (if you are using ASP.NET Core MVC UI).
* `.TestBase` is a base (shared) project for all tests.
In addition, `.HttpApi.Client.ConsoleTestApp` is a console application (not an automated test project) which demonstrate the usage of HTTP APIs from a .NET application.
Test projects are prepared for integration testing;
* It is fully integrated into the ABP and all services in your application.
* It uses SQLite in-memory database for EF Core. For MongoDB, it uses the [EphemeralMongo](https://github.com/asimmon/ephemeral-mongo) library.
* Authorization is disabled, so any application service can be easily used in tests.
You can still create unit tests for your classes which will be harder to write (because you will need to prepare mock/fake objects), but faster to run (because it only tests a single class and skips all the initialization processes).
#### How to Run?
Set `.Web` as the startup project and run the application. The default username is `admin` and the password is `1q2w3E*`.
See [Getting Started With the ASP.NET Core MVC Template](../../get-started/layered-web-application.md) for more information.
### Tiered Structure
If you have selected the ASP.NET Core UI and specified the `--tiered` option, the solution created will be a tiered solution. The purpose of the tiered structure is to be able to **deploy Web applications and HTTP API to different servers**:
![bookstore-visual-studio-solution-v3](../../images/tiered-solution-servers.png)
* Browser runs your UI by executing HTML, CSS & JavaScript.
* Web servers host static UI files (CSS, JavaScript, image... etc.) & dynamic components (e.g. Razor pages). It performs HTTP requests to the API server to execute the business logic of the application.
* The API Server hosts the HTTP APIs which then use the application & domain layers of the application to perform the business logic.
* Finally, database server hosts your database.
So, the resulting solution allows a 4-tiered deployment, by comparing to 3-tiered deployment of the default structure explained before.
> Unless you actually need such a 4-tiered deployment, it's suggested to go with the default structure which is simpler to develop, deploy and maintain.
The solution structure is shown below:
![bookstore-rider-solution-v6](../../images/bookstore-rider-solution-tiered.png)
As different from the default structure, two new projects come into play: `.AuthServer` & `.HttpApi.Host`.
#### .AuthServer Project
This project is used as an authentication server for other projects. `.Web` project uses OpenId Connect Authentication to get identity and access tokens for the current user from the AuthServer. Then uses the access token to call the HTTP API server. HTTP API server uses bearer token authentication to obtain claims from the access token to authorize the current user.
![tiered-solution-applications](../../images/tiered-solution-applications-authserver.png)
ABP uses the [OpenIddict Module](../../modules/openiddict.md) that uses the open-source [OpenIddict-core](https://github.com/openiddict/openiddict-core) library for the authentication between applications. See [OpenIddict documentation](https://documentation.openiddict.com/) for details about the OpenIddict and OpenID Connect protocol.
It has its own `appsettings.json` that contains database connection and other configurations.
#### .HttpApi.Host Project
This project is an application that hosts the API of the solution. It has its own `appsettings.json` that contains database connection and other configurations.
#### .Web Project
Just like the default structure, this project contains the User Interface (UI) of the application. It contains razor pages, JavaScript files, style files, images and so on...
This project contains an `appsettings.json` file, but this time it does not have a connection string because it never connects to the database. Instead, it mainly contains the endpoint of the remote API server and the authentication server.
#### Pre-requirements
* [Redis](https://redis.io/): The applications use Redis as a distributed cache. So, you need to have Redis installed & running.
#### How to Run?
You should run the application with the given order:
* First, run the `.AuthServer` since other applications depend on it.
* Then run the `.HttpApi.Host` since it is used by the `.Web` application.
* Finally, you can run the `.Web` project and login to the application (using `admin` as the username and `1q2w3E*` as the password).
### Blazor UI
If you choose `Blazor` as the UI Framework (using the `-u blazor` or `-u blazor-server` option), the solution will have a project named `.Blazor`. This project contains the Blazor UI application. According to your choice, it will be a Blazor WebAssembly or Blazor Server application. If Blazor WebAssembly is selected, the solution will also have a `.HttpApi.Host`. This project is an ASP.NET Core application that hosts the backend application for the Blazor single page application.
#### .Blazor Project (Server)
The Blazor Server project is similar to the ASP.NET Core MVC project. It replaces `.Web` project with `.Blazor` in the solution structure above. It has the same folder structure and the same application flow. Since it's an ASP.NET Core application, it can contain **.cshtml** files and **.razor** components at the same time. If routing matches a razor component, the Blazor UI will be used. Otherwise, the request will be handled by the MVC framework.
![abp solution structure blazor server](../../images/layered-project-dependencies-blazor-server.png)
#### .Blazor Project (WebAssembly)
The Blazor WebAssembly project is a single page application that runs on the browser. You'll see it as `.Blazor` project in the solution. It uses the `.HttpApi.Host` project to communicate with the backend. It can't be used without the backend application. It contains only **.razor** components. It's a pure client-side application. It doesn't have any server-side code. Everything in this layer will be for the client side.
![abp solution structure blazor wasm](../../images/layered-project-dependencies-blazor-wasm.png)
### Angular UI
If you choose `Angular` as the UI framework (using the `-u angular` option), the solution is being separated into two folders:
* `angular` folder contains the Angular UI application, the client-side code.
* `aspnet-core` folder contains the ASP.NET Core solution, the server-side code.
The server-side is similar to the solution described above. `*.HttpApi.Host` project serves the API, so the `Angular` application consumes it.
Angular application folder structure looks like below:
![angular-folder-structure](../../images/angular-folder-structure.png)
Each of ABP modules is an NPM package. Some ABP modules are added as a dependency in `package.json`. These modules install with their dependencies. To see all ABP packages, you can run the following command in the `angular` folder:
```bash
yarn list --pattern abp
```
Angular application module structure:
![Angular template structure diagram](../../images/angular-template-structure-diagram.png)
#### AppModule
`AppModule` is the root module of the application. Some of the ABP modules and some essential modules are imported to `AppModule`.
ABP Config modules have also been imported to `AppModule` for initial requirements of the lazy-loadable ABP modules.
#### AppRoutingModule
There are lazy-loadable ABP modules in the `AppRoutingModule` as routes.
> Paths of ABP Modules should not be changed.
You should add `routes` property in the `data` object to add a link on the menu to redirect to your custom pages.
```js
{ {
path: 'dashboard', "Next": {
loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule), "Name": "Overview",
canActivate: [authGuard, permissionGuard], "Path": "solution-templates/layered-web-application/overview"
data: { }
routes: {
name: 'ProjectName::Menu:Dashboard',
order: 2,
iconClass: 'fa fa-dashboard',
requiredPolicy: 'ProjectName.Dashboard.Host'
} as ABP.Route
}
} }
``` ````
In the above example;
* If the user is not logged in, authGuard blocks access and redirects to the login page.
* permissionGuard checks the user's permission with the `requiredPolicy` property of the `routes` object. If the user is not authorized to access the page, the 403 page appears.
* The `name` property of `routes` is the menu link label. A localization key can be defined.
* The `iconClass` property of the `routes` object is the menu link icon class.
* The `requiredPolicy` property of the `routes` object is the required policy key to access the page.
After the above `routes` definition, if the user is authorized, the dashboard link will appear on the menu.
#### Shared Module
The modules that may be required for all modules have been imported to the `SharedModule`. You should import `SharedModule` to all modules.
See the [Sharing Modules](https://angular.io/guide/sharing-ngmodules) document.
#### Environments
The files under the `src/environments` folder have the essential configuration of the application.
#### Home Module
Home module is an example lazy-loadable module that loads on the root address of the application.
#### Styles
The required style files are added to the `styles` array in `angular.json`. `AppComponent` loads some style files lazily via `LazyLoadService` after the main bundle is loaded to shorten the first rendering time.
#### Testing
You should create your tests in the same folder as the file you want to test.
See the [testing document](https://angular.io/guide/testing).
#### Depended Packages
* [NG Bootstrap](https://ng-bootstrap.github.io/) is used as UI component library.
* [NGXS](https://www.ngxs.io/) is used as state management library.
* [angular-oauth2-oidc](https://github.com/manfredsteyer/angular-oauth2-oidc) is used to support for OAuth 2 and OpenId Connect (OIDC).
* [Chart.js](https://www.chartjs.org/) is used to create widgets.
* [ngx-validate](https://github.com/ng-turkey/ngx-validate) is used for dynamic validation of reactive forms.
### React Native
If the `-m react-native` option is specified in the new project command, the solution includes the [React Native](https://reactnative.dev/) application in the `react-native` folder.
The server-side is similar to the solution described above. `*.HttpApi.Host` project serves the API, so the React Native application consumes it.
The React Native application was generated with [Expo](https://expo.io/). Expo is a set of tools built around React Native to help you quickly start an app and, while it has many features.
React Native application folder structure as like below:
![react-native-folder-structure](../../images/react-native-folder-structure.png)
* `App.js` is the bootstrap component of the application.
* `Environment.js` file has the essential configuration of the application. `prod` and `dev` configurations are defined in this file.
* [Contexts](https://reactjs.org/docs/context.html) are created in the `src/contexts` folder.
* [Higher order components](https://reactjs.org/docs/higher-order-components.html) are created in the `src/hocs` folder.
* [Custom hooks](https://reactjs.org/docs/hooks-custom.html#extracting-a-custom-hook) are created in `src/hooks`.
* [Axios interceptors](https://github.com/axios/axios#interceptors) are created in the `src/interceptors` folder.
* Utility functions are exported from `src/utils` folder.
#### Components
Components that can be used on all screens are created in the `src/components` folder. All components have been created as a function that is able to use [hooks](https://reactjs.org/docs/hooks-intro.html).
#### Screens
![react-native-navigation-structure](../../images/react-native-navigation-structure.png)
Screens are created by creating folders that separate their names in the `src/screens` folder. Certain parts of some screens can be split into components.
Each screen is used in a navigator in the `src/navigators` folder.
#### Navigation
[React Navigation](https://reactnavigation.org/) is used as a navigation library. Navigators are created in the `src/navigators`. A [drawer](https://reactnavigation.org/docs/drawer-based-navigation/) navigator and several [stack](https://reactnavigation.org/docs/hello-react-navigation/#installing-the-stack-navigator-library) navigators have been created in this folder. See the [above diagram](#screens) for the navigation structure.
#### State Management
[Redux](https://redux.js.org/) is used as a state management library. [Redux Toolkit](https://redux-toolkit.js.org/) library is used as a toolset for efficient Redux development.
Actions, reducers, sagas and selectors are created in the `src/store` folder. Store folder is as below:
![react-native-store-folder](../../images/react-native-store-folder.png)
* [**Store**](https://redux.js.org/basics/store) is defined in the `src/store/index.js` file.
* [**Actions**](https://redux.js.org/basics/actions/) are payloads of information that send data from your application to your store.
* [**Reducers**](https://redux.js.org/basics/reducers) specify how the application's state changes in response to actions sent to the store.
* [**Redux-Saga**](https://redux-saga.js.org/) is a library that aims to make application side effects (i.e. asynchronous things like data fetching and impure things like accessing the browser cache) easier to manage. Sagas are created in the `src/store/sagas` folder.
* [**Reselect**](https://github.com/reduxjs/reselect) library is used to create memoized selectors. Selectors are created in the `src/store/selectors` folder.
#### APIs
[Axios](https://github.com/axios/axios) is used as an HTTP client library. An Axios instance has exported from `src/api/API.js` file to make HTTP calls with the same config. `src/api` folder also has the API files that have been created for API calls.
#### Theming
[Native Base](https://nativebase.io/) is used as UI components library. Native Base components can customize easily. See the [Native Base customize](https://docs.nativebase.io/customizing-components) documentation. We followed the same way.
* Native Base theme variables are in the `src/theme/variables` folder.
* Native Base component styles are in the `src/theme/components` folder. These files have been generated with Native Base's `ejectTheme` script.
* Styles of components override with the files under the `src/theme/overrides` folder.
#### Testing
Unit tests will be created.
See the [Testing Overview](https://reactjs.org/docs/testing.html) document.
#### Depended Libraries
* [Native Base](https://nativebase.io/) is used as UI components library.
* [React Navigation](https://reactnavigation.org/) is used as navigation library.
* [Axios](https://github.com/axios/axios) is used as an HTTP client library.
* [Redux](https://redux.js.org/) is used as state management library.
* [Redux Toolkit](https://redux-toolkit.js.org/) library is used as a toolset for efficient Redux development.
* [Redux-Saga](https://redux-saga.js.org/) is used to manage asynchronous processes.
* [Redux Persist](https://github.com/rt2zz/redux-persist) is used as state persistence.
* [Reselect](https://github.com/reduxjs/reselect) is used to create memoized selectors.
* [i18n-js](https://github.com/fnando/i18n-js) is used as i18n library.
* [expo-font](https://docs.expo.io/versions/latest/sdk/font/) library allows loading fonts easily.
* [Formik](https://github.com/jaredpalmer/formik) is used to build forms.
* [Yup](https://github.com/jquense/yup) is used for form validations.
## Social / External Logins
If you want to configure social/external logins for your application, please follow the [Social/External Logins](../../social-external-logins.md) document.
## What's Next?
- [The getting started document](../../get-started) explains how to create a new application in a few minutes. ABP Studio provides pre-architected, production-ready templates to jump-start a new solution. One of these templates is the Layered solution template. It is designed for building monolithic layered systems that follow common application patterns based on [Domain-Driven Design](../../framework/architecture/domain-driven-design) (DDD) principles. The template includes multiple layers, integrates existing modules, and provides host applications based on your selections, making it an excellent foundation for your layered system.
- [The application development tutorial](../../tutorials/book-store/part-01.md) explains step by step application development.
## See Also > **This document explains the Layered solution template in detail. It is a reference document to fully understand the solution and refer to when you have trouble.**
* [Video tutorial](https://abp.io/video-courses/essentials/app-template) >
> **If you want to quickly create a layered solution, please refer to *[Quick Start: Creating a Layered Web Application with ABP Studio](../../get-started/layered-web-application.md)* document.**
## Contents
* [Overview](overview.md)
* [Solution structure](solution-structure.md)
* [Main Components](main-components.md)
* [Web Applications](web-applications.md)
* [Db Migrator](db-migrator.md)
* [Mobile Applications](mobile-applications.md)
* [Built-In Features](built-in-features.md)
* [Authentication](authentication.md)
* [Database configurations](database-configurations.md)
* [Logging (with Serilog)](logging.md)
* [Swagger integration](swagger-integration.md)
* [Multi-Tenancy](multi-tenancy.md)
* [BLOB storing](blob-storing.md)
* [CORS configuration](cors-configuration.md)
* [Helm Charts and Kubernetes](helm-charts-and-kubernetes.md)

35
docs/en/solution-templates/layered-web-application/logging.md

@ -0,0 +1,35 @@
# Layered Solution: Logging
```json
//[doc-nav]
{
"Previous": {
"Name": "Database configurations",
"Path": "solution-templates/layered-web-application/database-configurations"
},
"Next": {
"Name": "Swagger integration",
"Path": "solution-templates/layered-web-application/swagger-integration"
}
}
```
The ABP Studio [layered solution template](index.md) is fully configured for [logging](../../framework/fundamentals/logging.md). All the applications are configured to use the [Serilog](https://serilog.net/) library for structured logging. They are configured in a common way for logging. This document explains that common logging structure.
## The Serilog Sinks
The Serilog library is configured so it writes the logs to the following targets (a.k.a. [sinks](https://github.com/serilog/serilog/wiki/Provided-Sinks)) in parallel:
* **[Console](https://github.com/serilog/serilog-sinks-console)**: Logs are written to the standard output of the executing application. Logging to console is useful when you want to see logs easily while it is running in a container.
* **[File](https://github.com/serilog/serilog-sinks-file)**: Logs are written to a file named `logs.txt` located under the `Logs` folder of the executing application. File logging is useful when you run the application on your local computer. You can check logs easily when you have a trouble. This sinks is only configured for DEBUG mode. It won't be available in your production environment (you can change the behavior in your `Program.cs` file).
* **ABP Studio**: This is a Sink provided by ABP Studio. It sends all logs to ABP Studio, so you can easily monitor your logs in real-time on your ABP Studio Application Monitoring panel.
The solution can work with [any sink](https://github.com/serilog/serilog/wiki/Provided-Sinks) supported by Serilog. You can add more sinks, remove pre-installed sinks or fine tune their configuration for your solution.
## Program.cs
The `Program.cs` file is the main point that configures the logging system. It is done here, because we want to initialize and start the logging in the very beginning of the application.
## Additional Information
We are using ABP Serilog Enrichers in the module class of the application. It is done by the `app.UseAbpSerilogEnrichers();` line in the `OnApplicationInitialization` method of your module class. That ASP.NET Core middleware adds current [tenant](../../framework/architecture/multi-tenancy/index.md), [user](../../framework/infrastructure/current-user.md), client and correlation id information to the log records.

21
docs/en/solution-templates/layered-web-application/main-components.md

@ -0,0 +1,21 @@
# Layered Solution: Main Components
````json
//[doc-nav]
{
"Previous": {
"Name": "Solution structure",
"Path": "solution-templates/layered-web-application/solution-structure"
},
"Next": {
"Name": "Web Applications",
"Path": "solution-templates/layered-web-application/web-applications"
}
}
````
The solution consists of various applications; web applications, mobile applications, and a database migrator application. These applications are the main components of the solution and are designed to work together to provide a complete solution. The following documents explains these components in details:
* [Web Applications](web-applications.md)
* [Db Migrator](db-migrator.md)
* [Mobile Applications](mobile-applications.md)

122
docs/en/solution-templates/layered-web-application/mobile-applications.md

@ -0,0 +1,122 @@
# Layered Solution: Mobile Applications
```json
//[doc-nav]
{
"Previous": {
"Name": "Db Migrator",
"Path": "solution-templates/layered-web-application/db-migrator"
},
"Next": {
"Name": "Built-In Features",
"Path": "solution-templates/layered-web-application/built-in-features"
}
}
```
> You must have an ABP Team or a higher license to be able to create a mobile application project with ABP Studio.
Mobile applications are an essential part of modern software solutions. They provide a user-friendly interface to the end-users and allow them to access the system from anywhere. ABP Studio allows you to create mobile applications for your layered solution. You can create a new mobile application project, configure it, and run it on your device.
## Mobile Application Types
ABP Studio supports the following mobile application types:
- **None**: No mobile application project is created. It is the default option.
- **MAUI**: Cross-platform mobile applications with .NET MAUI (Multi-platform App UI). You can create MAUI projects with ABP Studio.
- **React Native**: Cross-platform mobile applications that share code between iOS and Android platforms. You can create React Native projects with ABP Studio.
You can select the mobile application type when creating a new layered application project during the *Mobile Framework* step.
![mobile-applications](images/mobile-applications.png)
### The MAUI Application
This is the mobile application that is built based on Microsoft's [MAUI framework](https://learn.microsoft.com/en-us/dotnet/maui). It will be in the solution only if you've selected the MAUI as your mobile application option.
#### Project Structure
Entire MAUI application is built on the AppShell pattern of MAUI. You can find the AppShell class in the `Acme.Bookstore.Maui` project. It is the entry point of the application. It is responsible for initializing the application and registering the services. You find all the pages and routing information in the `AppShell.xaml` file.
- **Pages**: Pages are located in the `Pages` folder of the project. Each page has a XAML & C# file. XAML file is responsible for the UI and C# file is responsible for the initialization of the page.
- **ViewModels**: ViewModels are located in the `ViewModels` folder of the project. Each ViewModel has a C# file. ViewModels are responsible for the business logic of the pages.
- **Oidc**: Oidc folder contains the logic for the authentication of the application. It contains the `MauiAuthenticationBrowser` class which manages the authentication process of the application.
- **Localization**: Localization folder contains the localization logic of the application. It contains regular ABP Localization logic and the `LocalizationResourceManager` class which is wrapper for the ABP localization logic on MAUI.
- **Messages**: Messages folder contains the message data for the communication inside application. Messages are used to send data between pages and viewmodels. It's designed on the [MVVM Toolkit Messenger](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/messenger) feature.
- **Storage**: Storage folder contains the storage logic of the application. It contains the `IStorage` class which is wrapper for the [SecureStorage](https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/secure-storage) feature. It is used to store the authentication data of the user and preferences of the application.
_Rest of the folders are MAUI default folders. You can check the [.NET MAUI single project documentatipon](https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/single-project?view=net-maui-8.0) for more information._
#### Running the application
Before running the MAUI Application, rest of the applications in the solution must be running. Such as AuthServer, MobileGateway and the microservices.
Make sure that you prepared devices for debugging. You can check the following documentation for each platform.
- [Android](https://learn.microsoft.com/en-us/dotnet/maui/android/emulator/)
- [iOS](https://learn.microsoft.com/en-us/dotnet/maui/ios/pair-to-mac)
- [MacCatalyst](https://learn.microsoft.com/en-us/dotnet/maui/mac-catalyst/cli)
- [Windows](https://learn.microsoft.com/en-us/dotnet/maui/windows/setup)
##### Network
All the platforms including iOS, MacCataylst and Windows, runs the applications in the same network of the host. So, you can use the `localhost` address to connect to the applications.
But in the **Android Emulator**, you need to use the `adb reverse` command to connect to the applications. You can use the following command to connect to the AuthServer application:
```bash
adb reverse tcp:44300 tcp:44300
```
> `44300` is an example port. You need to change it based on the port of the AuthServer & MobileGateway application.
> You need to run the command for a running emulator. If you run the emulator after running the command, you need to run the command again.
##### Target Framework
Since MAUI Applications have multiple target frameworks, you need to select the target framework before running the application. You can select the target framework from the context menu of the Solution Runner.
![ABP Studio MAUI Target Framework](images/solutionrunner-maui-targetframework.png)
##### Running with ABP Studio
You can start the MAUI application with the solution runner. You can click the start button of the MAUI application in the solution runner tree. It will start the application on the selected target framework. Since they're not running on a process and they're running on a device, you can't see them as running state in the solution runner. After the application is deployed, it'll be opened on the device and it'll be shown as stopped in the solution runner.
#### Development on MAUI Application
You can follow [Mobile Application Development Tutorial - MAUI](../../tutorials/mobile/maui/index.md) to learn how to develop on MAUI Application.
### The React Native Application
This is the mobile application that is built based on Facebook's [React Native framework](https://reactnative.dev/) and [Expo](https://expo.dev/). It will be in the solution only if you've selected React Native as your mobile application option.
#### Project Structure
- **Environment.js**: file using for provide application level variables like `apiUrl`, `oAuthConfig` and etc.
- **api**: The `api` folder contains HTTP request files that simplify API management in the React Native starter template
- `API.js:` exports **axiosInstance**. It provides axios instance filled api url
- **components**: In the `components` folder you can reach built in react native components that you can use in your app. These components **facilitates** your list, select and etc. operations
- **contexts**: `contexts` folder contains [react context](https://react.dev/reference/react/createContext). You can expots your contexts in this folder. `Localization context provided in here`
- **navigators**: folder contains [react-native stacks](https://reactnavigation.org/docs/stack-navigator/). After create new *FeatureName*Navigator we need to provide in `DrawerNavigator.js` file as `Drawer.Screen`
- **screens**: is the content of navigated page. We'll pass as component property to [Stack.Screen](https://reactnavigation.org/docs/native-stack-navigator/)
- **store**: folder manages state-management operations. We will define `actions`, `reducers`, `sagas` and `selectors` here.
- **styles**: folder contains app styles. `system-style.js` comes built in template we can also add new styles.
- **utils**: folder contains helper functions that we can use in application
#### Running the Application
React Native applications can't be run with the solution runner. You need to run them with the React Native CLI. You can check the [React Native documentation](https://reactnative.dev/docs/environment-setup) to learn how to setup the environment for React Native development.
Before running the React Native application, rest of the applications in the solution must be running. Such as AuthServer, MobileGateway and the microservices.
Then you can run the React Native application by following this documentation: [Getting Started with the React Native](../../framework/ui/react-native/index.md).

74
docs/en/solution-templates/layered-web-application/multi-tenancy.md

@ -0,0 +1,74 @@
# Layered Solution: Multi-Tenancy
```json
//[doc-nav]
{
"Previous": {
"Name": "Swagger integration",
"Path": "solution-templates/layered-web-application/swagger-integration"
},
"Next": {
"Name": "BLOB storing",
"Path": "solution-templates/layered-web-application/blob-storing"
}
}
```
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
Multi-tenancy is a software architecture where a single instance(codebase) of software runs on a server and serves multiple tenants. Tenants are isolated from each other and can have their own data, configurations, and users. This document explains how the multi-tenancy mechanism works in the layered solution template. You can learn more about multi-tenancy in the [Multi-Tenancy](../../framework/architecture/multi-tenancy/index.md), [Tenant Management](../../modules/tenant-management.md) and [SaaS **\***](../../modules/saas.md) documents.
## Multi-Tenancy in Layered Solutions
The layered solution templates use the *Multi-Tenancy* architecture only if you *Enable Multi-Tenancy **\**** option while creating the solution.
![saas-module-selection](images/saas-module-selection.png)
You can use different databases for each tenant or a shared database for some tenants. In the *SaaS **\*** module, you can specify the database connection strings in the [Connection Strings Management Modal](../../modules/saas.md#connection-string). All cached data is isolated by tenant. Each event, background job, and other data is stored with the tenant id.
You can use the `ICurrentTenant` service to get the current tenant information in your application.
```csharp
public class MyService : ITransientDependency
{
private readonly ICurrentTenant _currentTenant;
public MyService(ICurrentTenant currentTenant)
{
_currentTenant = currentTenant;
}
public void MyMethod()
{
var tenantId = _currentTenant.Id;
var tenantName = _currentTenant.Name;
}
}
```
Additionally, you can use the [DataFilter](../../framework/infrastructure/data-filtering.md#idatafilter-service-enabledisable-data-filters) system to disable the tenant filter and list all data in the same database.
```csharp
public class MyBookService : ITransientDependency
{
private readonly IDataFilter<IMultiTenant> _multiTenantFilter;
private readonly IRepository<Book, Guid> _bookRepository;
public MyBookService(
IDataFilter<IMultiTenant> multiTenantFilter,
IRepository<Book, Guid> bookRepository)
{
_multiTenantFilter = multiTenantFilter;
_bookRepository = bookRepository;
}
public async Task<List<Book>> GetAllBooksIncludingDeletedAsync()
{
//Temporary disable the IMultiTenant filter
using (_multiTenantFilter.Disable())
{
return await _bookRepository.GetListAsync();
}
}
}
```

108
docs/en/solution-templates/layered-web-application/overview.md

@ -0,0 +1,108 @@
# Layered Solution: Overview
````json
//[doc-nav]
{
"Previous": {
"Name": "Index",
"Path": "solution-templates/layered-web-application/index"
},
"Next": {
"Name": "Solution Structure",
"Path": "solution-templates/layered-web-application/solution-structure"
}
}
````
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
In this document, you will learn what the Layered solution template offers to you.
## Pre-Installed Libraries & Services
The following **libraries and services** come **pre-installed** and **configured** for both **development** and **production** environments. After creating your solution, you can **modify** or **remove** most of them as needed.
* **[Autofac](https://autofac.org/)** for [Dependency Injection](../../framework/fundamentals/dependency-injection.md).
* **[Serilog](https://serilog.net/)** with File and Console [logging](../../framework/fundamentals/logging.md) providers.
* **[Redis](https://redis.io/)** for [distributed caching](../../framework/fundamentals/caching.md). Redis is used for distributed caching if you select the *Public Website* **\*** or *Tiered* **\*** option.
* **[Swagger](https://swagger.io/)** for exploring and testing HTTP APIs.
* **[OpenIddict](https://github.com/openiddict/openiddict-core)** as the built-in authentication server.
## Pre-Configured Features
The following features are built and pre-configured for you in the solution.
* **Authentication** is fully configured based on best practices.
* **[Permission](../../framework/fundamentals/authorization.md)** (authorization), **[setting](../../framework/infrastructure/settings.md)**, **[feature](../../framework/infrastructure/features.md)** and the **[localization](../../framework/fundamentals/localization.md)** management systems are pre-configured and ready to use.
* **[Background job system](../../framework/infrastructure/background-jobs/index.md)**.
* **[BLOB storge](../../framework/infrastructure/blob-storing/index.md)** system is installed with the [database provider](../../framework/infrastructure/blob-storing/database.md).
* **On-the-fly database migration** system (services automatically migrated their database schema when you deploy a new version). **\***
* **[Helm](https://helm.sh/)** charts are included to deploy the solution to **[Kubernetes](https://kubernetes.io/)**. **\***
* **[Swagger](https://swagger.io/)** authentication is configured to test the authorized HTTP APIs.
## Fundamental Modules
The following modules are pre-installed and configured for the solution:
* **[Account](../../modules/account.md)** to authenticate users (login, register, two factor auth **\***, etc)
* **[Identity](../../modules/identity.md)** to manage roles and users
* **[OpenIddict](../../modules/openiddict.md)** (the core part) to implement the OAuth authentication flows
In addition these, [Feature Management](../../modules/feature-management.md), [Permission Management](../../modules/permission-management.md) and [Setting Management](../../modules/setting-management.md) modules are pre-installed as they are the fundamental feature modules of the ABP.
## Optional Modules
The following modules are optionally included in the solution, so you can select the ones you need:
* **[Audit Logging](../../modules/audit-logging.md)**
* **[Chat](../../modules/chat.md)** **\***
* **[File Management](../../modules/file-management.md)** **\***
* **[GDPR](../../modules/gdpr.md)** **\***
* **[Language Management](../../modules/language-management.md)** **\***
* **[OpenIddict (Management UI)](../../modules/openiddict.md)** **\***
* **[Tenant Management](../../modules/tenant-management.md) (Multi-Tenancy) or [SaaS](../../modules/saas.md)** **\***
* **[Text Template Management](../../modules/text-template-management.md)** **\***
## UI Theme
The **[LeptonX Lite](../../ui-themes/lepton-x-lite/index.md) or [LeptonX theme](https://leptontheme.com/)** **\*** is pre-configured for the solution. You can select one of the color palettes (System, Light or Dark) as default, while the end-user dynamically change it on the fly.
## Other Options
Layered startup template asks for some preferences while creating your solution.
### Database Providers
There are two database provider options are provided on a new solution creation:
* **[Entity Framework Core](../../framework/data/entity-framework-core/index.md)** with SQL Server, MySQL and PostgreSQL DBMS options. You can [switch to anther DBMS](../../framework/data/entity-framework-core/other-dbms.md) manually after creating your solution.
* **[MongoDB](../../framework/data/mongodb/index.md)**
### UI Frameworks
The solution comes with a main web application with the following UI Framework options:
* **None** (doesn't include a web application to the solution)
* **Angular**
* **MVC / Razor Pages UI**
* **Blazor WebAssembly**
* **Blazor Server**
* **Blazor WebApp**
* **MAUI with Blazor (Hybrid)** **\***
### The Mobile Application
If you prefer, the solution includes a mobile application. The mobile application is fully integrated to the system, implements authentication (login) and other ABP features, and includes a few screens that you can use and take as example. The following options are available:
* **None** (doesn't include a mobile application to the solution)
* **MAUI** **\***
* **React Native** **\***
### Multi-Tenancy & SaaS Module **\***
The **[SaaS module](../../modules/saas.md)** is included as an option. When you select it, the **[multi-tenancy](../../framework/architecture/multi-tenancy/index.md)** system is automatically configured. Otherwise, the system will not include any multi-tenancy overhead.
## See Also
* [Quick Start: Creating a Layered Web Application with ABP Studio](../../get-started/layered-web-application.md)

216
docs/en/solution-templates/layered-web-application/solution-structure.md

@ -0,0 +1,216 @@
# Layered Solution: The Structure
````json
//[doc-nav]
{
"Previous": {
"Name": "Overview",
"Path": "solution-templates/layered-web-application/overview"
},
"Next": {
"Name": "Main Components",
"Path": "solution-templates/layered-web-application/main-components"
}
}
````
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
This document explains the solution and folder structure of ABP Studio's [layered solution template](index.md).
> This document assumes that you've created a new layered solution by following the *[Quick Start: Creating a Layered Web Application with ABP Studio](../../get-started/layered-web-application.md)* guide. (Choose the *Entity Framework Core* as the database provider.)
## Understanding the ABP Solution Structure
When you create a new layered solution, you will see a tree structure similar to the one below in the *Solution Explorer* panel:
![layered-solution-in-explorer](images/layered-solution-in-explorer.png)
`Acme.Bookstore` is the main **ABP Studio module** of the solution. It includes two folders: `src` and `test`, as shown in the image above. The `src` folder contains the source code of the solution, which is structured according to [DDD](../../framework/architecture/domain-driven-design/index.md) principles, while the `test` folder holds the unit and integration tests.
> Refer to the *[Concepts](../../studio/concepts.md)* document for a comprehensive definition of ABP Studio solution, module, and package terms.
## Exploring the Folder Structure
You can right-click the root item in the solution explorer (`Acme.Bookstore` for this example) and select the *Open with* -> *Explorer* command to open the folder containing the solution in your file system:
![open-solution-with-explorer](images/open-solution-with-explorer.png)
The root folder of the solution will be similar to the following:
![solution-folders](images/solution-folders.png)
* `.abpstudio` folder stores your personal preferences for this solution and is excluded from source control (Git ignored). It is created and used by ABP Studio.
* `etc` folder contains additional files for the solution, organized into the following sub-folders:
* `abp-studio` folder holds settings managed by ABP Studio. This folder is included in source control and shared among developers.
* `docker` folder provides docker-compose configurations to easily run infrastructure dependencies (e.g., RabbitMQ, Redis) for the solution on your local machine.
* `helm` folder contains Helm charts and related scripts for deploying the solution to Kubernetes. **\***
* `src` folder contains the solution's source code, structured according to [DDD](../../framework/architecture/domain-driven-design/index.md) principles. It also includes database migrations and, depending on your project creation options, may include mobile and web application projects.
* `test` folder contains unit and integration tests for the solution.
## Understanding the Layered Solution Structure
The diagram below illustrates the application's layers and project dependencies:
![layered-solution-layers](images/layered-project-dependencies.png)
### .Domain.Shared Project
This project contains constants, enums and other objects these are actually a part of the domain layer, but needed to be used by all layers/projects in the solution.
A `BookType` enum and a `BookConsts` class (which may have some constant fields for the `Book` entity, like `MaxNameLength`) are good candidates for this project.
* This project has no dependency on other projects in the solution. All other projects depend on this one directly or indirectly.
### .Domain Project
This is the domain layer of the solution. It mainly contains [entities, aggregate roots](../../framework/architecture/domain-driven-design/entities.md), [domain services](../../framework/architecture/domain-driven-design/domain-services.md), [value objects](../../framework/architecture/domain-driven-design/value-objects.md), [repository interfaces](../../framework/architecture/domain-driven-design/repositories.md) and other domain objects.
A `Book` entity, a `BookManager` domain service and an `IBookRepository` interface are good candidates for this project.
* Depends on the `.Domain.Shared` because it uses constants, enums and other objects defined in that project.
### .Application.Contracts Project
This project mainly contains [application service](../../framework/architecture/domain-driven-design/application-services.md) **interfaces** and [Data Transfer Objects](../../framework/architecture/domain-driven-design/data-transfer-objects.md) (DTO) of the application layer. It exists to separate the interface & implementation of the application layer. In this way, the interface project can be shared to the clients as a contract package.
An `IBookAppService` interface and a `BookCreationDto` class are good candidates for this project.
* Depends on the `.Domain.Shared` because it may use constants, enums and other shared objects of this project in the application service interfaces and DTOs.
### .Application Project
This project contains the [application service](../../framework/architecture/domain-driven-design/application-services.md) **implementations** of the interfaces defined in the `.Application.Contracts` project.
A `BookAppService` class is a good candidate for this project.
* Depends on the `.Application.Contracts` project to be able to implement the interfaces and use the DTOs.
* Depends on the `.Domain` project to be able to use domain objects (entities, repository interfaces... etc.) to perform the application logic.
### .EntityFrameworkCore Project
This is the integration project for the EF Core. It defines the `DbContext` and implements repository interfaces defined in the `.Domain` project.
* Depends on the `.Domain` project to be able to reference to entities and repository interfaces.
> This project is available only if you are using EF Core as the database provider. If you select another database provider, its name will be different.
### .DbMigrator Project
This is a console application that simplifies the execution of database migrations on development and production environments. When you run this application, it:
* Creates the database if necessary.
* Applies the pending database migrations.
* Seeds initial data if needed.
> This project has its own `appsettings.json` file. So, if you want to change the database connection string, remember to change this file too.
Especially, seeding initial data is important at this point. ABP has a modular data seed infrastructure. See [its documentation](../../framework/infrastructure/data-seeding.md) for more about the data seeding.
While creating database & applying migrations seem only necessary for relational databases, this project comes even if you choose a NoSQL database provider (like MongoDB). In that case, it still seeds the initial data which is necessary for the application.
* Depends on the `.EntityFrameworkCore` project (for EF Core) since it needs to access to the migrations.
* Depends on the `.Application.Contracts` project to be able to access permission definitions, because the initial data seeder grants all permissions to the admin role by default.
### .HttpApi Project
This project is used to define your API Controllers.
Most of the time you don't need to manually define API Controllers since ABP's [Auto API Controllers](../../framework/api-development/auto-controllers.md) feature creates them automagically based on your application layer. However, in case of you need to write API controllers, this is the best place to do it.
* Depends on the `.Application.Contracts` project to be able to inject the application service interfaces.
### .HttpApi.Client Project
This is a project that defines C# client proxies to use the HTTP APIs of the solution. You can share this library to 3rd-party clients, so they can easily consume your HTTP APIs in their Dotnet applications (For other types of applications, they can still use your APIs, either manually or using a tool in their own platform)
Most of the time you don't need to manually create C# client proxies, thanks to ABP's [Dynamic C# API Clients](../../framework/api-development/dynamic-csharp-clients.md) feature.
`.HttpApi.Client.ConsoleTestApp` project is a console application created to demonstrate the usage of the client proxies.
* Depends on the `.Application.Contracts` project to be able to share the same application service interfaces and DTOs with the remote service.
> You can delete this project & dependencies if you don't need to create C# client proxies for your APIs.
### .Web Project
This project contains the User Interface (UI) of the application if you are using ASP.NET Core MVC UI. It contains Razor pages, JavaScript files, CSS files, images and so on...
This project contains the main `appsettings.json` file that contains the connection string and other configurations of the application.
* Depends on the `.HttpApi` project since the UI layer needs to use APIs and the application service interfaces of the solution.
> If you check the source code of the `.Web.csproj` file, you will see the references to the `.Application` and the `.EntityFrameworkCore` projects.
>
> These references are actually not needed while coding your UI layer, because the UI layer normally doesn't depend on the EF Core or the Application layer's implementation. These startup templates are ready for tiered deployment, where the API layer is hosted on a separate server than the UI layer.
>
> However, if you don't choose the `--tiered` option, these references will be in the .Web project to be able to host the Web, API and application layers in a single application endpoint.
>
> This gives you the ability to use domain entities & repositories in your presentation layer. However, this is considered as a bad practice according to DDD.
### Test Projects
The solution has multiple test projects, one for each layer:
* `.Domain.Tests` is used to test the domain layer.
* `.Application.Tests` is used to test the application layer.
* `.EntityFrameworkCore.Tests` is used to test EF Core configuration and custom repositories.
* `.Web.Tests` is used to test the UI (if you are using ASP.NET Core MVC UI).
* `.TestBase` is a base (shared) project for all tests.
In addition, `.HttpApi.Client.ConsoleTestApp` is a console application (not an automated test project) which demonstrate the usage of HTTP APIs from a .NET application.
Test projects are prepared for integration testing;
* It is fully integrated into the ABP and all services in your application.
* It uses SQLite in-memory database for EF Core. For MongoDB, it uses the [EphemeralMongo](https://github.com/asimmon/ephemeral-mongo) library.
* Authorization is disabled, so any application service can be easily used in tests.
You can still create unit tests for your classes which will be harder to write (because you will need to prepare mock/fake objects), but faster to run (because it only tests a single class and skips all the initialization processes).
### How to Run?
You can open the [Solution Runner](../../studio/running-applications.md) panel and start the all applications. The default username is `admin` and the password is `1q2w3E*`.
![run-solution](images/run-solution.png)
See [Getting Started With the ASP.NET Core MVC Template](../../get-started/layered-web-application.md) for more information.
## Tiered Structure **\***
If you have selected the ASP.NET Core UI and specified the `--tiered` option, the solution created will be a tiered solution. The purpose of the tiered structure is to be able to **deploy Web applications and HTTP API to different servers**:
![tiered-solution](images/tiered-solution-servers.png)
* Browser runs your UI by executing HTML, CSS & JavaScript.
* Web servers host static UI files (CSS, JavaScript, image... etc.) & dynamic components (e.g. Razor pages). It performs HTTP requests to the API server to execute the business logic of the application.
* The API Server hosts the HTTP APIs which then use the application & domain layers of the application to perform the business logic.
* Finally, database server hosts your database.
> Unless you actually need such a 4-tiered deployment, it's suggested to go with the default structure which is simpler to develop, deploy and maintain.
The solution structure is shown below:
![bookstore-solution-tiered](images/bookstore-solution-tiered.png)
As different from the default structure, two new projects come into play: `.AuthServer` & `.HttpApi.Host`.
### .AuthServer Project
This project is used as an authentication server for other projects. `.Web` project uses OpenId Connect Authentication to get identity and access tokens for the current user from the AuthServer. Then uses the access token to call the HTTP API server. HTTP API server uses bearer token authentication to obtain claims from the access token to authorize the current user.
![tiered-solution-applications](images/tiered-solution-applications-authserver.png)
ABP uses the [OpenIddict Module](../../modules/openiddict.md) that uses the open-source [OpenIddict-core](https://github.com/openiddict/openiddict-core) library for the authentication between applications. See [OpenIddict documentation](https://documentation.openiddict.com/) for details about the OpenIddict and OpenID Connect protocol.
It has its own `appsettings.json` that contains database connection and other configurations.
### .HttpApi.Host Project
This project is an application that hosts the API of the solution. It has its own `appsettings.json` that contains database connection and other configurations.
### .Web Project
Just like the default structure, this project contains the User Interface (UI) of the application. It contains razor pages, JavaScript files, style files, images and so on...
This project contains an `appsettings.json` file, but this time it does not have a connection string because it never connects to the database. Instead, it mainly contains the endpoint of the remote API server and the authentication server.

19
docs/en/solution-templates/layered-web-application/swagger-integration.md

@ -0,0 +1,19 @@
# Layered Solution: Swagger Integration
```json
//[doc-nav]
{
"Previous": {
"Name": "Logging (with Serilog)",
"Path": "solution-templates/layered-web-application/logging"
},
"Next": {
"Name": "Multi-Tenancy",
"Path": "solution-templates/layered-web-application/multi-tenancy"
}
}
```
[Swagger](https://swagger.io/) is a tool that helps to create, document, and consume RESTful web services. It provides a user interface to interact with the APIs and also a way to generate client SDKs for the APIs.
In the [Swagger Integration](../../framework/api-development/swagger.md) document, you can find general information about Swagger integration with ABP Framework.

178
docs/en/solution-templates/layered-web-application/web-applications.md

@ -0,0 +1,178 @@
# Layered Solution: Web Applications
````json
//[doc-nav]
{
"Previous": {
"Name": "Main Components",
"Path": "solution-templates/layered-web-application/main-components"
},
"Next": {
"Name": "Db Migrator",
"Path": "solution-templates/layered-web-application/db-migrator"
}
}
````
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
The web applications are the main user interfaces of the solution. They are the entry points for users to interact with the system. The Layered Solution Template supports the following web applications:
- **MVC / Razor Pages**: This is an ASP.NET Core MVC application. It is a traditional web application that serves HTML pages to users and is suitable for building web applications with server-side rendering.
- **Angular**: This is an Angular application, a single-page application (SPA) that runs on the client side. It communicates with the server using HTTP requests and is ideal for building modern web applications with rich user interfaces.
- **Blazor UI**: A flexible framework for building web applications with .NET. It supports various hosting models:
- **Blazor WebAssembly**: This is a client-side SPA that runs entirely in the user's browser. It communicates with the server using HTTP requests and is suitable for modern web applications with rich interactivity and offline capabilities.
- **Blazor Server**: This is a server-side SPA that runs on the server and communicates with the client in real time using SignalR. It is ideal for applications requiring constant connectivity and rapid server updates.
- **Blazor WebApp**: This is a combination of Blazor technologies optimized for building hybrid web applications that can leverage both client-side and server-side capabilities.
- **Maui Blazor (Hybrid)** **\***: This enables building cross-platform applications that combine Blazor for the UI with .NET MAUI for native device integration. It is suitable for building apps that work across desktop and mobile platforms.
- **No UI**: This option creates a backend-only solution without a web interface, suitable for scenarios like API-only applications or headless services.
You can select the web application type that fits your requirements during the solution creation process in the *UI Framework* step. The Layered Solution Template generates the selected web applications with the necessary configurations and integrations.
![Web Applications](images/web-applications.png)
## MVC / Razor Pages
MVC (Model-View-Controller) is a design pattern commonly used for building web applications. Razor Pages, on the other hand, is a page-based programming model designed to make building web applications simpler and more productive.
When you select the MVC / Razor Pages option in the Layered Solution Template, it generates an ASP.NET Core MVC application named something like `Acme.BookStore.Web`. This application serves as the web interface for your solution, using server-side rendering to deliver dynamic HTML pages to users.
## Angular
Angular is a popular front-end framework for building single-page applications (SPAs). It offers a rich set of features for creating modern web applications with dynamic and interactive user interfaces.
When you select the Angular option in the Layered Solution Template, it generates:
- An Angular application located under the solution's root folder, typically named `angular`.
- An ASP.NET Core application, usually named something like `Acme.Bookstore.HttpApi.Host`.
The Angular application runs as a client-side SPA in the user's browser and communicates with the server by sending HTTP requests to the `*.HttpApi.Host` application.
![angular-folder-structure](images/angular-folder-structure.png)
Each of ABP modules is an NPM package. Some ABP modules are added as a dependency in `package.json`. These modules install with their dependencies. To see all ABP packages, you can run the following command in the `angular` folder:
```bash
yarn list --pattern abp
```
Angular application module structure:
![Angular template structure diagram](images/angular-template-structure-diagram.png)
### AppModule
`AppModule` is the root module of the application. Some of the ABP modules and some essential modules are imported to `AppModule`.
ABP Config modules have also been imported to `AppModule` for initial requirements of the lazy-loadable ABP modules.
### AppRoutingModule
There are lazy-loadable ABP modules in the `AppRoutingModule` as routes.
> Paths of ABP Modules should not be changed.
You should add `routes` property in the `data` object to add a link on the menu to redirect to your custom pages.
```js
{
path: 'dashboard',
loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule),
canActivate: [authGuard, permissionGuard],
data: {
routes: {
name: 'ProjectName::Menu:Dashboard',
order: 2,
iconClass: 'fa fa-dashboard',
requiredPolicy: 'ProjectName.Dashboard.Host'
} as ABP.Route
}
}
```
In the above example;
* If the user is not logged in, authGuard blocks access and redirects to the login page.
* permissionGuard checks the user's permission with the `requiredPolicy` property of the `routes` object. If the user is not authorized to access the page, the 403 page appears.
* The `name` property of `routes` is the menu link label. A localization key can be defined.
* The `iconClass` property of the `routes` object is the menu link icon class.
* The `requiredPolicy` property of the `routes` object is the required policy key to access the page.
After the above `routes` definition, if the user is authorized, the dashboard link will appear on the menu.
### Shared Module
The modules that may be required for all modules have been imported to the `SharedModule`. You should import `SharedModule` to all modules.
See the [Sharing Modules](https://angular.io/guide/sharing-ngmodules) document.
### Environments
The files under the `src/environments` folder have the essential configuration of the application.
### Home Module
Home module is an example lazy-loadable module that loads on the root address of the application.
### Styles
The required style files are added to the `styles` array in `angular.json`. `AppComponent` loads some style files lazily via `LazyLoadService` after the main bundle is loaded to shorten the first rendering time.
### Testing
You should create your tests in the same folder as the file you want to test.
See the [testing document](https://angular.io/guide/testing).
### Depended Packages
* [NG Bootstrap](https://ng-bootstrap.github.io/) is used as UI component library.
* [NGXS](https://www.ngxs.io/) is used as state management library.
* [angular-oauth2-oidc](https://github.com/manfredsteyer/angular-oauth2-oidc) is used to support for OAuth 2 and OpenId Connect (OIDC).
* [Chart.js](https://www.chartjs.org/) is used to create widgets.
* [ngx-validate](https://github.com/ng-turkey/ngx-validate) is used for dynamic validation of reactive forms.
## Blazor UI
Blazor is a flexible framework for building web applications with .NET. It supports various hosting models, including Blazor WebAssembly, Blazor Server, Blazor WebApp, and Maui Blazor (Hybrid).
### Blazor WebAssembly
Blazor WebAssembly is a client-side SPA that runs entirely in the user's browser. It communicates with the server using HTTP requests and is suitable for modern web applications with rich interactivity and offline capabilities.
When you select the Blazor WebAssembly option in the Layered Solution Template, it generates:
- A Blazor application located under the solution's root folder, typically named `*.Blazor`, which serves as the main Blazor host project.
- A Blazor client application, named `*.Blazor.Client`, where you can write the client-side (UI logic) code.
- An ASP.NET Core application, named `*.HttpApi.Host`, where the server-side (business logic) code runs.
The Blazor client application communicates with the server by sending HTTP requests to the `*.HttpApi.Host` application.
### Blazor Server
Blazor Server is a server-side SPA that runs on the server and communicates with the client in real time using SignalR. It is ideal for applications requiring constant connectivity and rapid server updates.
When you select the Blazor Server option in the Layered Solution Template, it generates:
- A Blazor application located under the solution's root folder, typically named `*.Blazor`, which serves as the main Blazor host project.
### Blazor WebApp
Blazor WebApp is a combination of Blazor technologies optimized for building hybrid web applications that can leverage both client-side and server-side capabilities.
When you select the Blazor WebApp option in the Layered Solution Template, it generates:
- A Blazor application located under the solution's root folder, typically named `*.Blazor`, which serves as the main Blazor host project.
- A Blazor client application, named `*.Blazor.Client`, where you can write the client-side (UI logic) code.
The Blazor client application communicates with the server by sending HTTP requests to the `*.Blazor` application.
### Maui Blazor (Hybrid) **\***
Maui Blazor (Hybrid) enables building cross-platform applications that combine Blazor for the UI with .NET MAUI for native device integration. It is suitable for building apps that work across desktop and mobile platforms.
When you select the Maui Blazor (Hybrid) option in the Layered Solution Template, it generates:
- A Maui Blazor (Hybrid) application located under the solution's root folder, typically named `*.MauiBlazor`, which serves as the main UI host project.
- An ASP.NET Core application, named `*.HttpApi.Host`, where the server-side (business logic) code runs.
The Maui Blazor (Hybrid) application communicates with the server by sending HTTP requests to the `*.HttpApi.Host` application.
## No UI
This option creates a backend-only solution without a web interface, suitable for scenarios like API-only applications or headless services.
When you select the No UI option in the Layered Solution Template, it generates an ASP.NET Core application named `*.HttpApi.Host` that serves as the backend API for your solution.

10
docs/en/solution-templates/microservice/grpc-calls.md

@ -12,6 +12,14 @@
> You must have an ABP Business or a higher license to be able to create a microservice solution. > You must have an ABP Business or a higher license to be able to create a microservice solution.
## What is gRPC?
You can use [gRPC](https://grpc.io) to enable high-performance, low-latency communication between microservices. gRPC, or Google Remote Procedure Call, is an open-source remote procedure call system initially developed by Google. It uses HTTP/2 for transport, Protocol Buffers as the interface description language, and provides features such as authentication, load balancing, and more. You can use [gRPC](https://grpc.io) to enable high-performance, low-latency communication between microservices. gRPC, or Google Remote Procedure Call, is an open-source remote procedure call system initially developed by Google. It uses HTTP/2 for transport, Protocol Buffers as the interface description language, and provides features such as authentication, load balancing, and more.
For inter-service communication, gRPC is a great choice because it is faster and more efficient than REST. It is also language-agnostic, meaning you can use it with any programming language that supports gRPC. ABP does not restrict you to use gRPC; you can use it just like normal .NET applications. ## Learning Resources
The microservice startup template hasn't any configuration related to gRPC communication. You can see the following resources to learn how to implement gRPC calls between your services:
* [Using gRPC with the ABP Framework](https://abp.io/community/articles/using-grpc-with-the-abp-framework-2dgaxzw3) (ABP Community article)
* [Overview for gRPC on .NET](https://learn.microsoft.com/en-us/aspnet/core/grpc/) (Microsoft's documentation)
* [Code-first gRPC services and clients with .NET](https://learn.microsoft.com/en-us/aspnet/core/grpc/code-first) (Microsoft's documentation)

4
docs/en/solution-templates/microservice/microservices.md

@ -12,7 +12,7 @@
> You must have an ABP Business or a higher license to be able to create a microservice solution. > You must have an ABP Business or a higher license to be able to create a microservice solution.
The ABP Studio Microservice solution consists of a few microservices at the beginning. It is expected that you [add more microservices](guides/add-new-microservice.md) as your solution grows. This document briefly explains the structure of pre-built microservices in the solution. The ABP Studio Microservice solution consists of a few microservices at the beginning. It is expected that you [add more microservices](adding-new-microservices.md) as your solution grows. This document briefly explains the structure of pre-built microservices in the solution.
The microservice count varies based on the options you've selected during the solution creation. However, the following microservices are always included: The microservice count varies based on the options you've selected during the solution creation. However, the following microservices are always included:
@ -41,7 +41,7 @@ Let's explain the projects:
* `Acme.CloudCrm.AdministrationService.Contracts` contains service interfaces and data transfer objects of your service. It is useful to separate contracts. In this way, you can share the *Contracts* package with the clients, so they can easily consume your services. See the [communication](communication.md) document to learn how to do it. * `Acme.CloudCrm.AdministrationService.Contracts` contains service interfaces and data transfer objects of your service. It is useful to separate contracts. In this way, you can share the *Contracts* package with the clients, so they can easily consume your services. See the [communication](communication.md) document to learn how to do it.
* `Acme.CloudCrm.AdministrationService.Tests` contains the unit and integration tests for that microservice. While it is highly suggested to build tests for your services, you can delete that project if you don't want to write tests. * `Acme.CloudCrm.AdministrationService.Tests` contains the unit and integration tests for that microservice. While it is highly suggested to build tests for your services, you can delete that project if you don't want to write tests.
> We haven't applied **layering** for the pre-built microservices, because they don't include much code and no need for such complexity. Microservices should be small (micro!) services, so you typically can manage your codebase in a single project/layer. However, if you want to implement layering for your microservices, you can create a layered microservice by following the *[Adding New Microservice](guides/add-new-microservice.md)* guide. > We haven't applied **layering** for the pre-built microservices, because they don't include much code and no need for such complexity. Microservices should be small (micro!) services, so you typically can manage your codebase in a single project/layer. However, if you want to implement layering for your microservices, you can create a layered microservice by following the *[Adding New Microservice](adding-new-microservices.md)* guide.
Next sections introduces and explains the pre-build services of the solution. Next sections introduces and explains the pre-build services of the solution.

59
docs/en/solution-templates/single-layer-web-application/_index.md

@ -0,0 +1,59 @@
# Single Layer Application Solution Template
This template provides a simple solution structure with a single project. This document explains that solution structure in details.
## Getting Started
* Follow the [Getting Started guide](../../get-started/single-layer-web-application.md) to create a new solution using this startup solution template.
* Follow the [TODO application tutorial](../../tutorials/todo/single-layer/index.md) to learn how to create a simple application with this startup solution template.
## The Solution Structure
If you created your solution with the default options, you will have a .NET solution as shown below:
![](../../images/bookstore-single-layer-solution-structure.png)
In the next sections, we will explain the structure based on this example. Your startup solution can be slightly different based on your preferences.
### Folder Structure
Since this template provides a single-project solution, we've separated concerns into folders instead of projects. You can see the pre-defined folders as shown below:
![](../../images/single-layer-folder-structure.png)
* Define your database mappings (for [EF Core](../../framework/data/entity-framework-core) or [MongoDB](../../framework/data/mongodb) and [repositories](../../framework/architecture/domain-driven-design/repositories.md) in the `Data` folder.
* Define your [entities](../../framework/architecture/domain-driven-design/entities.md) in the `Entities` folder.
* Define your UI localization keys/values in the `Localization` folder.
* Define your UI menu items in the `Menus` folder.
* Define your [object-to-object mapping](../../framework/infrastructure/object-to-object-mapping.md) classes in the `ObjectMapping` folder.
* Define your UI pages (Razor Pages) in the `Pages` folder (create `Controllers` and `Views` folder yourself if you prefer the MVC pattern).
* Define your [application services](../../framework/architecture/domain-driven-design/application-services.md) in the `Services` folder.
### How to Run?
Before running the application, you need to create the database and seed the initial data. To do that, you can run the following command in the directory of your project (in the same folder of the `.csproj` file):
```bash
dotnet run --migrate-database
```
This command will create the database and seed the initial data for you. Then you can run the application with any IDE that supports .NET or by running the `dotnet run` command in the directory of your project. The default username is `admin` and the password is `1q2w3E*`.
> While creating a database & applying migrations seem only necessary for relational databases, you should run this command even if you choose a NoSQL database provider (like MongoDB). In that case, it still seeds the initial data which is necessary for the application.
### The Angular UI
If you choose `Angular` as the UI framework, the solution will be separated into two folders:
* An `angular` folder that contains the Angular UI application, the client-side code.
* An `aspnet-core` folder that contains the ASP.NET Core solution (a single project), the server-side code.
The server-side is similar to the solution described in the *Solution Structure* section above. This project serves the API, so the Angular application can consume it.
The client-side application consumes the HTTP APIs as mentioned. You can see the folder structure of the Angular project shown below:
![](../../images/single-layer-angular-folder-structure.png)
## See Also
* [Video tutorial](https://abp.io/video-courses/essentials/app-template)

52
docs/en/solution-templates/single-layer-web-application/authentication.md

@ -0,0 +1,52 @@
# Single Layer Solution: Authentication
```json
//[doc-nav]
{
"Previous": {
"Name": "Built-In Features",
"Path": "solution-templates/layered-web-application/built-in-features"
},
"Next": {
"Name": "Database configurations in the Single-Layer solution",
"Path": "solution-templates/layered-web-application/database-configurations"
}
}
```
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
The [Single Layer solution template](index.md) is fully configured for authentication. All the services and applications are configured to use the [OpenIddict](https://documentation.openiddict.com) library for authentication. They are configured in a common way for authentication. This document explains that common authentication structure.
## OpenIddict
[OpenIddict](https://documentation.openiddict.com) is an open-source library that provides a simple and easy way to implement an OpenID Connect server in your application. ABP has built-in modules ([OpenIddict](../../modules/openiddict.md), [OpenIddict UI **\***](../../modules/openiddict-pro.md)) to integrate OpenIddict into the solution.
## Initial Data Seeding
The Single Layer solution template includes an initial data seeding mechanism to create default clients (applications) and scopes for the solution, if necessary (e.g., when using an Angular UI). The `OpenIddictDataSeedContributor` class can be found in the `Data` folder of the host project. If authentication is handled by the UI application(e.g., MVC / Razor Pages), this class is not included.
The [OpenIddict UI **\***](../../modules/openiddict-pro.md) module is added only if you select it while creating the solution.
![new-solution-openiddict-module](images/new-solution-openiddict-module.png)
The OpenIddict UI **\*** module provides a user interface to manage the OpenIddict entities such as applications, scopes, etc. You can manage these entities from the application UI.
![openiddict-ui](images/openiddict-ui.png)
### External Providers
The authentication server handles token generation, validation, and user account management (e.g., login, registration). It uses the [Account](../../modules/account.md) or [Account Pro **\***](../../modules/account-pro.md) module. The [Account Pro **\***](../../modules/account-pro.md) module additionally supports [social logins](../../modules/account-pro.md#social--external-logins) (e.g., Google, Facebook). Social logins can be enabled, disabled, and configured directly from the application's user interface.
![account-external-provider](images/account-external-provider.png)
## Authentication Flows
Applications in the solution use different authentication flows depending on the application type:
- **MVC UI Web Application**:
Uses the [Hybrid Flow](https://openid.net/specs/openid-connect-core-1_0.html#HybridFlowAuth) (OpenID Connect Authentication) for user authentication.
- **SPA and Swagger Applications**:
Use the [Authorization Code Flow](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth) to authenticate users.
If the UI is a SPA application (such as an Angular app), the API host uses [JWT Bearer Authentication](https://jwt.io/introduction/) to authorize user actions.

51
docs/en/solution-templates/single-layer-web-application/blob-storing.md

@ -0,0 +1,51 @@
# Single Layer Solution: BLOB Storing
```json
//[doc-nav]
{
"Previous": {
"Name": "Multi-Tenancy",
"Path": "solution-templates/single-layer-web-application/multi-tenancy"
},
"Next": {
"Name": "CORS Configuration",
"Path": "solution-templates/single-layer-web-application/cors-configuration"
}
}
```
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
This document explains how to store BLOBs (Binary Large Objects) in a single-layer solution. Storing files, images, videos, and other large objects is common in distributed systems. For more details, refer to the [BLOB Storing System](../../framework/infrastructure/blob-storing/index.md) documentation.
In the single-layer solution template, the [Database Provider](../../framework/infrastructure/blob-storing/database.md) is used to store BLOBs in the database. The `Volo.Abp.BlobStoring.Database.EntityFrameworkCore` or `Volo.Abp.BlobStoring.Database.MongoDB` package provides the required implementations for storing and retrieving BLOBs in the database. This setup is integrated into the single-layer solution template and is used across all related projects. You can modify the database configuration in the `appsettings.json` file of the API project.
You can use the `IBlobContainer` or `IBlobContainer<T>` service to store and retrieve BLOBs. Here is an example of storing a BLOB:
```csharp
public class MyService : ITransientDependency
{
private readonly IBlobContainer _blobContainer;
public MyService(IBlobContainer blobContainer)
{
_blobContainer = blobContainer;
}
public async Task SaveBytesAsync(byte[] bytes)
{
await _blobContainer.SaveAsync("my-blob-1", bytes);
}
public async Task<byte[]> GetBytesAsync()
{
return await _blobContainer.GetAllBytesOrNullAsync("my-blob-1");
}
}
```
## File Management Module
The *File Management* module is optional and can be added to the solution during the creation process. It provides a user interface for managing folders and files. For more information, see the [File Management *](../../modules/file-management.md) document.
![file-management](images/file-management-index-page.png)

25
docs/en/solution-templates/single-layer-web-application/built-in-features.md

@ -0,0 +1,25 @@
# Single Layer Solution: Built-In Features
```json
//[doc-nav]
{
"Previous": {
"Name": "Db Migrator",
"Path": "solution-templates/single-layer-web-application/db-migrator"
},
"Next": {
"Name": "Authentication",
"Path": "solution-templates/single-layer-web-application/authentication"
}
}
```
The Single Layer solution template includes several built-in features to help you get started with your single-layer web application. These features are designed to provide a solid foundation for your application and help you focus on your business logic. This document provides an overview of the built-in features included in the Single Layer solution template. The following documents explain these features in detail:
* [Authentication](authentication.md)
* [Database configurations](database-configurations.md)
* [Logging (with Serilog)](logging.md)
* [Swagger integration](swagger-integration.md)
* [Multi-Tenancy](multi-tenancy.md)
* [BLOB storing](blob-storing.md)
* [CORS configuration](cors-configuration.md)

32
docs/en/solution-templates/single-layer-web-application/cors-configuration.md

@ -0,0 +1,32 @@
# Single Layer Solution: CORS Configuration
```json
//[doc-nav]
{
"Previous": {
"Name": "BLOB Storing",
"Path": "solution-templates/single-layer-web-application/blob-storing"
}
}
```
Cross-Origin Resource Sharing (CORS) is a security feature that allows web applications to make requests to a different domain than the one that served the web page.
In the single-layer solution template, CORS configuration is applied in the following cases:
- When [Angular](web-applications.md#angular) is selected as the web application type.
- When [Blazor WebAssembly](web-applications.md#blazor-webassembly) is selected as the web application type.
- When [No UI](web-applications.md#no-ui) is selected as the web application type.
CORS settings are configured in the `appsettings.json` file of the corresponding project. The web application usually serves as the entry point for front-end applications, so it must be set up to accept requests from different origins.
The default configuration in `appsettings.json` is as follows:
```json
{
"App": {
"CorsOrigins": "https://*.MyProjectName.com"
}
}
```
You can modify the `CorsOrigins` property to include additional domains or wildcard subdomains as needed for your application.

190
docs/en/solution-templates/single-layer-web-application/database-configurations.md

@ -0,0 +1,190 @@
# Single Layer Solution: Database configurations
```json
//[doc-nav]
{
"Previous": {
"Name": "Authentication",
"Path": "solution-templates/single-layer-web-application/authentication"
},
"Next": {
"Name": "Logging (with Serilog)",
"Path": "solution-templates/single-layer-web-application/logging"
}
}
```
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
ABP Studio's Single-Layer Solution Template includes pre-configured database settings. This document explains how to manage database configurations in your solution.
## Connection String
Connection strings are stored in the `appsettings.json` file and can be customized for different environments by editing this file. [Web Application](web-applications.md) projects use the `Default` connection string by default.
To update the connection string for the `Default` key, modify the `appsettings.json` file in your project. Connection strings are defined under the `ConnectionStrings` section, as shown below:
```json
{
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=Bookstore;Trusted_Connection=True;TrustServerCertificate=true"
}
}
```
## The DbContext Class
In the Single-Layer Solution Template, the `DbContext` class is defined in the main project. This class manages the database schema and is derived from the `AbpDbContext` class, which offers additional features and configurations. You can customize the `DbContext` class to add new entities, relationships, and configurations. It is located in the `Data` folder of the main project.
```csharp
public class BookstoreDbContext : AbpDbContext<BookstoreDbContext>
{
public const string DbTablePrefix = "App";
public const string DbSchema = null;
public BookstoreDbContext(DbContextOptions<BookstoreDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureFeatureManagement();
builder.ConfigurePermissionManagement();
builder.ConfigureBlobStoring();
builder.ConfigureIdentityPro();
builder.ConfigureOpenIddictPro();
builder.ConfigureGdpr();
builder.ConfigureLanguageManagement();
builder.ConfigureSaas();
builder.ConfigureTextTemplateManagement();
/* Configure your own entities here */
}
}
```
### OnModelCreating Method
The `OnModelCreating` method is used to configure the database schema. It calls the `Configure*` methods of the ABP Framework to configure the database schema for the modules. You can also configure your own tables/entities inside this method.
```csharp
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureFeatureManagement();
builder.ConfigureIdentityPro();
builder.ConfigureOpenIddictPro();
builder.ConfigureLanguageManagement();
builder.ConfigureSaas();
builder.ConfigureTextTemplateManagement();
builder.ConfigureGdpr();
builder.ConfigureCmsKit();
builder.ConfigureCmsKitPro();
builder.ConfigureBlobStoring();
/* Configure your own tables/entities inside here */
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(DbTablePrefix + "YourEntities", DbSchema);
// b.ConfigureByConvention(); //auto configure for the base class props
// //...
//});
}
```
> The `Configure*` methods are extension methods defined in each module's `EntityFrameworkCore` project. These methods are used to configure the database schema for their respective modules.
### Configuration
In the `BookstoreModule` class, the `ConfigureEfCore` method is used to configure the database context. It registers the `BookstoreDbContext` class to the [dependency injection](../../framework/fundamentals/dependency-injection.md) system and sets the SQL Server as the default DBMS for the application.
```csharp
private void ConfigureEfCore(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<BookstoreDbContext>(options =>
{
/* You can remove "includeAllEntities: true" to create
* default repositories only for aggregate roots
* Documentatidon: https://docs.abp.io/en/abp/latest/Entity-Framework-Core#add-default-repositories
*/
options.AddDefaultRepositories(includeAllEntities: true);
});
Configure<AbpDbContextOptions>(options =>
{
options.Configure(configurationContext =>
{
configurationContext.UseSqlServer();
});
});
}
```
## The `IDesignTimeDbContextFactory` Implementation
The `IDesignTimeDbContextFactory` interface is used to create a `DbContext` instance at design time. It is used by EF Core tools to create migrations and update the database. The `BookstoreDbContextFactory` class implements the `IDesignTimeDbContextFactory` interface to create a `BookstoreMigrationsDbContext` instance.
```csharp
public class BookstoreDbContextFactory : IDesignTimeDbContextFactory<BookstoreDbContext>
{
public BookstoreDbContext CreateDbContext(string[] args)
{
BookstoreEfCoreEntityExtensionMappings.Configure();
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<BookstoreDbContext>()
.UseSqlServer(configuration.GetConnectionString("Default"));
return new BookstoreDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();
}
}
```
## SaaS Module: The Tenant Management UI **\***
SaaS module provides the necessary UI to set and change connection string for tenants and trigger the database migrations.
### The Connection String Management Modal
You can click to the *Database Connection Strings* command in the *Actions* dropdown button for a tenant in the *Tenants* page of the SaaS module:
![Database Connection Strings](images/database-connection-strings.png)
It opens the *Database Connection Strings* modal as shown below:
![Database Connection Strings Modal](images/database-connection-strings-modal.png)
Here, we can set a *Default connection string* for the tenant.
When you make the changes and save the dialog, the database is automatically created and migrated. If you later update the connection string (for example if you change the database name), it will also trigger the database migration process again.
### Manually Applying the Database Migrations
If you need to manually trigger the database migrations for a specific tenant, click the *Actions* dropdown for the related tenant and select the *Apply Database Migrations* command on the *Tenant Management* page of the SaaS module:
![Apply Database Migrations](images/apply-database-migrations.png)

107
docs/en/solution-templates/single-layer-web-application/db-migrator.md

@ -0,0 +1,107 @@
# Single Layer Solution: Db Migrator
````json
//[doc-nav]
{
"Previous": {
"Name": "Web Applications",
"Path": "solution-templates/single-layer-web-application/web-applications"
},
"Next": {
"Name": "Built-In Features",
"Path": "solution-templates/single-layer-web-application/built-in-features"
}
}
````
Unlike the Layered solution template, the Single Layer solution template does not include a separate database migrator project. Instead, the main application project handles database migration and seed data operations. The `*.DbMigrator` project is excluded from this template. To manage database migrations and seed data, you can use the `migrate-database.ps1` script in the root directory or run the `dotnet run --migrate-database` command from the main application project directory.
![Single Layer Solution: Db Migrator](images/single-layer-db-migrator.png)
After the migration completes, a message will appear in the console. You can verify the success of the migration by checking the database.
## Database Migration Service
Under the `Data` folder of the project, the `BookstoreDbMigrationService` class is responsible for database migration and seed data operations. The `MigrateAsync` method is called in the `Program` class to migrate the database when the application starts with the `--migrate-database` argument.
First, it checks if the database is created and applies the pending migrations. Then, it seeds the initial data using the `SeedAsync` method.
```csharp
public async Task MigrateAsync()
{
var initialMigrationAdded = AddInitialMigrationIfNotExist();
if (initialMigrationAdded)
{
return;
}
Logger.LogInformation("Started database migrations...");
await MigrateDatabaseSchemaAsync();
await SeedDataAsync();
Logger.LogInformation($"Successfully completed host database migrations.");
var tenants = await _tenantRepository.GetListAsync(includeDetails: true);
var migratedDatabaseSchemas = new HashSet<string>();
foreach (var tenant in tenants)
{
using (_currentTenant.Change(tenant.Id))
{
if (tenant.ConnectionStrings.Any())
{
var tenantConnectionStrings = tenant.ConnectionStrings
.Select(x => x.Value)
.ToList();
if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings))
{
await MigrateDatabaseSchemaAsync(tenant);
migratedDatabaseSchemas.AddIfNotContains(tenantConnectionStrings);
}
}
await SeedDataAsync(tenant);
}
Logger.LogInformation($"Successfully completed {tenant.Name} tenant database migrations.");
}
Logger.LogInformation("Successfully completed all database migrations.");
Logger.LogInformation("You can safely end this process...");
}
```
The `BookstoreDbSchemaMigrator` class is used in the `MigrateDatabaseSchemaAsync` method for the database migration process. It is responsible for applying migrations to the database.
```csharp
public class BookstoreDbSchemaMigrator : ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public BookstoreDbSchemaMigrator(
IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public async Task MigrateAsync()
{
/* We intentionally resolving the BookstoreDbContext
* from IServiceProvider (instead of directly injecting it)
* to properly get the connection string of the current tenant in the
* current scope.
*/
await _serviceProvider
.GetRequiredService<BookstoreDbContext>()
.Database
.MigrateAsync();
}
}
```

BIN
docs/en/solution-templates/single-layer-web-application/images/account-external-provider.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
docs/en/solution-templates/single-layer-web-application/images/apply-database-migrations.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
docs/en/solution-templates/single-layer-web-application/images/database-connection-strings-modal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/en/solution-templates/single-layer-web-application/images/database-connection-strings.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
docs/en/solution-templates/single-layer-web-application/images/file-management-index-page.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
docs/en/solution-templates/single-layer-web-application/images/new-solution-openiddict-module.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
docs/en/solution-templates/single-layer-web-application/images/openiddict-ui.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
docs/en/solution-templates/single-layer-web-application/images/saas-module-selection.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

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

Loading…
Cancel
Save