Browse Source

Merge branch 'dev' into berkan/abpIo-localization

pull/12960/head
Berkan Sasmaz 4 years ago
parent
commit
eb3fd252d2
No known key found for this signature in database GPG Key ID: 4E387A3A3BCC339B
  1. 26
      docs/en/CLI.md
  2. 1
      docs/en/Startup-Templates/Index.md
  3. 2
      docs/en/Tutorials/Todo/Single-Layer/Index.md
  4. BIN
      docs/en/Tutorials/Todo/Single-Layer/todo-single-layer-ui-initial.png
  5. 50
      docs/en/UI/Angular/Breadcrumb.md
  6. 25
      docs/en/UI/Blazor/Global-Features.md
  7. 249
      docs/en/UI/Blazor/Pwa-Configuration.md
  8. 8
      docs/en/docs-nav.json
  9. 20
      docs/zh-Hans/CLI.md
  10. 2
      framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Extensibility/BlazorServerLookupApiRequestService.cs
  11. 5
      framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/AbpAspNetCoreComponentsWebModule.cs
  12. 6
      framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs
  13. 32
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpWebAssemblyHostBuilderExtensions.cs
  14. 38
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs
  15. 5
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs
  16. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/ICachedApplicationConfigurationClient.cs
  17. 14
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs
  18. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs
  19. 7
      framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerBase.cs
  20. 8
      framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs
  21. 5
      framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfirePeriodicBackgroundWorkerAdapter.cs
  22. 7
      framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/IHangfireBackgroundWorker.cs
  23. 23
      framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzBackgroundWorkerManager.cs
  24. 4
      framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzPeriodicBackgroundWorkerAdapter.cs
  25. 13
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs
  26. 4
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs
  27. 11
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkersApplicationInitializationContextExtensions.cs
  28. 6
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/IBackgroundWorkerManager.cs
  29. 10
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerContext.cs
  30. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
  31. 172
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CliCommand.cs
  32. 25
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
  33. 8
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/ICmdHelper.cs
  34. 17
      framework/src/Volo.Abp.Core/System/Linq/AbpQueryableExtensions.cs
  35. 26
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/CachedServiceProvider.cs
  36. 25
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/CachedServiceProviderBase.cs
  37. 2
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ICachedServiceProvider.cs
  38. 14
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ITransientCachedServiceProvider.cs
  39. 15
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/TransientCachedServiceProvider.cs
  40. 12
      framework/src/Volo.Abp.Core/Volo/Abp/IAsyncInitialize.cs
  41. 2
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
  42. 17
      framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs
  43. 5
      framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs
  44. 2
      framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs
  45. 2
      framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
  46. 6
      framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/fa.json
  47. 102
      framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/CachedServiceProvider_Tests.cs
  48. 1330
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20220504031950_Add_IsActive_To_BlogUser.Designer.cs
  49. 26
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20220504031950_Add_IsActive_To_BlogUser.cs
  50. 7
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs
  51. 4
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs
  52. 456
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20210609081519_Initial.cs
  53. 151
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20220504032110_Initial.Designer.cs
  54. 466
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20220504032110_Initial.cs
  55. 149
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs
  56. 1861
      modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20201013055450_Initial.Designer.cs
  57. 1096
      modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20201013055450_Initial.cs
  58. 1322
      modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20220504032505_Initial.Designer.cs
  59. 1318
      modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20220504032505_Initial.cs
  60. 1404
      modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs
  61. 26
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220324203918_Added_BlogPostStatus.cs
  62. 11
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220504032430_Initial.Designer.cs
  63. 2
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220504032430_Initial.cs
  64. 7
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs
  65. 4
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs
  66. 4
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Users/CmsUser.cs
  67. 2
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs
  68. 2
      modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.abppkg.analyze.json
  69. 7
      modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeCache.cs
  70. 7
      modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeStore.cs
  71. 2
      modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs
  72. 7
      modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs
  73. 2
      modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserEto.cs
  74. 1
      modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs
  75. 2
      modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs
  76. 1
      modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/AbpUsersDbContextModelCreatingExtensions.cs
  77. 3
      npm/ng-packs/.gitignore
  78. 2
      npm/ng-packs/package.json
  79. 2
      npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts
  80. 2
      npm/ng-packs/packages/theme-shared/package.json
  81. 13805
      npm/ng-packs/yarn.lock
  82. 2
      templates/app-nolayers/aspnet-core/README.md
  83. 6
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/index.html
  84. 7
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20220606082402_Initial.Designer.cs
  85. 0
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20220606082402_Initial.cs
  86. 5
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
  87. 3
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs

26
docs/en/CLI.md

@ -27,6 +27,7 @@ While each command may have a set of options, there are some global options that
Here, is the list of all available commands before explaining their details:
* **`help`**: Shows help on the usage of the ABP CLI.
* **`cli`**: Update or remove ABP CLI.
* **`new`**: Generates a new solution based on the ABP [startup templates](Startup-Templates/Index.md).
* **`update`**: Automatically updates all ABP related NuGet and NPM packages in a solution.
* **`clean`**: Deletes all `BIN` and `OBJ` folders in the current folder.
@ -63,6 +64,25 @@ abp help # Shows a general help.
abp help new # Shows help about the "new" command.
````
### cli
Update or remove ABP CLI.
Usage:
````bash
abp cli [command-name]
````
Examples:
````bash
abp cli update
abp cli update --preview
abp cli update --version 5.0.0
abp cli remove
````
### new
Generates a new solution based on the ABP [startup templates](Startup-Templates/Index.md).
@ -106,6 +126,9 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample
* `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers:
* `ef`: Entity Framework Core.
* `mongodb`: MongoDB.
* `--theme`: Specifes the theme. Default theme is `leptonx-lite`. Available themes:
* `leptonx-lite`: [LeptonX Lite Theme](/Themes/LeptonXLite/mvc.md).
* `basic`: [Basic Theme](/UI/AspNetCore/Basic-Theme.md).
* **`module`**: [Module template](Startup-Templates/Module.md). Additional options:
* `--no-ui`: Specifies to not include the UI. This makes possible to create service-only modules (a.k.a. microservices - without UI).
* **`console`**: [Console template](Startup-Templates/Console.md).
@ -118,6 +141,9 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample
* `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers:
* `ef`: Entity Framework Core.
* `mongodb`: MongoDB.
* `--theme`: Specifes the theme. Default theme is `leptonx-lite`. Available themes:
* `leptonx-lite`: [LeptonX Lite Theme](/Themes/LeptonXLite/mvc.md).
* `basic`: [Basic Theme](/UI/AspNetCore/Basic-Theme.md).
* `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory.
* `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version.
* `--preview`: Use latest preview version.

1
docs/en/Startup-Templates/Index.md

@ -3,6 +3,7 @@
While you can start with an empty project and add needed packages manually, startup templates make easy and comfortable to start a new solution with the ABP framework. Click the name from the list below to see the documentation of the related startup template:
* [**app**](Application.md): Application template.
* [**app-nolayers**](Application-Single-Layer.md): Application (single layer) template.
* [**module**](Module.md): Module/service template.
* [**console**](Console.md): Console template.
* [**WPF**](WPF.md): WPF template.

2
docs/en/Tutorials/Todo/Single-Layer/Index.md

@ -74,7 +74,7 @@ It is good to run the application before starting the development. The solution
Firstly, run the `TodoApp` project in your favorite IDE (or run the `dotnet run` CLI command on your project directory) to see the server-side HTTP API on [Swagger UI](https://swagger.io/tools/swagger-ui/):
![todo-swagger-ui-initial](../todo-swagger-ui-initial.png)
![todo-swagger-ui-initial](./todo-single-layer-ui-initial.png)
You can explore and test your HTTP API with this UI. If it works, then we can run the Angular client application.

BIN
docs/en/Tutorials/Todo/Single-Layer/todo-single-layer-ui-initial.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

50
docs/en/UI/Angular/Breadcrumb.md

@ -0,0 +1,50 @@
## Breadcrumb Component
ABP provides a component that listens to the angular router's `NavigationEnd`
event and creates inputs for `BreadcrumbItemsComponent`. This component is used in
ABP components with [`PageComponent`](./Page-Component.md).
## Breadcrumb Items Component
`BreadcrumbItemsComponent` is used to display breadcrumb items. It can be useful
when you want to display breadcrumb items in a different way than the default.
### Usage
Example of overriding the default template of `PageComponent`:
```html
<abp-page title="Title">
<abp-page-breadcrumb-container>
<abp-breadcrumb-items [items]="breadCrumbItems"></abp-breadcrumb-items>
</abp-page-breadcrumb-container>
</abp-page>
```
```js
import { Component } from "@angular/core";
import { ABP } from "@abp/ng.core";
@Component({
/* component metadata */
})
export class YourComponent {
breadCrumbItems: ABP.Route[] = [
{
name: "Item 1",
},
{
name: "Item 2",
path: "/path",
},
];
}
```
### Inputs
- items: Partial<ABP.Route>[] : Array of ABP.Route objects. The source code of ABP.Route can be found in [github](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/models/common.ts#L69).
## See Also
- [Page Component](./Page-Component.md)

25
docs/en/UI/Blazor/Global-Features.md

@ -0,0 +1,25 @@
# Blazor UI: Global Features
`GlobalFeatureManager` allows you to check the global features in your Blazor applications.
## Usage
```html
@using Volo.Abp.GlobalFeatures
@* ... *@
@* Global Feature can be checked with feature name *@
@if(GlobalFeatureManager.Instance.IsEnabled("Ecommerce.Subscription"))
{
<span>Ecommerce.Subscription is enabled.</span>
}
@* OR it can be checked with type *@
@if(GlobalFeatureManager.Instance.IsEnabled<EcommerceSubscriptionGlobalFeature>())
{
<span>Ecommerce.Subscription is enabled.</span>
}
```
- You can follow _Check for a Global Feature_ section of the [Global Features document](../../Global-Features.md) to check global features in your C# code.

249
docs/en/UI/Blazor/Pwa-Configuration.md

@ -0,0 +1,249 @@
# PWA Configuration
[PWAs (Progressive Web Apps)](https://web.dev/progressive-web-apps/) are developed using specific technologies to allow applications to take advantage of both web and native app features.
Here is a list of some features that PWA provides:
- **Installable**: A web application can be installed and used like a native/desktop application.
- **Network Independent**: PWAs support offline scenarios. It can work offline or with a poor network connection.
- **Responsive**: It's usable on any devices such as mobile phones, tablets, laptops, etc.
## Creating a Project with PWA Support
You can create a new web application with PWA support for **Blazor WebAssembly** by using the `--pwa` option as below:
```bash
abp new Acme.BookStore -t blazor --pwa
```
After this command, your application will be created and some additional PWA related files (such as **manifest**, **icons**, **service workers**, etc.) will be added. Then, you can get the full advantages of web and native app features.
## Adding PWA Support to an Existing Project
If you started your application without PWA support, it's possible to change your mind and get the benefit of PWA later. You only need to make some configurations as listed below:
### 1-) Add the `manifest.json` File
> Web Application Manifest provides information about a web application in a JSON text file and it's required for the web application to be downloaded and be presented to the user similarly to a native application.
First, you need to create a JSON file named **manifest.json** under the **wwwroot** folder and define some pieces of information about your application. You can see an example **manifest.json** file content below:
```json
{
"name": "MyProjectName",
"short_name": "MyCompanyName.MyProjectName",
"start_url": "./",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#03173d",
"prefer_related_applications": false,
"icons": [
{
"src": "icon-512.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "icon-192.png",
"type": "image/png",
"sizes": "192x192"
}
]
}
```
- Some application specific information should be defined in this file.
- For example, you can configure which icon needs to be seen in which screen size, background color, description, etc.
### 2-) Add Icons for Specific Screen Sizes (Optional)
You can add some icons for your application to be seen in specific screen sizes and define in which screen sizes icons should be displayed in the **manifest.json** file. You can see the **icons** section in the **manifest.json** file as an example above.
> You can use, default icons from our [template](https://github.com/abpframework/abp/tree/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot).
### 3-) Configure Service Workers
> Service workers are one of the fundamental parts of PWAs. They enable fast loading (regardless of the network), offline access, push notifications, and other web/native app capabilities. They run in the background and don't block the main thread so they don't slow your application.
You need to create `service-worker.js` and `service-worker.published.js` files under the **wwwroot** folder of your project. These files will be used by your project to determine which PWA features you want to use.
You can get the simple configurations for the [service-worker.js](https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/service-worker.js) and [service-worker.published.js](https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/service-worker.published.js) files from our [template](https://github.com/abpframework/abp/tree/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot).
After the related service worker files are added, then we need to define them in our `.csproj` file to notify our application. So open your `*.csproj` file and add the following content:
```xml
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
<!-- Add the following line -->
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>
<!-- Add the following item group -->
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>
```
* With the `ServiceWorkerAssetsManifest` MSBuild property, your Blazor application generates a service worker assets manifest with the specified name. This file will be generated in the path of `/bin/Debug/{TARGET FRAMEWORK}/wwwroot/service-worker-assets.js` on runtime. This manifest can list all resources such as images, stylesheets, JS files etc. by examining the `service-worker.published.js` file (regarding to your configurations in this file).
* The `ServiceWorker` property is used to define which files need to be accounted as **Service Worker** files and service workers are used to determine which PWA features should be used.
### 4-) Define Web Application Manifest and Register Service Workers
Finally, now you can define the `manifest.json` file and **icons** in the **index.html** file and register the **service workers** for your application.
Let's start with adding `<link>` elements (between `<head>` tags) for the manifest and app icon in the **index.html** file (under the **wwwroot** folder):
```html
<head>
<!-- ... -->
<link href="manifest.json" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
<link rel="apple-touch-icon" sizes="192x192" href="icon-192.png" />
</head>
```
Then, add the following `<script>` tag inside the closing `</body>` tag in the same file:
```html
<body>
<!-- ... -->
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register("service-worker.js");
}
</script>
</body>
```
You've added the related files and made the related configurations with this final touch to add PWA support to your existing application. Now, you can take full advantage of PWAs.
## Differences Between the Debug and Published Service Workers
Application Template produces two service worker files, if you create your application with PWA support:
* The `service-worker.js` file is used during development and does nothing by default.
* The `service-worker.published.js` file, which is used after the app is published. Caches certain file extensions and supports offline scenarios by default (uses a *cache-first* strategy). A user must first visit the app while they're online. The browser automatically downloads and caches all of the resources required to operate offline and then when the network connection is disconnected, it can be used like before.
You can configure those files as mentioned in the *Customize Service Workers* section down below.
> If you want to share logic between those two service worker files, you can consider creating a third JS file and hold the common logic in this file or use the [self.importScripts](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/importScripts)s to load the common logic into both service worker files.
## Customization
You can customize the `manifest.json`, `service-worker.js` and `service-worker.published.js` files generated by the ABP Framework if you created an application with PWA support.
### Customize Web Application Manifest (`manifest.json`)
> The web app manifest is a JSON file that tells the browser about your Progressive Web App and how it should behave when installed on the user's desktop or mobile device. A typical manifest file includes the app name, the icons the app should use, and the URL that should be opened when the app is launched. - From [web.dev](https://web.dev/add-manifest)
You can customize the `manifest.json` file (under the **wwwroot** folder) to your needs. You can set the **name**, **short_name**, **icons**, **description**, **start_url**, etc. You can see an example `manifest.json` file content below:
```json
{
"name": "Acme.BookStore",
"short_name": "BookStore",
"description": "My application description",
"theme_color": "#000000",
"background_color": "#ffffff",
"icons": [
{
"src": "../icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "../icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
// other properties...
}
```
* You must provide at least the `short_name` or `name` property. If both of these properties are provided, the `short_name` property is used almost anywhere like the **launcher** and the **home** screen.
* For Chromium based browsers, you must provide at least a *192x192* px icon and a *512x512* px icon. If only those two icon sizes are provided, the browsers will automatically scale the icons to fit the device. If you don't want to let the browser auto-scale icons, you need to add icons for other sizes too.
> You can see the other properties from [here](https://web.dev/add-manifest/#manifest-properties).
### Customize Service Workers
If you create your application with PWA support, two service worker files will be generated: `service-worker.js` and `service-worker.published.js`.
ABP Framework's service-worker files are the same as the .NET Core's and it's valid for most of the time and you'll probably not need to configure it manually. However, if you want to configure the service workers you can do it easily.
You can configure the `service-worker.js` file for debug mode and the `service-worker.published.js` file for release mode according to your own needs.
#### `service-worker.js`
```js
// Caution: In development, always fetch from the network and do not enable offline support.
self.addEventListener('fetch', () => { });
```
* Configuring this file, you can use additional PWA features in debug mode.
* By default, it does nothing in debug mode, it fetches from the network (recommended) and does not support offline scenarios. You can change this behavior by configuring this file and also benefit from additional features of PWAs.
#### `service-worker.published.js`
```js
// Caution: Be sure you understand the caveats before publishing an application with
// offline support. See https://aka.ms/blazor-offline-considerations
self.importScripts('./service-worker-assets.js');
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
self.addEventListener('fetch', event => event.respondWith(onFetch(event)));
const cacheNamePrefix = 'offline-cache-';
const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`;
const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ];
const offlineAssetsExclude = [ /^service-worker\.js$/ ];
async function onInstall(event) {
console.info('Service worker: Install');
// Fetch and cache all matching items from the assets manifest
const assetsRequests = self.assetsManifest.assets
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
.map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' }));
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
}
async function onActivate(event) {
console.info('Service worker: Activate');
// Delete unused caches
const cacheKeys = await caches.keys();
await Promise.all(cacheKeys
.filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName)
.map(key => caches.delete(key)));
}
async function onFetch(event) {
let cachedResponse = null;
if (event.request.method === 'GET') {
// For all navigation requests, try to serve index.html from cache
// If you need some URLs to be server-rendered, edit the following check to exclude those URLs
const shouldServeIndexHtml = event.request.mode === 'navigate';
const request = shouldServeIndexHtml ? 'index.html' : event.request;
const cache = await caches.open(cacheName);
cachedResponse = await cache.match(request);
}
return cachedResponse || fetch(event.request);
}
```
* You can configure this file if you want to cache additional file extensions such as `.webp` or etc. You can also use some additional features of PWA by configuring this file.
* By default, dll files (`*.dll`) and some static assets (`*.js`, `*.css`, etc.) are cached.
* Cached files will be stored in the `service-worker-assets.js` (**/bin/Debug/{TARGET FRAMEWORK}/wwwroot/service-worker-assets.js**). You can change this file name by renaming it in between the `ServiceWorkerAssetsManifest` tags on your `*.csproj` file.
## See Also
* [ASP.NET Core Blazor Progressive Web Application (PWA)](https://docs.microsoft.com/en-us/aspnet/core/blazor/progressive-web-app).

8
docs/en/docs-nav.json

@ -920,9 +920,17 @@
"text": "Global Scripts & Styles",
"path": "UI/Blazor/Global-Scripts-Styles.md"
},
{
"text": "Global Features",
"path": "UI/Blazor/Global-Features.md"
},
{
"text": "Routing",
"path": "UI/Blazor/Routing.md"
},
{
"text": "PWA Configuration",
"path": "UI/Blazor/Pwa-Configuration.md"
}
]
},

20
docs/zh-Hans/CLI.md

@ -27,6 +27,7 @@ dotnet tool update -g Volo.Abp.Cli
这里是所有可用的命令列表:
* **`help`**: 展示ABP CLI的用法帮助信息.
* **`cli`**: 更新或删除ABP CLI.
* **`new`**:生成基于ABP的[启动模板](Startup-Templates/Index.md).
* **`update`**:自动更新的ABP解决方案ABP相关的NuGet和NPM包.
* **`clean`**: 删除当前目录下所有的 `BIN``OBJ` 子目录.
@ -60,6 +61,25 @@ abp help # Shows a general help.
abp help new # Shows help about the "new" command.
````
### cli
更新或删除ABP CLI
用法:
````bash
abp cli [command-name]
````
示例:
````bash
abp cli update
abp cli update --preview
abp cli update --version 5.0.0
abp cli remove
````
### new
生成基于ABP[启动模板](Startup-Templates/Index.md)的新解决方案.

2
framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Extensibility/BlazorServerLookupApiRequestService.cs

@ -64,7 +64,7 @@ public class BlazorServerLookupApiRequestService : ILookupApiRequestService, ITr
client.BaseAddress = new Uri(baseUrl);
foreach (var header in HttpContextAccessor.HttpContext.Request.Headers)
{
requestMessage.Headers.Add(header.Key, header.Value.ToArray());
requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
}
}
}

5
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/AbpAspNetCoreComponentsWebModule.cs

@ -13,11 +13,6 @@ namespace Volo.Abp.AspNetCore.Components.Web;
)]
public class AbpAspNetCoreComponentsWebModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.Replace(ServiceDescriptor.Transient<IComponentActivator, ServiceProviderComponentActivator>());

6
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs

@ -7,11 +7,7 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Components.Web.Security;
[ExposeServices(
typeof(AbpComponentsClaimsCache),
typeof(IAsyncInitialize)
)]
public class AbpComponentsClaimsCache : IScopedDependency, IAsyncInitialize
public class AbpComponentsClaimsCache : IScopedDependency
{
public ClaimsPrincipal Principal { get; private set; }

32
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpWebAssemblyHostBuilderExtensions.cs

@ -1,15 +1,12 @@
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Web.DependencyInjection;
using Volo.Abp.AspNetCore.Components.WebAssembly;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Modularity;
@ -76,34 +73,5 @@ public static class AbpWebAssemblyHostBuilderExtensions
.GetRequiredService<IClientScopeServiceProviderAccessor>()).ServiceProvider = serviceProvider;
await application.InitializeAsync(serviceProvider);
await InitializeModulesAsync(serviceProvider);
await SetCurrentLanguageAsync(serviceProvider);
}
private async static Task InitializeModulesAsync(IServiceProvider serviceProvider)
{
foreach (var service in serviceProvider.GetServices<IAsyncInitialize>())
{
await service.InitializeAsync();
}
}
private async static Task SetCurrentLanguageAsync(IServiceProvider serviceProvider)
{
var configurationClient = serviceProvider.GetRequiredService<ICachedApplicationConfigurationClient>();
var utilsService = serviceProvider.GetRequiredService<IAbpUtilsService>();
var configuration = await configurationClient.GetAsync();
var cultureName = configuration.Localization?.CurrentCulture?.CultureName;
if (!cultureName.IsNullOrEmpty())
{
var culture = new CultureInfo(cultureName);
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
}
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
{
await utilsService.AddClassToTagAsync("body", "rtl");
}
}
}

38
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs

@ -1,10 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Web.ExceptionHandling;
using Volo.Abp.AspNetCore.Components.Web.Security;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.Http.Client;
using Volo.Abp.Modularity;
using Volo.Abp.Threading;
using Volo.Abp.UI;
namespace Volo.Abp.AspNetCore.Components.WebAssembly;
@ -33,4 +38,35 @@ public class AbpAspNetCoreComponentsWebAssemblyModule : AbpModule
.GetHostBuilder().Logging
.AddProvider(new AbpExceptionHandlingLoggerProvider(context.Services));
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
AsyncHelper.RunSync(() => OnApplicationInitializationAsync(context));
}
public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
{
await context.ServiceProvider.GetRequiredService<WebAssemblyCachedApplicationConfigurationClient>().InitializeAsync();
await context.ServiceProvider.GetRequiredService<AbpComponentsClaimsCache>().InitializeAsync();
await SetCurrentLanguageAsync(context.ServiceProvider);
}
private async static Task SetCurrentLanguageAsync(IServiceProvider serviceProvider)
{
var configurationClient = serviceProvider.GetRequiredService<ICachedApplicationConfigurationClient>();
var utilsService = serviceProvider.GetRequiredService<IAbpUtilsService>();
var configuration = await configurationClient.GetAsync();
var cultureName = configuration.Localization?.CurrentCulture?.CultureName;
if (!cultureName.IsNullOrEmpty())
{
var culture = new CultureInfo(cultureName);
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
}
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
{
await utilsService.AddClassToTagAsync("body", "rtl");
}
}
}

5
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs

@ -7,11 +7,6 @@ using Volo.Abp.MultiTenancy;
namespace Volo.Abp.AspNetCore.Components.WebAssembly;
[ExposeServices(
typeof(WebAssemblyCachedApplicationConfigurationClient),
typeof(ICachedApplicationConfigurationClient),
typeof(IAsyncInitialize)
)]
public class WebAssemblyCachedApplicationConfigurationClient : ICachedApplicationConfigurationClient, ITransientDependency
{
protected AbpApplicationConfigurationClientProxy ApplicationConfigurationAppService { get; }

2
framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/ICachedApplicationConfigurationClient.cs

@ -3,7 +3,7 @@ using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
namespace Volo.Abp.AspNetCore.Mvc.Client;
public interface ICachedApplicationConfigurationClient : IAsyncInitialize
public interface ICachedApplicationConfigurationClient
{
Task<ApplicationConfigurationDto> GetAsync();

14
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs

@ -1,5 +1,8 @@
using Volo.Abp.EventBus;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EventBus;
using Volo.Abp.Modularity;
using Volo.Abp.Threading;
namespace Volo.Abp.AspNetCore.Mvc.Client;
@ -9,4 +12,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client;
)]
public class AbpAspNetCoreMvcClientModule : AbpModule
{
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
AsyncHelper.RunSync(() => OnApplicationInitializationAsync(context));
}
public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
{
await context.ServiceProvider.GetRequiredService<MvcCachedApplicationConfigurationClient>().InitializeAsync();
}
}

5
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs

@ -11,11 +11,6 @@ using Volo.Abp.Users;
namespace Volo.Abp.AspNetCore.Mvc.Client;
[ExposeServices(
typeof(MvcCachedApplicationConfigurationClient),
typeof(ICachedApplicationConfigurationClient),
typeof(IAsyncInitialize)
)]
public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigurationClient, ITransientDependency
{
protected IHttpContextAccessor HttpContextAccessor { get; }

7
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerBase.cs

@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Volo.Abp.BackgroundWorkers.Hangfire;
@ -8,12 +9,12 @@ public abstract class HangfireBackgroundWorkerBase : BackgroundWorkerBase, IHang
public string RecurringJobId { get; set; }
public string CronExpression { get; set; }
public TimeZoneInfo TimeZone { get; set; }
public string Queue { get; set; }
public abstract Task DoWorkAsync();
public abstract Task DoWorkAsync(CancellationToken cancellationToken = default);
protected HangfireBackgroundWorkerBase()
{

8
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs

@ -33,19 +33,19 @@ public class HangfireBackgroundWorkerManager : IBackgroundWorkerManager, ISingle
return Task.CompletedTask;
}
public Task AddAsync(IBackgroundWorker worker)
public Task AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken = default)
{
if (worker is IHangfireBackgroundWorker hangfireBackgroundWorker)
{
var unProxyWorker = ProxyHelper.UnProxy(hangfireBackgroundWorker);
if (hangfireBackgroundWorker.RecurringJobId.IsNullOrWhiteSpace())
{
RecurringJob.AddOrUpdate(() => ((IHangfireBackgroundWorker)unProxyWorker).DoWorkAsync(),
RecurringJob.AddOrUpdate(() => ((IHangfireBackgroundWorker)unProxyWorker).DoWorkAsync(cancellationToken),
hangfireBackgroundWorker.CronExpression, hangfireBackgroundWorker.TimeZone, hangfireBackgroundWorker.Queue);
}
else
{
RecurringJob.AddOrUpdate(hangfireBackgroundWorker.RecurringJobId, () => ((IHangfireBackgroundWorker)unProxyWorker).DoWorkAsync(),
RecurringJob.AddOrUpdate(hangfireBackgroundWorker.RecurringJobId, () => ((IHangfireBackgroundWorker)unProxyWorker).DoWorkAsync(cancellationToken),
hangfireBackgroundWorker.CronExpression, hangfireBackgroundWorker.TimeZone, hangfireBackgroundWorker.Queue);
}
}
@ -80,7 +80,7 @@ public class HangfireBackgroundWorkerManager : IBackgroundWorkerManager, ISingle
var adapterType = typeof(HangfirePeriodicBackgroundWorkerAdapter<>).MakeGenericType(ProxyHelper.GetUnProxiedType(worker));
var workerAdapter = Activator.CreateInstance(adapterType) as IHangfireBackgroundWorker;
RecurringJob.AddOrUpdate(() => workerAdapter.DoWorkAsync(), GetCron(period.Value), workerAdapter.TimeZone, workerAdapter.Queue);
RecurringJob.AddOrUpdate(() => workerAdapter.DoWorkAsync(cancellationToken), GetCron(period.Value), workerAdapter.TimeZone, workerAdapter.Queue);
}
return Task.CompletedTask;

5
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfirePeriodicBackgroundWorkerAdapter.cs

@ -1,4 +1,5 @@
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
@ -17,9 +18,9 @@ public class HangfirePeriodicBackgroundWorkerAdapter<TWorker> : HangfireBackgrou
_doWorkMethod = typeof(TWorker).GetMethod("DoWork", BindingFlags.Instance | BindingFlags.NonPublic);
}
public async override Task DoWorkAsync()
public async override Task DoWorkAsync(CancellationToken cancellationToken = default)
{
var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider);
var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider, cancellationToken);
var worker = ServiceProvider.GetRequiredService<TWorker>();
switch (worker)

7
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/IHangfireBackgroundWorker.cs

@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Volo.Abp.BackgroundWorkers.Hangfire;
@ -8,12 +9,10 @@ public interface IHangfireBackgroundWorker : IBackgroundWorker
string RecurringJobId { get; set; }
string CronExpression { get; set; }
TimeZoneInfo TimeZone { get; set; }
string Queue { get; set; }
Task DoWorkAsync();
Task DoWorkAsync(CancellationToken cancellationToken = default);
}

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

@ -4,7 +4,6 @@ using System.Threading.Tasks;
using Quartz;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
using Volo.Abp.Threading;
namespace Volo.Abp.BackgroundWorkers.Quartz;
@ -34,12 +33,12 @@ public class QuartzBackgroundWorkerManager : IBackgroundWorkerManager, ISingleto
}
}
public virtual async Task AddAsync(IBackgroundWorker worker)
public virtual async Task AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken = default)
{
await ReScheduleJobAsync(worker);
await ReScheduleJobAsync(worker, cancellationToken);
}
protected virtual async Task ReScheduleJobAsync(IBackgroundWorker worker)
protected virtual async Task ReScheduleJobAsync(IBackgroundWorker worker, CancellationToken cancellationToken = default)
{
if (worker is IQuartzBackgroundWorker quartzWork)
{
@ -52,7 +51,7 @@ public class QuartzBackgroundWorkerManager : IBackgroundWorkerManager, ISingleto
}
else
{
await DefaultScheduleJobAsync(quartzWork);
await DefaultScheduleJobAsync(quartzWork, cancellationToken);
}
}
else
@ -65,22 +64,22 @@ public class QuartzBackgroundWorkerManager : IBackgroundWorkerManager, ISingleto
if (workerAdapter?.Trigger != null)
{
await DefaultScheduleJobAsync(workerAdapter);
await DefaultScheduleJobAsync(workerAdapter, cancellationToken);
}
}
}
protected virtual async Task DefaultScheduleJobAsync(IQuartzBackgroundWorker quartzWork)
protected virtual async Task DefaultScheduleJobAsync(IQuartzBackgroundWorker quartzWork, CancellationToken cancellationToken = default)
{
if (await _scheduler.CheckExists(quartzWork.JobDetail.Key))
if (await _scheduler.CheckExists(quartzWork.JobDetail.Key, cancellationToken))
{
await _scheduler.AddJob(quartzWork.JobDetail, true, true);
await _scheduler.ResumeJob(quartzWork.JobDetail.Key);
await _scheduler.RescheduleJob(quartzWork.Trigger.Key, quartzWork.Trigger);
await _scheduler.AddJob(quartzWork.JobDetail, true, true, cancellationToken);
await _scheduler.ResumeJob(quartzWork.JobDetail.Key, cancellationToken);
await _scheduler.RescheduleJob(quartzWork.Trigger.Key, quartzWork.Trigger, cancellationToken);
}
else
{
await _scheduler.ScheduleJob(quartzWork.JobDetail, quartzWork.Trigger);
await _scheduler.ScheduleJob(quartzWork.JobDetail, quartzWork.Trigger, cancellationToken);
}
}
}

4
framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzPeriodicBackgroundWorkerAdapter.cs

@ -67,10 +67,10 @@ public class QuartzPeriodicBackgroundWorkerAdapter<TWorker> : QuartzBackgroundWo
.Build();
}
public override async Task Execute(IJobExecutionContext context)
public async override Task Execute(IJobExecutionContext context)
{
var worker = (IBackgroundWorker) ServiceProvider.GetService(typeof(TWorker));
var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider);
var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider, context.CancellationToken);
switch (worker)
{

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

@ -12,6 +12,7 @@ public abstract class AsyncPeriodicBackgroundWorkerBase : BackgroundWorkerBase
{
protected IServiceScopeFactory ServiceScopeFactory { get; }
protected AbpAsyncTimer Timer { get; }
protected CancellationToken StartCancellationToken { get; set; }
protected AsyncPeriodicBackgroundWorkerBase(
AbpAsyncTimer timer,
@ -22,13 +23,15 @@ public abstract class AsyncPeriodicBackgroundWorkerBase : BackgroundWorkerBase
Timer.Elapsed = Timer_Elapsed;
}
public override async Task StartAsync(CancellationToken cancellationToken = default)
public async override Task StartAsync(CancellationToken cancellationToken = default)
{
StartCancellationToken = cancellationToken;
await base.StartAsync(cancellationToken);
Timer.Start(cancellationToken);
}
public override async Task StopAsync(CancellationToken cancellationToken = default)
public async override Task StopAsync(CancellationToken cancellationToken = default)
{
Timer.Stop(cancellationToken);
await base.StopAsync(cancellationToken);
@ -36,16 +39,16 @@ public abstract class AsyncPeriodicBackgroundWorkerBase : BackgroundWorkerBase
private async Task Timer_Elapsed(AbpAsyncTimer timer)
{
await DoWorkAsync();
await DoWorkAsync(StartCancellationToken);
}
private async Task DoWorkAsync()
private async Task DoWorkAsync(CancellationToken cancellationToken = default)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
try
{
await DoWorkAsync(new PeriodicBackgroundWorkerContext(scope.ServiceProvider));
await DoWorkAsync(new PeriodicBackgroundWorkerContext(scope.ServiceProvider, cancellationToken));
}
catch (Exception ex)
{

4
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs

@ -26,13 +26,13 @@ public class BackgroundWorkerManager : IBackgroundWorkerManager, ISingletonDepen
_backgroundWorkers = new List<IBackgroundWorker>();
}
public virtual async Task AddAsync(IBackgroundWorker worker)
public virtual async Task AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken = default)
{
_backgroundWorkers.Add(worker);
if (IsRunning)
{
await worker.StartAsync();
await worker.StartAsync(cancellationToken);
}
}

11
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkersApplicationInitializationContextExtensions.cs

@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;
@ -7,17 +8,17 @@ namespace Volo.Abp.BackgroundWorkers;
public static class BackgroundWorkersApplicationInitializationContextExtensions
{
public async static Task<ApplicationInitializationContext> AddBackgroundWorkerAsync<TWorker>([NotNull] this ApplicationInitializationContext context)
public async static Task<ApplicationInitializationContext> AddBackgroundWorkerAsync<TWorker>([NotNull] this ApplicationInitializationContext context, CancellationToken cancellationToken = default)
where TWorker : IBackgroundWorker
{
Check.NotNull(context, nameof(context));
await context.AddBackgroundWorkerAsync(typeof(TWorker));
await context.AddBackgroundWorkerAsync(typeof(TWorker), cancellationToken: cancellationToken);
return context;
}
public async static Task<ApplicationInitializationContext> AddBackgroundWorkerAsync([NotNull] this ApplicationInitializationContext context, [NotNull] Type workerType)
public async static Task<ApplicationInitializationContext> AddBackgroundWorkerAsync([NotNull] this ApplicationInitializationContext context, [NotNull] Type workerType, CancellationToken cancellationToken = default)
{
Check.NotNull(context, nameof(context));
Check.NotNull(workerType, nameof(workerType));
@ -29,9 +30,7 @@ public static class BackgroundWorkersApplicationInitializationContextExtensions
await context.ServiceProvider
.GetRequiredService<IBackgroundWorkerManager>()
.AddAsync(
(IBackgroundWorker)context.ServiceProvider.GetRequiredService(workerType)
);
.AddAsync((IBackgroundWorker)context.ServiceProvider.GetRequiredService(workerType), cancellationToken);
return context;
}

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

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Threading;
namespace Volo.Abp.BackgroundWorkers;
@ -14,5 +15,6 @@ public interface IBackgroundWorkerManager : IRunnable
/// <param name="worker">
/// The worker. It should be resolved from IOC.
/// </param>
Task AddAsync(IBackgroundWorker worker);
/// <param name="cancellationToken"></param>
Task AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken = default);
}

10
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerContext.cs

@ -1,4 +1,5 @@
using System;
using System.Threading;
namespace Volo.Abp.BackgroundWorkers;
@ -6,8 +7,17 @@ public class PeriodicBackgroundWorkerContext
{
public IServiceProvider ServiceProvider { get; }
public CancellationToken CancellationToken { get; }
public PeriodicBackgroundWorkerContext(IServiceProvider serviceProvider)
{
ServiceProvider = serviceProvider;
CancellationToken = default;
}
public PeriodicBackgroundWorkerContext(IServiceProvider serviceProvider, CancellationToken cancellationToken)
{
ServiceProvider = serviceProvider;
CancellationToken = cancellationToken;
}
}

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

@ -64,6 +64,7 @@ public class AbpCliCoreModule : AbpModule
options.Commands[CreateMigrationAndRunMigratorCommand.Name] = typeof(CreateMigrationAndRunMigratorCommand);
options.Commands[InstallLibsCommand.Name] = typeof(InstallLibsCommand);
options.Commands[CleanCommand.Name] = typeof(CleanCommand);
options.Commands[CliCommand.Name] = typeof(CliCommand);
});
Configure<AbpCliServiceProxyOptions>(options =>

172
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CliCommand.cs

@ -0,0 +1,172 @@
using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Commands.Services;
using Volo.Abp.Cli.NuGet;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Cli.Commands;
public class CliCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "cli";
private const string CliPackageName = "Volo.Abp.Cli";
private readonly ICmdHelper _cmdHelper;
private readonly NuGetService _nuGetService;
private readonly AbpNuGetIndexUrlService _nuGetIndexUrlService;
public ILogger<CliCommand> Logger { get; set; }
public CliCommand(ICmdHelper cmdHelper, NuGetService nuGetService, AbpNuGetIndexUrlService nuGetIndexUrlService)
{
_cmdHelper = cmdHelper;
_nuGetService = nuGetService;
_nuGetIndexUrlService = nuGetIndexUrlService;
Logger = NullLogger<CliCommand>.Instance;
}
public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
{
var operationType = NamespaceHelper.NormalizeNamespace(commandLineArgs.Target);
var preview = commandLineArgs.Options.ContainsKey(Options.Preview.Short) ||
commandLineArgs.Options.ContainsKey(Options.Preview.Long);
var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);
switch (operationType)
{
case "":
case null:
_cmdHelper.RunCmd("abp");
break;
case "update":
await UpdateCliAsync(version, preview);
break;
case "remove":
RemoveCli();
break;
}
}
private async Task UpdateCliAsync(string version = null, bool preview = false)
{
var infoText = "Updating ABP CLI ";
if (version != null)
{
infoText += "to the " + version + "... ";
}
else if (preview)
{
infoText += "to the latest preview version...";
}
else
{
infoText += "...";
}
Logger.LogInformation(infoText);
try
{
var versionOption = string.Empty;
if (preview)
{
var latestPreviewVersion = await GetLatestPreviewVersion();
if (latestPreviewVersion != null)
{
versionOption = $" --version {latestPreviewVersion}";
Logger.LogInformation("Latest preview version is " + latestPreviewVersion);
}
}
else if (version != null)
{
versionOption = $" --version {version}";
}
_cmdHelper.RunCmdAndExit($"dotnet tool update {CliPackageName}{versionOption} -g", delaySeconds: 2);
}
catch (Exception ex)
{
Logger.LogError("Couldn't update ABP CLI." + ex.Message);
ShowCliManualUpdateCommand();
}
}
private async Task<string> GetLatestPreviewVersion()
{
var latestPreviewVersion = await _nuGetService
.GetLatestVersionOrNullAsync(
packageId: CliPackageName,
includeReleaseCandidates: true
);
return latestPreviewVersion.IsPrerelease ? latestPreviewVersion.ToString() : null;
}
private void ShowCliManualUpdateCommand()
{
Logger.LogError("You can also run the following command to update ABP CLI.");
Logger.LogError("dotnet tool update -g Volo.Abp.Cli");
}
private void RemoveCli()
{
Logger.LogInformation("Removing CLI...");
_cmdHelper.RunCmdAndExit("dotnet tool uninstall " + CliPackageName + " -g", delaySeconds: 2);
}
public string GetUsageInfo()
{
var sb = new StringBuilder();
sb.AppendLine("");
sb.AppendLine("Usage:");
sb.AppendLine("");
sb.AppendLine(" abp cli [options]");
sb.AppendLine("");
sb.AppendLine("Options:");
sb.AppendLine("");
sb.AppendLine("update (update ABP CLI to the latest)");
sb.AppendLine("remove (uninstall ABP CLI)");
sb.AppendLine("");
sb.AppendLine("Examples:");
sb.AppendLine("");
sb.AppendLine(" abp cli update");
sb.AppendLine(" abp cli update --preview");
sb.AppendLine(" abp cli update --version 4.2.2");
sb.AppendLine(" abp cli remove");
sb.AppendLine("");
return sb.ToString();
}
public string GetShortDescription()
{
return "Update or remove ABP CLI. See https://docs.abp.io/en/abp/latest/CLI";
}
public static class Options
{
public static class Preview
{
public const string Long = "preview";
public const string Short = "p";
}
public static class Version
{
public const string Long = "version";
public const string Short = "v";
}
}
}

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

@ -1,4 +1,5 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Volo.Abp.DependencyInjection;
@ -125,15 +126,31 @@ public class CmdHelper : ICmdHelper, ITransientDependency
return output.Trim();
}
public string GetArguments(string command)
public void RunCmdAndExit(string command, string workingDirectory = null, int? delaySeconds = null)
{
var procStartInfo = new ProcessStartInfo(
GetFileName(),
GetArguments(command, delaySeconds)
);
if (!string.IsNullOrEmpty(workingDirectory))
{
procStartInfo.WorkingDirectory = workingDirectory;
}
Process.Start(procStartInfo);
Environment.Exit(0);
}
public string GetArguments(string command, int? delaySeconds = null)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "-c \"" + command + "\"";
return delaySeconds == null ? "-c \"" + command + "\"" : "-c \"" + $"sleep {delaySeconds}s > /dev/null && " + command + "\"";
}
//Windows default.
return "/C \"" + command + "\"";
return delaySeconds == null ? "/C \"" + command + "\"" : "/C \"" + $"timeout /nobreak /t {delaySeconds} >null && " + command + "\"";
}
public string GetFileName()

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

@ -8,20 +8,22 @@ public interface ICmdHelper
void Run(string file, string arguments);
string GetArguments(string command);
string GetArguments(string command, int? delaySeconds = null);
string GetFileName();
void RunCmd(string command, string workingDirectory = null);
Process RunCmdAndGetProcess(string command, string workingDirectory = null);
void RunCmd(string command, out int exitCode, string workingDirectory = null);
string RunCmdAndGetOutput(string command, string workingDirectory = null);
string RunCmdAndGetOutput(string command, out bool isExitCodeSuccessful, string workingDirectory = null);
string RunCmdAndGetOutput(string command, out int exitCode, string workingDirectory = null);
void RunCmdAndExit(string command, string workingDirectory = null, int? delaySeconds = null);
}

17
framework/src/Volo.Abp.Core/System/Linq/AbpQueryableExtensions.cs

@ -95,4 +95,21 @@ public static class AbpQueryableExtensions
? (TQueryable)query.Where(predicate)
: query;
}
/// <summary>
/// Order a <see cref="IQueryable{T}"/> by given predicate if given condition is true.
/// </summary>
/// <param name="query">Queryable to apply filtering</param>
/// <param name="condition">A boolean value</param>
/// <param name="sorting">Order the query</param>
/// <returns>Order or not order query based on <paramref name="condition"/></returns>
public static TQueryable OrderByIf<T, TQueryable>([NotNull] this TQueryable query, bool condition, string sorting)
where TQueryable : IQueryable<T>
{
Check.NotNull(query, nameof(query));
return condition
? (TQueryable)Dynamic.Core.DynamicQueryableExtensions.OrderBy(query, sorting)
: query;
}
}

26
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/CachedServiceProvider.cs

@ -4,27 +4,13 @@ using System.Collections.Generic;
namespace Volo.Abp.DependencyInjection;
[ExposeServices(typeof(ICachedServiceProvider))]
public class CachedServiceProvider : ICachedServiceProvider, IScopedDependency
public class CachedServiceProvider :
CachedServiceProviderBase,
ICachedServiceProvider,
IScopedDependency
{
protected IServiceProvider ServiceProvider { get; }
protected IDictionary<Type, object> CachedServices { get; }
public CachedServiceProvider(IServiceProvider serviceProvider)
: base(serviceProvider)
{
ServiceProvider = serviceProvider;
CachedServices = new Dictionary<Type, object>
{
{typeof(IServiceProvider), serviceProvider}
};
}
public object GetService(Type serviceType)
{
return CachedServices.GetOrAdd(
serviceType,
() => ServiceProvider.GetService(serviceType)
);
}
}
}

25
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/CachedServiceProviderBase.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Concurrent;
namespace Volo.Abp.DependencyInjection;
public abstract class CachedServiceProviderBase
{
private readonly IServiceProvider _serviceProvider;
private readonly ConcurrentDictionary<Type, Lazy<object>> _cachedServices;
protected CachedServiceProviderBase(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
_cachedServices = new ConcurrentDictionary<Type, Lazy<object>>();
_cachedServices.TryAdd(typeof(IServiceProvider), new Lazy<object>(() => this));
}
public object GetService(Type serviceType)
{
return _cachedServices.GetOrAdd(
serviceType,
_ => new Lazy<object>(() => _serviceProvider.GetService(serviceType))
).Value;
}
}

2
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ICachedServiceProvider.cs

@ -11,4 +11,4 @@ namespace Volo.Abp.DependencyInjection;
public interface ICachedServiceProvider : IServiceProvider
{
}
}

14
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ITransientCachedServiceProvider.cs

@ -0,0 +1,14 @@
using System;
namespace Volo.Abp.DependencyInjection;
/// <summary>
/// Provides services by caching the resolved services.
/// It caches all type of services including transients.
/// This service's lifetime is transient.
/// <see cref="ICachedServiceProvider"/> for the one with scoped lifetime.
/// </summary>
public interface ITransientCachedServiceProvider : IServiceProvider
{
}

15
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/TransientCachedServiceProvider.cs

@ -0,0 +1,15 @@
using System;
namespace Volo.Abp.DependencyInjection;
[ExposeServices(typeof(ITransientCachedServiceProvider))]
public class TransientCachedServiceProvider :
CachedServiceProviderBase,
ITransientCachedServiceProvider,
ITransientDependency
{
public TransientCachedServiceProvider(IServiceProvider serviceProvider)
: base(serviceProvider)
{
}
}

12
framework/src/Volo.Abp.Core/Volo/Abp/IAsyncInitialize.cs

@ -1,12 +0,0 @@
using System.Threading.Tasks;
namespace Volo.Abp;
/// <summary>
/// IMPORTANT: THIS IS AN INTERNAL CLASS TO BE USED BY THE ABP FRAMEWORK.
/// IT WILL BE REMOVED IN THE FUTURE VERSIONS. DON'T USE IT!
/// </summary>
public interface IAsyncInitialize //TODO: Remove once we have async module initialization
{
Task InitializeAsync();
}

2
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs

@ -252,7 +252,7 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
: await GetDbSetAsync();
return await queryable
.OrderBy(sorting)
.OrderByIf<TEntity, IQueryable<TEntity>>(!sorting.IsNullOrWhiteSpace(), sorting)
.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}

17
framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Rebus.Bus;
using Rebus.Messages;
using Rebus.Pipeline;
using Rebus.Transport;
using Volo.Abp.DependencyInjection;
@ -154,7 +155,11 @@ public class RebusDistributedEventBus : DistributedEventBusBase, ISingletonDepen
await PublishAsync(eventType, eventData);
}
protected virtual async Task PublishAsync(Type eventType, object eventData)
protected virtual async Task PublishAsync(
Type eventType,
object eventData,
Guid? eventId = null,
Dictionary<string, string> headersArguments = null)
{
if (AbpRebusEventBusOptions.Publish != null)
{
@ -162,7 +167,13 @@ public class RebusDistributedEventBus : DistributedEventBusBase, ISingletonDepen
return;
}
await Rebus.Publish(eventData);
headersArguments ??= new Dictionary<string, string>();
if (!headersArguments.ContainsKey(Headers.MessageId))
{
headersArguments[Headers.MessageId] = (eventId ?? GuidGenerator.Create()).ToString("N");
}
await Rebus.Publish(eventData, headersArguments);
}
protected override void AddToUnitOfWork(IUnitOfWork unitOfWork, UnitOfWorkEventRecord eventRecord)
@ -221,7 +232,7 @@ public class RebusDistributedEventBus : DistributedEventBusBase, ISingletonDepen
var eventType = EventTypes.GetOrDefault(outgoingEvent.EventName);
var eventData = Serializer.Deserialize(outgoingEvent.EventData, eventType);
return PublishToEventBusAsync(eventType, eventData);
return PublishAsync(eventType, eventData, eventId: outgoingEvent.Id);
}
public async override Task PublishManyFromOutboxAsync(IEnumerable<OutgoingEventInfo> outgoingEvents, OutboxConfig outboxConfig)

5
framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@ -102,7 +103,7 @@ public abstract class DistributedEventBusBase : EventBusBase, IDistributedEventB
return false;
}
foreach (var outboxConfig in AbpDistributedEventBusOptions.Outboxes.Values)
foreach (var outboxConfig in AbpDistributedEventBusOptions.Outboxes.Values.OrderBy(x => x.Selector is null))
{
if (outboxConfig.Selector == null || outboxConfig.Selector(eventType))
{
@ -137,7 +138,7 @@ public abstract class DistributedEventBusBase : EventBusBase, IDistributedEventB
using (var scope = ServiceScopeFactory.CreateScope())
{
foreach (var inboxConfig in AbpDistributedEventBusOptions.Inboxes.Values)
foreach (var inboxConfig in AbpDistributedEventBusOptions.Inboxes.Values.OrderBy(x => x.EventSelector is null))
{
if (inboxConfig.EventSelector == null || inboxConfig.EventSelector(eventType))
{

2
framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs

@ -285,7 +285,7 @@ public class MemoryDbRepository<TMemoryDbContext, TEntity> : RepositoryBase<TEnt
CancellationToken cancellationToken = default)
{
return (await GetQueryableAsync())
.OrderBy(sorting)
.OrderByIf<TEntity, IQueryable<TEntity>>(!sorting.IsNullOrWhiteSpace(), sorting)
.PageBy(skipCount, maxResultCount)
.ToList();
}

2
framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

@ -465,7 +465,7 @@ public class MongoDbRepository<TMongoDbContext, TEntity>
cancellationToken = GetCancellationToken(cancellationToken);
return await (await GetMongoQueryableAsync(cancellationToken))
.OrderBy(sorting)
.OrderByIf<TEntity, IQueryable<TEntity>>(!sorting.IsNullOrWhiteSpace(), sorting)
.As<IMongoQueryable<TEntity>>()
.PageBy<TEntity, IMongoQueryable<TEntity>>(skipCount, maxResultCount)
.ToListAsync(cancellationToken);

6
framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/fa.json

@ -1,6 +0,0 @@
{
"culture": "fa",
"texts": {
"Menu:Administration": "مدیریت"
}
}

102
framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/CachedServiceProvider_Tests.cs

@ -0,0 +1,102 @@
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Modularity;
using Volo.Abp.Testing.Utils;
using Xunit;
namespace Volo.Abp.DependencyInjection;
public class CachedServiceProvider_Tests
{
[Fact]
public void CachedServiceProvider_Should_Cache_Services()
{
void TestResolvingServices(IServiceScope scope)
{
var cachedServiceProvider1 = scope.ServiceProvider.GetRequiredService<ICachedServiceProvider>();
var cachedServiceProvider2 = scope.ServiceProvider.GetRequiredService<ICachedServiceProvider>();
cachedServiceProvider1.ShouldBeSameAs(cachedServiceProvider2);
var transientTestService1 = cachedServiceProvider1.GetRequiredService<TransientTestService>();
var transientTestService2 = cachedServiceProvider2.GetRequiredService<TransientTestService>();
transientTestService1.ShouldBeSameAs(transientTestService2);
}
using (var application = AbpApplicationFactory.Create<TestModule>())
{
application.Initialize();
using (var scope1 = application.ServiceProvider.CreateScope())
{
TestResolvingServices(scope1);
var testCounter = scope1.ServiceProvider.GetRequiredService<ITestCounter>();
testCounter.GetValue(nameof(TransientTestService)).ShouldBe(1);
}
using (var scope2 = application.ServiceProvider.CreateScope())
{
TestResolvingServices(scope2);
var testCounter = scope2.ServiceProvider.GetRequiredService<ITestCounter>();
//Resolved in a different scope, so should not cache the service!
testCounter.GetValue(nameof(TransientTestService)).ShouldBe(2);
}
}
}
[Fact]
public void TransientCachedServiceProvider_Should_Cache_Services()
{
void TestResolvingServices(IServiceScope scope)
{
var cachedServiceProvider1 = scope.ServiceProvider.GetRequiredService<ITransientCachedServiceProvider>();
var transientTestService1_1 = cachedServiceProvider1.GetRequiredService<TransientTestService>();
var transientTestService1_2 = cachedServiceProvider1.GetRequiredService<TransientTestService>();
transientTestService1_1.ShouldBeSameAs(transientTestService1_2);
var cachedServiceProvider2 = scope.ServiceProvider.GetRequiredService<ITransientCachedServiceProvider>();
cachedServiceProvider1.ShouldNotBeSameAs(cachedServiceProvider2);
var transientTestService2_1 = cachedServiceProvider2.GetRequiredService<TransientTestService>();
var transientTestService2_2 = cachedServiceProvider2.GetRequiredService<TransientTestService>();
transientTestService2_1.ShouldBeSameAs(transientTestService2_2);
transientTestService1_1.ShouldNotBeSameAs(transientTestService2_1);
}
using (var application = AbpApplicationFactory.Create<TestModule>())
{
application.Initialize();
using (var scope1 = application.ServiceProvider.CreateScope())
{
TestResolvingServices(scope1);
var testCounter = scope1.ServiceProvider.GetRequiredService<ITestCounter>();
testCounter.GetValue(nameof(TransientTestService)).ShouldBe(2);
}
}
}
[DependsOn(typeof(AbpTestBaseModule))]
private class TestModule : AbpModule
{
public TestModule()
{
SkipAutoServiceRegistration = true;
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddType<TransientTestService>();
}
}
private class TransientTestService : ITransientDependency
{
public TransientTestService(ITestCounter counter)
{
counter.Increment(nameof(TransientTestService));
}
}
}

1330
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20220504031950_Add_IsActive_To_BlogUser.Designer.cs

File diff suppressed because it is too large

26
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20220504031950_Add_IsActive_To_BlogUser.cs

@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
public partial class Add_IsActive_To_BlogUser : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "BlgUsers",
type: "bit",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsActive",
table: "BlgUsers");
}
}
}

7
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs

@ -374,7 +374,8 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit");
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
@ -1120,6 +1121,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")

4
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs

@ -16,6 +16,8 @@ namespace Volo.Blogging.Users
public virtual string Surname { get; set; }
public virtual bool IsActive { get; set; }
public virtual bool EmailConfirmed { get; protected set; }
public virtual string PhoneNumber { get; protected set; }
@ -62,6 +64,7 @@ namespace Volo.Blogging.Users
UserName == user.UserName &&
Name == user.Name &&
Surname == user.Surname &&
IsActive == user.IsActive &&
Email == user.Email &&
EmailConfirmed == user.EmailConfirmed &&
PhoneNumber == user.PhoneNumber &&
@ -73,6 +76,7 @@ namespace Volo.Blogging.Users
Email = user.Email;
Name = user.Name;
Surname = user.Surname;
IsActive = user.IsActive;
EmailConfirmed = user.EmailConfirmed;
PhoneNumber = user.PhoneNumber;
PhoneNumberConfirmed = user.PhoneNumberConfirmed;

456
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20210609081519_Initial.cs

@ -1,456 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.CmsKit.Migrations;
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpBlobContainers",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobContainers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsBlogFeatures",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
FeatureName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
IsEnabled = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsBlogFeatures", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsBlogs",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Slug = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsBlogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsComments",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Text = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: false),
RepliedCommentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsComments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsEntityTags",
columns: table => new {
TagId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EntityId = table.Column<string>(type: "nvarchar(450)", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId });
});
migrationBuilder.CreateTable(
name: "CmsMediaDescriptors",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
MimeType = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Size = table.Column<long>(type: "bigint", maxLength: 2147483647, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsMediaDescriptors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsMenus",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsMenus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsPages",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true),
Script = table.Column<string>(type: "nvarchar(max)", nullable: true),
Style = table.Column<string>(type: "nvarchar(max)", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsPages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsRatings",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
StarCount = table.Column<short>(type: "smallint", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsRatings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsTags",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsTags", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsUserReactions",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ReactionName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsUserReactions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsUsers",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpBlobs",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ContainerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Content = table.Column<byte[]>(type: "varbinary(max)", maxLength: 2147483647, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobs", x => x.Id);
table.ForeignKey(
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId",
column: x => x.ContainerId,
principalTable: "AbpBlobContainers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CmsMenuItems",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
Url = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false),
Icon = table.Column<string>(type: "nvarchar(max)", nullable: true),
Order = table.Column<int>(type: "int", nullable: false),
Target = table.Column<string>(type: "nvarchar(max)", nullable: true),
ElementId = table.Column<string>(type: "nvarchar(max)", nullable: true),
CssClass = table.Column<string>(type: "nvarchar(max)", nullable: true),
RequiredPermissionName = table.Column<string>(type: "nvarchar(max)", nullable: true),
PageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsMenuItems", x => x.Id);
table.ForeignKey(
name: "FK_CmsMenuItems_CmsMenus_MenuId",
column: x => x.MenuId,
principalTable: "CmsMenus",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CmsBlogPosts",
columns: table => new {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Title = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
ShortDescription = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true),
CoverImageMediaId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AuthorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsBlogPosts", x => x.Id);
table.ForeignKey(
name: "FK_CmsBlogPosts_CmsUsers_AuthorId",
column: x => x.AuthorId,
principalTable: "CmsUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpBlobContainers_TenantId_Name",
table: "AbpBlobContainers",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_ContainerId",
table: "AbpBlobs",
column: "ContainerId");
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_TenantId_ContainerId_Name",
table: "AbpBlobs",
columns: new[] { "TenantId", "ContainerId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_CmsBlogPosts_AuthorId",
table: "CmsBlogPosts",
column: "AuthorId");
migrationBuilder.CreateIndex(
name: "IX_CmsBlogPosts_Slug_BlogId",
table: "CmsBlogPosts",
columns: new[] { "Slug", "BlogId" });
migrationBuilder.CreateIndex(
name: "IX_CmsComments_TenantId_EntityType_EntityId",
table: "CmsComments",
columns: new[] { "TenantId", "EntityType", "EntityId" });
migrationBuilder.CreateIndex(
name: "IX_CmsComments_TenantId_RepliedCommentId",
table: "CmsComments",
columns: new[] { "TenantId", "RepliedCommentId" });
migrationBuilder.CreateIndex(
name: "IX_CmsEntityTags_TenantId_EntityId_TagId",
table: "CmsEntityTags",
columns: new[] { "TenantId", "EntityId", "TagId" });
migrationBuilder.CreateIndex(
name: "IX_CmsMenuItems_MenuId",
table: "CmsMenuItems",
column: "MenuId");
migrationBuilder.CreateIndex(
name: "IX_CmsPages_TenantId_Slug",
table: "CmsPages",
columns: new[] { "TenantId", "Slug" });
migrationBuilder.CreateIndex(
name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId",
table: "CmsRatings",
columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" });
migrationBuilder.CreateIndex(
name: "IX_CmsTags_TenantId_Name",
table: "CmsTags",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName",
table: "CmsUserReactions",
columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName" });
migrationBuilder.CreateIndex(
name: "IX_CmsUserReactions_TenantId_EntityType_EntityId_ReactionName",
table: "CmsUserReactions",
columns: new[] { "TenantId", "EntityType", "EntityId", "ReactionName" });
migrationBuilder.CreateIndex(
name: "IX_CmsUsers_TenantId_Email",
table: "CmsUsers",
columns: new[] { "TenantId", "Email" });
migrationBuilder.CreateIndex(
name: "IX_CmsUsers_TenantId_UserName",
table: "CmsUsers",
columns: new[] { "TenantId", "UserName" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpBlobs");
migrationBuilder.DropTable(
name: "CmsBlogFeatures");
migrationBuilder.DropTable(
name: "CmsBlogPosts");
migrationBuilder.DropTable(
name: "CmsBlogs");
migrationBuilder.DropTable(
name: "CmsComments");
migrationBuilder.DropTable(
name: "CmsEntityTags");
migrationBuilder.DropTable(
name: "CmsMediaDescriptors");
migrationBuilder.DropTable(
name: "CmsMenuItems");
migrationBuilder.DropTable(
name: "CmsPages");
migrationBuilder.DropTable(
name: "CmsRatings");
migrationBuilder.DropTable(
name: "CmsTags");
migrationBuilder.DropTable(
name: "CmsUserReactions");
migrationBuilder.DropTable(
name: "AbpBlobContainers");
migrationBuilder.DropTable(
name: "CmsUsers");
migrationBuilder.DropTable(
name: "CmsMenus");
}
}

151
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20210609081519_Initial.Designer.cs → modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20220504032110_Initial.Designer.cs

@ -8,10 +8,12 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
using Volo.CmsKit.EntityFrameworkCore;
#nullable disable
namespace Volo.CmsKit.Migrations
{
[DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))]
[Migration("20210609081519_Initial")]
[Migration("20220504032110_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -19,9 +21,10 @@ namespace Volo.CmsKit.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.7")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
@ -61,7 +64,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "ContainerId", "Name");
b.ToTable("AbpBlobs");
b.ToTable("AbpBlobs", (string)null);
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
@ -93,7 +96,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "Name");
b.ToTable("AbpBlobContainers");
b.ToTable("AbpBlobContainers", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b =>
@ -158,7 +161,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.ToTable("CmsBlogs");
b.ToTable("CmsBlogs", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b =>
@ -220,7 +223,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.ToTable("CmsBlogFeatures");
b.ToTable("CmsBlogFeatures", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b =>
@ -291,6 +294,9 @@ namespace Volo.CmsKit.Migrations
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
@ -306,7 +312,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("Slug", "BlogId");
b.ToTable("CmsBlogPosts");
b.ToTable("CmsBlogPosts", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b =>
@ -315,6 +321,12 @@ namespace Volo.CmsKit.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -333,6 +345,10 @@ namespace Volo.CmsKit.Migrations
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<Guid?>("RepliedCommentId")
.HasColumnType("uniqueidentifier");
@ -351,10 +367,10 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "EntityType", "EntityId");
b.ToTable("CmsComments");
b.ToTable("CmsComments", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b =>
modelBuilder.Entity("Volo.CmsKit.GlobalResources.GlobalResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -374,29 +390,10 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
@ -405,30 +402,26 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("MimeType")
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<long>("Size")
.HasMaxLength(2147483647)
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2147483647)
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("CmsMediaDescriptors");
b.ToTable("CmsGlobalResources", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Menus.Menu", b =>
modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -456,6 +449,11 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -474,8 +472,19 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("MimeType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<long>("Size")
.HasMaxLength(2147483647)
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
@ -483,7 +492,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.ToTable("CmsMenus");
b.ToTable("CmsMediaDescriptors", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Menus.MenuItem", b =>
@ -492,6 +501,12 @@ namespace Volo.CmsKit.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -511,6 +526,10 @@ namespace Volo.CmsKit.Migrations
b.Property<string>("ElementId")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Icon")
.HasColumnType("nvarchar(max)");
@ -525,9 +544,6 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MenuId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Order")
.HasColumnType("int");
@ -537,12 +553,13 @@ namespace Volo.CmsKit.Migrations
b.Property<Guid?>("ParentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("RequiredPermissionName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Target")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Url")
.IsRequired()
.HasMaxLength(1024)
@ -550,9 +567,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.HasIndex("MenuId");
b.ToTable("CmsMenuItems");
b.ToTable("CmsMenuItems", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Pages.Page", b =>
@ -629,7 +644,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "Slug");
b.ToTable("CmsPages");
b.ToTable("CmsPages", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b =>
@ -666,7 +681,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId");
b.ToTable("CmsRatings");
b.ToTable("CmsRatings", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b =>
@ -708,7 +723,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName");
b.ToTable("CmsUserReactions");
b.ToTable("CmsUserReactions", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b =>
@ -727,7 +742,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "EntityId", "TagId");
b.ToTable("CmsEntityTags");
b.ToTable("CmsEntityTags", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b =>
@ -794,7 +809,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "Name");
b.ToTable("CmsTags");
b.ToTable("CmsTags", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b =>
@ -825,6 +840,10 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
@ -862,7 +881,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "UserName");
b.ToTable("CmsUsers");
b.ToTable("CmsUsers", (string)null);
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
@ -884,20 +903,6 @@ namespace Volo.CmsKit.Migrations
b.Navigation("Author");
});
modelBuilder.Entity("Volo.CmsKit.Menus.MenuItem", b =>
{
b.HasOne("Volo.CmsKit.Menus.Menu", null)
.WithMany("Items")
.HasForeignKey("MenuId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.CmsKit.Menus.Menu", b =>
{
b.Navigation("Items");
});
#pragma warning restore 612, 618
}
}

466
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20220504032110_Initial.cs

@ -0,0 +1,466 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Volo.CmsKit.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpBlobContainers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobContainers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsBlogFeatures",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
FeatureName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
IsEnabled = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsBlogFeatures", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsBlogs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Slug = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsBlogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsComments",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Text = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: false),
RepliedCommentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsComments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsEntityTags",
columns: table => new
{
TagId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EntityId = table.Column<string>(type: "nvarchar(450)", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId });
});
migrationBuilder.CreateTable(
name: "CmsGlobalResources",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsGlobalResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsMediaDescriptors",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
MimeType = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Size = table.Column<long>(type: "bigint", maxLength: 2147483647, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsMediaDescriptors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsMenuItems",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
Url = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false),
Icon = table.Column<string>(type: "nvarchar(max)", nullable: true),
Order = table.Column<int>(type: "int", nullable: false),
Target = table.Column<string>(type: "nvarchar(max)", nullable: true),
ElementId = table.Column<string>(type: "nvarchar(max)", nullable: true),
CssClass = table.Column<string>(type: "nvarchar(max)", nullable: true),
PageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsMenuItems", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsPages",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true),
Script = table.Column<string>(type: "nvarchar(max)", nullable: true),
Style = table.Column<string>(type: "nvarchar(max)", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsPages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsRatings",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
StarCount = table.Column<short>(type: "smallint", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsRatings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsTags",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsTags", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsUserReactions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ReactionName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsUserReactions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CmsUsers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpBlobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ContainerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Content = table.Column<byte[]>(type: "varbinary(max)", maxLength: 2147483647, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobs", x => x.Id);
table.ForeignKey(
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId",
column: x => x.ContainerId,
principalTable: "AbpBlobContainers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CmsBlogPosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Title = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
ShortDescription = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true),
CoverImageMediaId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AuthorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CmsBlogPosts", x => x.Id);
table.ForeignKey(
name: "FK_CmsBlogPosts_CmsUsers_AuthorId",
column: x => x.AuthorId,
principalTable: "CmsUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpBlobContainers_TenantId_Name",
table: "AbpBlobContainers",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_ContainerId",
table: "AbpBlobs",
column: "ContainerId");
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_TenantId_ContainerId_Name",
table: "AbpBlobs",
columns: new[] { "TenantId", "ContainerId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_CmsBlogPosts_AuthorId",
table: "CmsBlogPosts",
column: "AuthorId");
migrationBuilder.CreateIndex(
name: "IX_CmsBlogPosts_Slug_BlogId",
table: "CmsBlogPosts",
columns: new[] { "Slug", "BlogId" });
migrationBuilder.CreateIndex(
name: "IX_CmsComments_TenantId_EntityType_EntityId",
table: "CmsComments",
columns: new[] { "TenantId", "EntityType", "EntityId" });
migrationBuilder.CreateIndex(
name: "IX_CmsComments_TenantId_RepliedCommentId",
table: "CmsComments",
columns: new[] { "TenantId", "RepliedCommentId" });
migrationBuilder.CreateIndex(
name: "IX_CmsEntityTags_TenantId_EntityId_TagId",
table: "CmsEntityTags",
columns: new[] { "TenantId", "EntityId", "TagId" });
migrationBuilder.CreateIndex(
name: "IX_CmsPages_TenantId_Slug",
table: "CmsPages",
columns: new[] { "TenantId", "Slug" });
migrationBuilder.CreateIndex(
name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId",
table: "CmsRatings",
columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" });
migrationBuilder.CreateIndex(
name: "IX_CmsTags_TenantId_Name",
table: "CmsTags",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName",
table: "CmsUserReactions",
columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName" });
migrationBuilder.CreateIndex(
name: "IX_CmsUserReactions_TenantId_EntityType_EntityId_ReactionName",
table: "CmsUserReactions",
columns: new[] { "TenantId", "EntityType", "EntityId", "ReactionName" });
migrationBuilder.CreateIndex(
name: "IX_CmsUsers_TenantId_Email",
table: "CmsUsers",
columns: new[] { "TenantId", "Email" });
migrationBuilder.CreateIndex(
name: "IX_CmsUsers_TenantId_UserName",
table: "CmsUsers",
columns: new[] { "TenantId", "UserName" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpBlobs");
migrationBuilder.DropTable(
name: "CmsBlogFeatures");
migrationBuilder.DropTable(
name: "CmsBlogPosts");
migrationBuilder.DropTable(
name: "CmsBlogs");
migrationBuilder.DropTable(
name: "CmsComments");
migrationBuilder.DropTable(
name: "CmsEntityTags");
migrationBuilder.DropTable(
name: "CmsGlobalResources");
migrationBuilder.DropTable(
name: "CmsMediaDescriptors");
migrationBuilder.DropTable(
name: "CmsMenuItems");
migrationBuilder.DropTable(
name: "CmsPages");
migrationBuilder.DropTable(
name: "CmsRatings");
migrationBuilder.DropTable(
name: "CmsTags");
migrationBuilder.DropTable(
name: "CmsUserReactions");
migrationBuilder.DropTable(
name: "AbpBlobContainers");
migrationBuilder.DropTable(
name: "CmsUsers");
}
}
}

149
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs

@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
using Volo.CmsKit.EntityFrameworkCore;
#nullable disable
namespace Volo.CmsKit.Migrations
{
[DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))]
@ -17,9 +19,10 @@ namespace Volo.CmsKit.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.7")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
@ -59,7 +62,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "ContainerId", "Name");
b.ToTable("AbpBlobs");
b.ToTable("AbpBlobs", (string)null);
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
@ -91,7 +94,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "Name");
b.ToTable("AbpBlobContainers");
b.ToTable("AbpBlobContainers", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b =>
@ -156,7 +159,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.ToTable("CmsBlogs");
b.ToTable("CmsBlogs", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b =>
@ -218,7 +221,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.ToTable("CmsBlogFeatures");
b.ToTable("CmsBlogFeatures", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b =>
@ -289,6 +292,9 @@ namespace Volo.CmsKit.Migrations
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
@ -304,7 +310,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("Slug", "BlogId");
b.ToTable("CmsBlogPosts");
b.ToTable("CmsBlogPosts", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b =>
@ -313,6 +319,12 @@ namespace Volo.CmsKit.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -331,6 +343,10 @@ namespace Volo.CmsKit.Migrations
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<Guid?>("RepliedCommentId")
.HasColumnType("uniqueidentifier");
@ -349,10 +365,10 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "EntityType", "EntityId");
b.ToTable("CmsComments");
b.ToTable("CmsComments", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b =>
modelBuilder.Entity("Volo.CmsKit.GlobalResources.GlobalResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -372,29 +388,10 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
@ -403,30 +400,26 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("MimeType")
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<long>("Size")
.HasMaxLength(2147483647)
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2147483647)
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("CmsMediaDescriptors");
b.ToTable("CmsGlobalResources", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Menus.Menu", b =>
modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -454,6 +447,11 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -472,8 +470,19 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("MimeType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<long>("Size")
.HasMaxLength(2147483647)
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
@ -481,7 +490,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.ToTable("CmsMenus");
b.ToTable("CmsMediaDescriptors", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Menus.MenuItem", b =>
@ -490,6 +499,12 @@ namespace Volo.CmsKit.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -509,6 +524,10 @@ namespace Volo.CmsKit.Migrations
b.Property<string>("ElementId")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Icon")
.HasColumnType("nvarchar(max)");
@ -523,9 +542,6 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MenuId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Order")
.HasColumnType("int");
@ -535,12 +551,13 @@ namespace Volo.CmsKit.Migrations
b.Property<Guid?>("ParentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("RequiredPermissionName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Target")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("Url")
.IsRequired()
.HasMaxLength(1024)
@ -548,9 +565,7 @@ namespace Volo.CmsKit.Migrations
b.HasKey("Id");
b.HasIndex("MenuId");
b.ToTable("CmsMenuItems");
b.ToTable("CmsMenuItems", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Pages.Page", b =>
@ -627,7 +642,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "Slug");
b.ToTable("CmsPages");
b.ToTable("CmsPages", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b =>
@ -664,7 +679,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId");
b.ToTable("CmsRatings");
b.ToTable("CmsRatings", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b =>
@ -706,7 +721,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName");
b.ToTable("CmsUserReactions");
b.ToTable("CmsUserReactions", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b =>
@ -725,7 +740,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "EntityId", "TagId");
b.ToTable("CmsEntityTags");
b.ToTable("CmsEntityTags", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b =>
@ -792,7 +807,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "Name");
b.ToTable("CmsTags");
b.ToTable("CmsTags", (string)null);
});
modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b =>
@ -823,6 +838,10 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
@ -860,7 +879,7 @@ namespace Volo.CmsKit.Migrations
b.HasIndex("TenantId", "UserName");
b.ToTable("CmsUsers");
b.ToTable("CmsUsers", (string)null);
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
@ -882,20 +901,6 @@ namespace Volo.CmsKit.Migrations
b.Navigation("Author");
});
modelBuilder.Entity("Volo.CmsKit.Menus.MenuItem", b =>
{
b.HasOne("Volo.CmsKit.Menus.Menu", null)
.WithMany("Items")
.HasForeignKey("MenuId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.CmsKit.Menus.Menu", b =>
{
b.Navigation("Items");
});
#pragma warning restore 612, 618
}
}

1861
modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20201013055450_Initial.Designer.cs

File diff suppressed because it is too large

1096
modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20201013055450_Initial.cs

File diff suppressed because it is too large

1322
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220225084616_Initial.Designer.cs → modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20220504032505_Initial.Designer.cs

File diff suppressed because it is too large

1318
modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/20220504032505_Initial.cs

File diff suppressed because it is too large

1404
modules/cms-kit/host/Volo.CmsKit.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs

File diff suppressed because it is too large

26
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220324203918_Added_BlogPostStatus.cs

@ -1,26 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Volo.CmsKit.Migrations
{
public partial class Added_BlogPostStatus : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Status",
table: "CmsBlogPosts",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Status",
table: "CmsBlogPosts");
}
}
}

11
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220324203918_Added_BlogPostStatus.Designer.cs → modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220504032430_Initial.Designer.cs

@ -13,8 +13,8 @@ using Volo.CmsKit.EntityFrameworkCore;
namespace Volo.CmsKit.Migrations
{
[DbContext(typeof(UnifiedDbContext))]
[Migration("20220324203918_Added_BlogPostStatus")]
partial class Added_BlogPostStatus
[Migration("20220504032430_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -671,7 +671,8 @@ namespace Volo.CmsKit.Migrations
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit");
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
@ -1889,6 +1890,10 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")

2
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220225084616_Initial.cs → modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20220504032430_Initial.cs

@ -515,6 +515,7 @@ namespace Volo.CmsKit.Migrations
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
@ -794,6 +795,7 @@ namespace Volo.CmsKit.Migrations
CoverImageMediaId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AuthorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),

7
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs

@ -669,7 +669,8 @@ namespace Volo.CmsKit.Migrations
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit");
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
@ -1887,6 +1888,10 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")

4
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs

@ -49,7 +49,9 @@ public class Page : FullAuditedAggregateRoot<Guid>, IMultiTenant
internal virtual void SetSlug(string slug)
{
Slug = Check.NotNullOrEmpty(slug, nameof(slug), PageConsts.MaxSlugLength);
Slug = SlugNormalizer.Normalize(
Check.NotNullOrEmpty(slug, nameof(slug), PageConsts.MaxSlugLength)
);
}
public virtual void SetContent(string content)

4
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Users/CmsUser.cs

@ -16,6 +16,8 @@ public class CmsUser : AggregateRoot<Guid>, IUser, IUpdateUserData
public virtual string Surname { get; set; }
public virtual bool IsActive { get; set; }
public virtual bool EmailConfirmed { get; protected set; }
public virtual string PhoneNumber { get; protected set; }
@ -62,6 +64,7 @@ public class CmsUser : AggregateRoot<Guid>, IUser, IUpdateUserData
UserName == user.UserName &&
Name == user.Name &&
Surname == user.Surname &&
IsActive == user.IsActive &&
Email == user.Email &&
EmailConfirmed == user.EmailConfirmed &&
PhoneNumber == user.PhoneNumber &&
@ -73,6 +76,7 @@ public class CmsUser : AggregateRoot<Guid>, IUser, IUpdateUserData
Email = user.Email;
Name = user.Name;
Surname = user.Surname;
IsActive = user.IsActive;
EmailConfirmed = user.EmailConfirmed;
PhoneNumber = user.PhoneNumber;
PhoneNumberConfirmed = user.PhoneNumberConfirmed;

2
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs

@ -67,7 +67,7 @@ public class EfCoreCommentRepository : EfCoreRepository<ICmsKitDbContext, Commen
creationEndDate,
token);
if (sorting != null)
if (!sorting.IsNullOrEmpty())
{
sorting = "comment." + sorting;
}

2
modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.abppkg.analyze.json

@ -1,6 +1,6 @@
{
"name": "Volo.Abp.Identity.Domain",
"hash": "ecd9006876d38113d0967e866c30d6ac",
"hash": "51a7170cfa7f0a3ede0888bd0efa1588",
"contents": [
{
"namespace": "Volo.Abp.Identity",

7
modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeCache.cs

@ -63,7 +63,12 @@ public class AbpOpenIddictScopeCacheAbpOpenIddictAuthorizationCache : AbpOpenIdd
public virtual async IAsyncEnumerable<OpenIddictScopeModel> FindByNamesAsync(ImmutableArray<string> names, [EnumeratorCancellation] CancellationToken cancellationToken)
{
Check.NotNullOrEmpty(names, nameof(names));
Check.NotNull(names, nameof(names));
foreach (var name in names)
{
Check.NotNullOrEmpty(name, nameof(name));
}
// Note: this method is only partially cached.
await foreach (var scope in Store.FindByNamesAsync(names, cancellationToken))

7
modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/AbpOpenIddictScopeStore.cs

@ -39,7 +39,7 @@ public class AbpOpenIddictScopeStore : AbpOpenIddictStoreBase<IOpenIddictScopeRe
Check.NotNull(scope, nameof(scope));
await Repository.InsertAsync(scope.ToEntity(), autoSave: true, cancellationToken: cancellationToken);
scope = (await Repository.FindAsync(scope.Id, cancellationToken: cancellationToken)).ToModel();
}
@ -66,7 +66,8 @@ public class AbpOpenIddictScopeStore : AbpOpenIddictStoreBase<IOpenIddictScopeRe
public virtual async IAsyncEnumerable<OpenIddictScopeModel> FindByNamesAsync(ImmutableArray<string> names, [EnumeratorCancellation] CancellationToken cancellationToken)
{
Check.NotNullOrEmpty(names, nameof(names));
Check.NotNull(names, nameof(names));
foreach (var name in names)
{
Check.NotNullOrEmpty(name, nameof(name));
@ -384,7 +385,7 @@ public class AbpOpenIddictScopeStore : AbpOpenIddictStoreBase<IOpenIddictScopeRe
var entity = await Repository.GetAsync(scope.Id, cancellationToken: cancellationToken);
await Repository.UpdateAsync(scope.ToEntity(entity), autoSave: true, cancellationToken: cancellationToken);
scope = (await Repository.FindAsync(entity.Id, cancellationToken: cancellationToken)).ToModel();
}
}

2
modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs

@ -15,6 +15,8 @@ public interface IUserData
string Surname { get; }
bool IsActive { get; }
[CanBeNull]
string Email { get; }

7
modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs

@ -15,6 +15,8 @@ public class UserData : IUserData
public string Surname { get; set; }
public bool IsActive { get; set; }
public string Email { get; set; }
public bool EmailConfirmed { get; set; }
@ -35,6 +37,7 @@ public class UserData : IUserData
Email = userData.Email;
Name = userData.Name;
Surname = userData.Surname;
IsActive = userData.IsActive;
EmailConfirmed = userData.EmailConfirmed;
PhoneNumber = userData.PhoneNumber;
PhoneNumberConfirmed = userData.PhoneNumberConfirmed;
@ -50,13 +53,15 @@ public class UserData : IUserData
bool emailConfirmed = false,
[CanBeNull] string phoneNumber = null,
bool phoneNumberConfirmed = false,
Guid? tenantId = null)
Guid? tenantId = null,
bool isActive = true)
{
Id = id;
UserName = userName;
Email = email;
Name = name;
Surname = surname;
IsActive = isActive;
EmailConfirmed = emailConfirmed;
PhoneNumber = phoneNumber;
PhoneNumberConfirmed = phoneNumberConfirmed;

2
modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserEto.cs

@ -17,6 +17,8 @@ public class UserEto : IUserData, IHasExtraProperties
public string Surname { get; set; }
public bool IsActive { get; set; }
public string Email { get; set; }
public bool EmailConfirmed { get; set; }

1
modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs

@ -10,6 +10,7 @@ public static class AbpUserExtensions
email: user.Email,
name: user.Name,
surname: user.Surname,
isActive: user.IsActive,
emailConfirmed: user.EmailConfirmed,
phoneNumber: user.PhoneNumber,
phoneNumberConfirmed: user.PhoneNumberConfirmed,

2
modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs

@ -18,6 +18,8 @@ public interface IUser : IAggregateRoot<Guid>, IMultiTenant
[CanBeNull]
string Surname { get; }
bool IsActive { get; }
bool EmailConfirmed { get; }
[CanBeNull]

1
modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/AbpUsersDbContextModelCreatingExtensions.cs

@ -16,5 +16,6 @@ public static class AbpUsersDbContextModelCreatingExtensions
b.Property(u => u.EmailConfirmed).HasDefaultValue(false).HasColumnName(nameof(IUser.EmailConfirmed));
b.Property(u => u.PhoneNumber).HasMaxLength(AbpUserConsts.MaxPhoneNumberLength).HasColumnName(nameof(IUser.PhoneNumber));
b.Property(u => u.PhoneNumberConfirmed).HasDefaultValue(false).HasColumnName(nameof(IUser.PhoneNumberConfirmed));
b.Property(u => u.IsActive).HasColumnName(nameof(IUser.IsActive));
}
}

3
npm/ng-packs/.gitignore

@ -44,6 +44,9 @@ npm-debug.log
yarn-error.log
testem.log
/typings
yarn.lock
package-lock.json
# System Files
.DS_Store

2
npm/ng-packs/package.json

@ -71,7 +71,7 @@
"@fortawesome/fontawesome-free": "^5.15.4",
"@ng-bootstrap/ng-bootstrap": "~12.0.0-beta.4",
"@ngneat/spectator": "^10.0.0",
"@ngx-validate/core": "^0.1.1",
"@ngx-validate/core": "^0.1.2",
"@nrwl/angular": "13.10.3",
"@nrwl/cli": "13.10.3",
"@nrwl/cypress": "13.10.3",

2
npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts

@ -28,7 +28,7 @@ export class FormSubmitDirective implements OnInit {
notValidateOnSubmit: string | boolean;
@Input()
markAsDirtyWhenSubmit = true
markAsDirtyWhenSubmit = true;
@Output() readonly ngSubmit = new EventEmitter();

2
npm/ng-packs/packages/theme-shared/package.json

@ -10,7 +10,7 @@
"@abp/ng.core": "~5.3.0-rc.3",
"@fortawesome/fontawesome-free": "^5.15.4",
"@ng-bootstrap/ng-bootstrap": "~12.0.0-beta.4",
"@ngx-validate/core": "^0.1.1",
"@ngx-validate/core": "^0.1.2",
"@popperjs/core": "~2.11.2",
"@swimlane/ngx-datatable": "^19.0.0",
"bootstrap": "^5.1.1",

13805
npm/ng-packs/yarn.lock

File diff suppressed because it is too large

2
templates/app-nolayers/aspnet-core/README.md

@ -4,7 +4,7 @@ This is a minimalist, non-layered startup solution with the ABP Framework. All t
## How to run
The application needs to a database. Run the following command in the `MyCompanyName.MyProjectName` directory:
The application needs to connect to a database. Run the following command in the `MyCompanyName.MyProjectName` directory:
````bash
dotnet run --migrate-database

6
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/index.html

@ -33,7 +33,11 @@
<!--/ABP:Scripts-->
<!-- <TEMPLATE-REMOVE IF-NOT='PWA'> -->
<script>navigator.serviceWorker.register('service-worker.js');</script>
<script>
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js');
}
</script>
<!-- </TEMPLATE-REMOVE> -->
</body>
</html>

7
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20220520081238_Initial.Designer.cs → templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20220606082402_Initial.Designer.cs

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace MyCompanyName.MyProjectName.Migrations
{
[DbContext(typeof(MyProjectNameDbContext))]
[Migration("20220520081238_Initial")]
[Migration("20220606082402_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,7 +21,7 @@ namespace MyCompanyName.MyProjectName.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("ProductVersion", "6.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
@ -651,7 +651,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit");
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()

0
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20220520081238_Initial.cs → templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20220606082402_Initial.cs

5
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs

@ -19,7 +19,7 @@ namespace MyCompanyName.MyProjectName.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("ProductVersion", "6.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
@ -649,7 +649,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit");
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()

3
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs

@ -596,7 +596,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("bit");
.HasColumnType("bit")
.HasColumnName("IsActive");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()

Loading…
Cancel
Save