diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..247193db89 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ +# Contributor Covenant Code of Conduct + +## Preamble + +The ABP Framework was created to implement common generic web application features in a common code base. This approach helps developers to decouple line of business application features from their custom business logic. Besides, the ABP Framework helps create MVPs and kick-start your project as quickly as possible. All the contributors try to save valuable time by automating repetitive tasks at the framework level. This code of conduct has been adopted by many [other open source communities](http://contributor-covenant.org/adopters/) and we feel it expresses our values well. + + + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + + + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals but for the overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others’ private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + + + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct and will communicate reasons for moderation decisions when appropriate. + + + +## Scope + +This Code of Conduct applies within all community spaces and when an individual officially represents the community in public spaces. Examples of representing our community include: + +- Using an official e-mail address. +- Posting via an official social media account. +- Acting as an appointed representative at an online or offline event. + + + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [info@abp.io](mailto:info@abp.io). All complaints will be reviewed and investigated promptly and fairly. All community leaders must to respect the privacy and security of the reporter of any incident. + + + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact:** A violation through a single incident or series of actions. + +**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period. This includes avoiding interactions in community spaces and external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact:** A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence:** A temporary ban from any interaction or public communication with the community for a specified period. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence:** A permanent ban from any sort of public interaction within the community. + + + +## Attribution + +This document is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. +Community Impact Guidelines were inspired by [Mozilla’s code of conduct enforcement ladder](https://github.com/mozilla/diversity). +For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. +Translations are available at https://www.contributor-covenant.org/translations. diff --git a/README.md b/README.md index b588e0cba4..f1f941f794 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ [![NuGet (with prereleases)](https://img.shields.io/nuget/vpre/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) [![MyGet (nightly builds)](https://img.shields.io/myget/abp-nightly/vpre/Volo.Abp.svg?style=flat-square)](https://docs.abp.io/en/abp/latest/Nightly-Builds) [![NuGet Download](https://img.shields.io/nuget/dt/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) - +[![Code of Conduct](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](https://github.com/abpframework/abp/blob/dev/CODE_OF_CONDUCT.md) +[![CLA Signed](https://cla-assistant.io/readme/badge/abpframework/abp)](https://cla-assistant.io/abpframework/abp) [![ABP Discord server](https://img.shields.io/discord/951497912645476422?label=Discord)](https://discord.gg/abp) ABP Framework is a complete **infrastructure** based on **ASP.NET Core** to create **modern web applications** and **APIs** by following the software development **best practices** and the **latest technologies**. Check out https://abp.io diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index c6521a6c56..9efe75ad7e 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -539,6 +539,8 @@ "Pricing_Page_Testimonial_5": "ABP Framework is not only a framework, but it is also a guide for project development/management, because it provides DDD, GenericRepository, DI, Microservice, and Modularity training. Even if you are not going to use the framework itself, you can develop yourself with docs.abp.io which is well and professionally prepared (OpenIddict, Redis, Quartz etc.). Because many things are pre-built, it shortens project development time significantly (Such as login page, exception handling, data filtering, seeding, audit logging, localization, auto API controller etc.). As an example from our application, I have used Local Event Bus for stock control. So, I am able to manage order movements by writing stock handler. It is wonderful not to lose time for CreationTime, CreatorId. They are being filled automatically.", "Pricing_Page_Testimonial_6": "ABP Framework is a good framework but it needs time to understand the different layers, classes, and libraries it used (specially ABP). I spent a lot of time reading the code base, but ABP Commercial save us time to create the project specialty entities (AR) and the repository linked to each of them. I liked also the approach used in ABP is very mature, we know is based on DDD and monolith.", "Pricing_Page_Testimonial_7": "As a startup we need to iterate quickly and spend minimal time on boilerplate and non-core features.\nOur engineers range from highly experienced to junior engineers, we needed a common understanding and a way to share technical and domain knowledge, ABP allowed us to do this due to their great guides and documentation. \nThere are things we haven't had to worry about since they work out of the box with ABP. \nABP helped us streamline rapid prototyping and development, less than 4 weeks from feature inception to production. With all its premium features included in the license, ABP has given us, \"Startup in a Box\" on the Software Engineering Side.", + "Pricing_Page_Testimonial_8": "I would recommend ABP commercial to all those who want to expand the range of products available to their customers. It's fantastic when need to use a distributed enterprise enviroment (Angualr, WPF, Win&Linux). In addition to their products, we love their support, which makes our job faster and easier. We already know that we have found a great partner for the future who will support us in expanding our business.", + "Pricing_Page_Testimonial_9": "We are a company of 2 employees that's been in business for over 20 years.\nIn terms of our experience with ABP Commercial, we were approached by a client who requested that we develop a new human resources application in a modern environment to replace their 25-year-old Access application. We decided to transition from a desktop solution to a web-based one.\n\nAt the time, we had very little knowledge of web applications and .NET but we stumbled upon ABP Commercial, and with the help of ABP Framework, technical documentation, and ABP Suite, we were able to not only develop the application to the client's specifications but also successfully work within a .NET environment within a year.", "AbpBookDownloadArea_ClaimYourEBook": "Claim your Mastering ABP Framework E-Book", "AddMemberModal_Warning_1": "If the username you are trying to add doesn't exist in the system, please ask your team member to register on {0} and share the username of his/her account with you.", "MyOrganizations_Detail_WelcomeMessage": "Welcome to your organization, {0}", @@ -832,6 +834,13 @@ "Volo.AbpIo.Commercial:040001": "API Access Key is incorrect.", "GetLepton": "Get Lepton Now", "MyOrganizations_Detail_LicenseStartDate": "License Start Date", - "MyOrganizations_Detail_LicenseExpiryDate": "Expiry Date" + "MyOrganizations_Detail_LicenseExpiryDate": "Expiry Date", + "BlazoriseSupport": "How do I get the Blazorise license key and support from the Blazorise team?", + "BlazoriseSupportExplanation": "Follow the steps below to get support from the Blazorise team and get your Blazorise license key:", + "BlazoriseSupportExplanation1": "Sign up for a new account at blazorise.com/support/register with the same email address as your abp.io account. Leave the \"License Key\" entry blank. It must be the same email address as your email account on abp.io.", + "BlazoriseSupportExplanation2": "Verify your email address by checking your email box. Check your spam box if you don't see an email in your inbox!", + "BlazoriseSupportExplanation3": "Log into the Blazorise support website at blazorise.com/support/login.", + "BlazoriseSupportExplanation4": "If you have an active ABP Commercial license, you will also have a Blazorise PRO license. You can get your Blazorise license key at blazorise.com/support/user/manage/license.", + "BlazoriseSupportExplanation5": "You can post your questions on the support website and generate a product token for your application." } } diff --git a/docs/en/Community-Articles/2022-11-14-How-to-add-a-custom-grant-type-in-OpenIddict/POST.md b/docs/en/Community-Articles/2022-11-14-How-to-add-a-custom-grant-type-in-OpenIddict/POST.md index 73a0d7589c..0401c31898 100644 --- a/docs/en/Community-Articles/2022-11-14-How-to-add-a-custom-grant-type-in-OpenIddict/POST.md +++ b/docs/en/Community-Articles/2022-11-14-How-to-add-a-custom-grant-type-in-OpenIddict/POST.md @@ -71,7 +71,13 @@ public class MyTokenExtensionGrant : ITokenExtensionGrant var claimsPrincipal = await userClaimsPrincipalFactory.CreateAsync(user); claimsPrincipal.SetScopes(principal.GetScopes()); claimsPrincipal.SetResources(await GetResourcesAsync(context, principal.GetScopes())); + + //abp version < 7.3 await context.HttpContext.RequestServices.GetRequiredService().SetAsync(principal); + + //For abp version >= 7.3 + await context.HttpContext.RequestServices.GetRequiredService().HandleAsync(context.Request, principal); + return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, claimsPrincipal); } diff --git a/docs/en/Getting-Started-React-Native.md b/docs/en/Getting-Started-React-Native.md index df8fb355a5..bc3c7ef419 100644 --- a/docs/en/Getting-Started-React-Native.md +++ b/docs/en/Getting-Started-React-Native.md @@ -1,11 +1,11 @@ # Getting Started with the React Native -````json +```json //[doc-params] { - "Tiered": ["No", "Yes"] + "Tiered": ["No", "Yes"] } -```` +``` ABP platform provide basic [React Native](https://reactnative.dev/) startup template to develop mobile applications **integrated to your ABP based backends**. @@ -20,7 +20,6 @@ Please follow the steps below to prepare your development environment for React 3. **[Optional] Install VS Code:** [VS Code](https://code.visualstudio.com/) is a free, open-source IDE which works seamlessly with TypeScript. Although you can use any IDE including Visual Studio or Rider, VS Code will most likely deliver the best developer experience when it comes to React Native projects. 4. **Install an Emulator:** React Native applications need an Android emulator or an iOS simulator to run on your OS. See the [Android Studio Emulator](https://docs.expo.io/workflow/android-simulator/) or [iOS Simulator](https://docs.expo.io/workflow/ios-simulator/) on expo.io documentation to learn how to set up an emulator. - ## How to Start a New React Native Project You have multiple options to initiate a new React Native project that works with ABP: @@ -56,6 +55,7 @@ Please do the following: > When you are using OpenIddict, You should remove 'clientSecret' on Environment.js (if exists) and disable "HTTPS-only" settings. (Openiddict has default since Version 6.0) ### How to disable Https-only in Openiddict. + You should add this code on {{ if Tiered == "No" }}`MyProjectNameHttpApiHostModule`{{ else if Tiered == "Yes" }}`MyProjectNameAuthServerModule`{{ end }}. ```csharp @@ -79,26 +79,27 @@ A React Native application running on an Android emulator or a physical phone ** {{ if Tiered == "No"}} ![React Native host project local IP entry](images/rn-host-local-ip.png) -* Open the `appsettings.json` in the `.HttpApi.Host` folder. Replace the `localhost` address on the `SelfUrl` and `Authority` properties with your local IP address. -* Open the `launchSettings.json` in the `.HttpApi.Host/Properties` folder. Replace the `localhost` address on the `applicationUrl` properties with your local IP address. +- Open the `appsettings.json` file in the `.HttpApi.Host` folder. Replace the `localhost` address on the `SelfUrl` and `Authority` properties with your local IP address. +- Open the `launchSettings.json` file in the `.HttpApi.Host/Properties` folder. Replace the `localhost` address on the `applicationUrl` properties with your local IP address. {{ else if Tiered == "Yes" }} ![React Native tiered project local IP entry](images/rn-tiered-local-ip.png) -* Open the `appsettings.json` in the `.AuthServer` folder. Replace the `localhost` address on the `SelfUrl` property with your local IP address. -* Open the `launchSettings.json` in the `.AuthServer/Properties` folder. Replace the `localhost` address on the `applicationUrl` properties with your local IP address. -* Open the `appsettings.json` in the `.HttpApi.Host` folder. Replace the `localhost` address on the `Authority` property with your local IP address. -* Open the `launchSettings.json` in the `.HttpApi.Host/Properties` folder. Replace the `localhost` address on the `applicationUrl` properties with your local IP address. +- Open the `appsettings.json` file in the `.AuthServer` folder. Replace the `localhost` address on the `SelfUrl` property with your local IP address. +- Open the `launchSettings.json` file in the `.AuthServer/Properties` folder. Replace the `localhost` address on the `applicationUrl` properties with your local IP address. +- Open the `appsettings.json` file in the `.HttpApi.Host` folder. Replace the `localhost` address on the `Authority` property with your local IP address. +- Open the `launchSettings.json` file in the `.HttpApi.Host/Properties` folder. Replace the `localhost` address on the `applicationUrl` properties with your local IP address. {{ end }} Run the backend application as described in the [getting started document](Getting-Started.md). > You should turn off the "Https Restriction" if you're using OpenIddict as a central identity management solution. Because the IOS Simulator doesn't support self-signed certificates and OpenIddict is set to only work with HTTPS by default. + ## How to disable the Https-only settings of OpenIddict - Go to MyProjectNameHttpApiHostModule.cs under the host project. Add put these codes under the `PreConfigureServices` function. +Go to MyProjectNameHttpApiHostModule.cs under the host project. And put these codes under the `PreConfigureServices` function. ```csharp #if DEBUG @@ -109,7 +110,6 @@ Run the backend application as described in the [getting started document](Getti #endif ``` - ## How to Configure & Run the React Native Application 1. Make sure the [database migration is complete](./Getting-Started?UI=NG&DB=EF&Tiered=No#create-the-database) and the [API is up and running](./Getting-Started?UI=NG&DB=EF&Tiered=No#run-the-application). @@ -128,21 +128,20 @@ Run the backend application as described in the [getting started document](Getti {{ end }} -4. Run `yarn start` or `npm start`. Wait Expo CLI to start. Expo CLI opens the management interface on the `http://localhost:19002/` address. +4. Run `yarn start` or `npm start`. Wait for the Expo CLI to print the opitons. > The React Native application was generated with [Expo](https://expo.io/). Expo is a set of tools built around React Native to help you quickly start an app and, while it has many features. -![expo-interface](images/rn-expo-interface.png) +![expo-cli-options](images/rn-options.png) -In the above management interface, you can start the application with an Android emulator, an iOS simulator or a physical phone by the scan the QR code with the [Expo Client](https://expo.io/tools#client). +In the above image, you can start the application with an Android emulator, an iOS simulator or a physical phone by scanning the QR code with the [Expo Client](https://expo.io/tools#client) or choosing the option. ![React Native login screen on iPhone 11](images/rn-login-iphone.png) -Enter **admin** as the username and **1q2w3E*** as the password to login to the application. +Enter **admin** as the username and **1q2w3E\*** as the password to login to the application. The application is up and running. You can continue to develop your application based on this startup template. - ## See Also -* [React Native project structure](./Startup-Templates/Application#react-native) +- [React Native project structure](./Startup-Templates/Application#react-native) diff --git a/docs/en/Modules/OpenIddict.md b/docs/en/Modules/OpenIddict.md index 74598ab1f8..db13d4b452 100644 --- a/docs/en/Modules/OpenIddict.md +++ b/docs/en/Modules/OpenIddict.md @@ -323,16 +323,16 @@ Configure(options => [Claims Principal Factory](https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factory) can be used to add/remove claims to the `ClaimsPrincipal`. -The `AbpDefaultOpenIddictClaimDestinationsProvider` service will add `Name`, `Email,` and `Role` types of Claims to `access_token` and `id_token`, other claims are only added to `access_token` by default, and remove the `SecurityStampClaimType` secret claim of `Identity`. +The `AbpDefaultOpenIddictClaimsPrincipalHandler` service will add `Name`, `Email,` and `Role` types of Claims to `access_token` and `id_token`, other claims are only added to `access_token` by default, and remove the `SecurityStampClaimType` secret claim of `Identity`. -Create a service that inherits from `IAbpOpenIddictClaimDestinationsProvider` and add it to DI to fully control the destinations of claims. +Create a service that inherits from `IAbpOpenIddictClaimsPrincipalHandler` and add it to DI to fully control the destinations of claims. ```cs -public class MyClaimDestinationsProvider : IAbpOpenIddictClaimDestinationsProvider, ITransientDependency +public class MyClaimDestinationsHandler : IAbpOpenIddictClaimsPrincipalHandler, ITransientDependency { - public virtual Task SetDestinationsAsync(AbpOpenIddictClaimDestinationsProviderContext context) + public virtual Task HandleAsync(AbpOpenIddictClaimsPrincipalHandlerContext context) { - foreach (var claim in context.Claims) + foreach (var claim in context.Principal.Claims) { if (claim.Type == MyClaims.MyClaimsType) { @@ -351,7 +351,7 @@ public class MyClaimDestinationsProvider : IAbpOpenIddictClaimDestinationsProvid Configure(options => { - options.ClaimDestinationsProvider.Add(); + options.ClaimsPrincipalHandlers.Add(); }); ``` diff --git a/docs/en/UI/Angular/Card-Component.md b/docs/en/UI/Angular/Card-Component.md index 861171c39e..ca056853ff 100644 --- a/docs/en/UI/Angular/Card-Component.md +++ b/docs/en/UI/Angular/Card-Component.md @@ -29,7 +29,7 @@ ABP Card Component is a part of the `ThemeSharedModule` module. If you've import // my-feature.module.ts import { ThemeSharedModule } from '@abp/ng.theme.shared'; -import { CardDemoComponent } from './chart-demo.component'; +import { CardDemoComponent } from './card-demo.component'; @NgModule({ imports: [ diff --git a/docs/en/UI/Angular/Checkbox-Component.md b/docs/en/UI/Angular/Checkbox-Component.md new file mode 100644 index 0000000000..898f86732c --- /dev/null +++ b/docs/en/UI/Angular/Checkbox-Component.md @@ -0,0 +1,51 @@ +# Checkbox Component + +The ABP Checkbox Component is a reusable form input component for the checkbox type. + +# Inputs + +- `label` +- `labelClass (default form-check-label)` +- `checkboxId` +- `checkboxReadonly` +- `checkboxReadonly (default form-check-input)` +- `checkboxStyle` + +# Outputs + +- `checkboxBlur` +- `checkboxFocus` + +# Usage + +The ABP Checkbox component is a part of the `ThemeSharedModule` module. If you've imported that module into your module, there's no need to import it again. If not, then first import it as shown below: + +```ts +// my-feature.module.ts + +import { ThemeSharedModule } from "@abp/ng.theme.shared"; +import { CheckboxDemoComponent } from "./CheckboxDemoComponent.component"; + +@NgModule({ + imports: [ + ThemeSharedModule, + // ... + ], + declarations: [CheckboxDemoComponent], + // ... +}) +export class MyFeatureModule {} +``` + +Then, the `abp-checkbox` component can be used. See the example below: + +```html +
+ + +
+``` + +See the checkbox input result below: + +![abp-checkbox](./images/form-checkbox.png) diff --git a/docs/en/UI/Angular/FormInput-Component.md b/docs/en/UI/Angular/FormInput-Component.md new file mode 100644 index 0000000000..f1dedd824a --- /dev/null +++ b/docs/en/UI/Angular/FormInput-Component.md @@ -0,0 +1,49 @@ +# Form Input Component + +The ABP FormInput Component is a reusable form input component for the text type. + +# Inputs +* `label` +* `labelClass (default form-label)` +* `inputPlaceholder` +* `inputReadonly` +* `inputClass (default form-control)` + +# Outputs +* `formBlur` +* `formFocus` + +# Usage + +The ABP FormInput component is a part of the `ThemeSharedModule` module. If you've imported that module into your module, there's no need to import it again. If not, then first import it as shown below: + +```ts +import { ThemeSharedModule } from "@abp/ng.theme.shared"; +import { FormInputDemoComponent } from "./FomrInputDemoComponent.component"; + +@NgModule({ + imports: [ + ThemeSharedModule, + // ... + ], + declarations: [FormInputDemoComponent], +}) +export class MyFeatureModule {} +``` + +Then, the `abp-form-input` component can be used. See the example below: + +```html +
+
+ +
+
+``` + +See the form input result below: + +![abp-form-input](./images/form-input.png) diff --git a/docs/en/UI/Angular/images/form-checkbox.png b/docs/en/UI/Angular/images/form-checkbox.png new file mode 100644 index 0000000000..18d064c474 Binary files /dev/null and b/docs/en/UI/Angular/images/form-checkbox.png differ diff --git a/docs/en/UI/Angular/images/form-input.png b/docs/en/UI/Angular/images/form-input.png new file mode 100644 index 0000000000..73c9cfd74c Binary files /dev/null and b/docs/en/UI/Angular/images/form-input.png differ diff --git a/docs/en/images/rn-options.png b/docs/en/images/rn-options.png new file mode 100644 index 0000000000..810dda8183 Binary files /dev/null and b/docs/en/images/rn-options.png differ diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index f98d2dd1a5..1c201237e3 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -437,6 +437,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Compone EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Ldap.Abstractions", "src\Volo.Abp.Ldap.Abstractions\Volo.Abp.Ldap.Abstractions.csproj", "{0F80E95C-41E6-4F23-94FF-FC9D0B8D5D71}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Ddd.Domain.Shared", "src\Volo.Abp.Ddd.Domain.Shared\Volo.Abp.Ddd.Domain.Shared.csproj", "{0858571B-CE73-4AD6-BD06-EC9F0714D8E9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1303,6 +1305,10 @@ Global {0F80E95C-41E6-4F23-94FF-FC9D0B8D5D71}.Debug|Any CPU.Build.0 = Debug|Any CPU {0F80E95C-41E6-4F23-94FF-FC9D0B8D5D71}.Release|Any CPU.ActiveCfg = Release|Any CPU {0F80E95C-41E6-4F23-94FF-FC9D0B8D5D71}.Release|Any CPU.Build.0 = Release|Any CPU + {0858571B-CE73-4AD6-BD06-EC9F0714D8E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0858571B-CE73-4AD6-BD06-EC9F0714D8E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0858571B-CE73-4AD6-BD06-EC9F0714D8E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0858571B-CE73-4AD6-BD06-EC9F0714D8E9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1523,6 +1529,7 @@ Global {E9492F9F-47E0-45A6-A51D-9949FEAA8543} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {8764DFAF-D13D-449A-9A5E-5D7F0B2D7FEF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {0F80E95C-41E6-4F23-94FF-FC9D0B8D5D71} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {0858571B-CE73-4AD6-BD06-EC9F0714D8E9} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyOptions.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyOptions.cs index 3e775d0da2..3ac06350d9 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyOptions.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyOptions.cs @@ -1,14 +1,23 @@ using System; using System.Globalization; using System.Net; +using System.Runtime.ExceptionServices; +using System.Text; using System.Text.Encodings.Web; +using System.Text.Json; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; +using Microsoft.AspNetCore.Http.Json; +using Microsoft.AspNetCore.Internal; +using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Microsoft.Net.Http.Headers; +using Volo.Abp.Http; +using Volo.Abp.Json; using Volo.Abp.MultiTenancy; namespace Volo.Abp.AspNetCore.MultiTenancy; @@ -58,14 +67,70 @@ public class AbpAspNetCoreMultiTenancyOptions } } + context.Response.Headers.Add("Abp-Tenant-Resolve-Error", HtmlEncoder.Default.Encode(exception.Message)); if (isCookieAuthentication && context.Request.Method.Equals("Get", StringComparison.OrdinalIgnoreCase) && !context.Request.IsAjax()) { - context.Response.Headers.Add("Abp-Tenant-Resolve-Error", HtmlEncoder.Default.Encode(exception.Message)); context.Response.Redirect(context.Request.GetEncodedUrl()); } + else if (context.Request.IsAjax()) + { + var error = new RemoteServiceErrorResponse(new RemoteServiceErrorInfo(exception.Message, exception is BusinessException businessException ? businessException.Details : string.Empty)); + + var jsonSerializerOptions = context.RequestServices.GetRequiredService>().Value.SerializerOptions; + + ResponseContentTypeHelper.ResolveContentTypeAndEncoding( + null, + context.Response.ContentType, + (new MediaTypeHeaderValue("application/json") + { + Encoding = Encoding.UTF8 + }.ToString(), Encoding.UTF8), + MediaType.GetEncoding, + out var resolvedContentType, + out var resolvedContentTypeEncoding); + + context.Response.ContentType = resolvedContentType; + context.Response.StatusCode = (int)HttpStatusCode.NotFound; + + var responseStream = context.Response.Body; + if (resolvedContentTypeEncoding.CodePage == Encoding.UTF8.CodePage) + { + try + { + await JsonSerializer.SerializeAsync(responseStream, error, error.GetType(), jsonSerializerOptions, context.RequestAborted); + await responseStream.FlushAsync(context.RequestAborted); + } + catch (OperationCanceledException) when (context.RequestAborted.IsCancellationRequested) { } + } + else + { + var transcodingStream = Encoding.CreateTranscodingStream(context.Response.Body, resolvedContentTypeEncoding, Encoding.UTF8, leaveOpen: true); + ExceptionDispatchInfo exceptionDispatchInfo = null; + try + { + await JsonSerializer.SerializeAsync(transcodingStream, error, error.GetType(), jsonSerializerOptions, context.RequestAborted); + await transcodingStream.FlushAsync(context.RequestAborted); + } + catch (OperationCanceledException) when (context.RequestAborted.IsCancellationRequested) { } + catch (Exception ex) + { + exceptionDispatchInfo = ExceptionDispatchInfo.Capture(ex); + } + finally + { + try + { + await transcodingStream.DisposeAsync(); + } + catch when (exceptionDispatchInfo != null) + { + } + exceptionDispatchInfo?.Throw(); + } + } + } else { - context.Response.Headers.Add("Abp-Tenant-Resolve-Error", HtmlEncoder.Default.Encode(exception.Message)); context.Response.StatusCode = (int)HttpStatusCode.NotFound; context.Response.ContentType = "text/html"; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs index 10923f25af..7f9c34fb7a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs @@ -9,7 +9,7 @@ public abstract class where TTagHelper : AbpDatePickerBaseTagHelper { - private readonly IAbpDatePickerOptions _abpDatePickerOptionsImplementation; + private IAbpDatePickerOptions _abpDatePickerOptionsImplementation; public string Label { get; set; } @@ -47,6 +47,11 @@ public abstract class { _abpDatePickerOptionsImplementation = new AbpDatePickerOptions(); } + + public void SetDatePickerOptions(IAbpDatePickerOptions options) + { + _abpDatePickerOptionsImplementation = options; + } public string PickerId { get => _abpDatePickerOptionsImplementation.PickerId; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs index c1ecc4b32d..6e5f0ad2f7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs @@ -84,6 +84,11 @@ public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelp AddReadOnlyAttribute(TagHelperOutput); AddPlaceholderAttribute(TagHelperOutput); AddInfoTextId(TagHelperOutput); + var optionsAttribute = GetAttributeAndModelExpression(out var modelExpression); + if (optionsAttribute != null) + { + TagHelper.SetDatePickerOptions(optionsAttribute.GetDatePickerOptions(modelExpression.ModelExplorer)); + } // Open and close button var openButtonContent = TagHelper.OpenButton @@ -426,15 +431,6 @@ public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelp attrList.Add(attr); } - var optionsAttribute = GetAttributeAndModelExpression(out var modelExpression); - if (optionsAttribute != null) - { - foreach (var attr in ConvertDatePickerOptionsToAttributeList(optionsAttribute.GetDatePickerOptions(modelExpression.ModelExplorer))) - { - attrList.Add(attr); - } - } - AddBaseTagAttributes(attrList); return attrList; @@ -591,7 +587,7 @@ public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelp abpButtonTagHelper.ButtonType = AbpButtonType.Outline_Secondary; abpButtonTagHelper.Icon = icon; - abpButtonTagHelper.Disabled = TagHelper.IsDisabled; + abpButtonTagHelper.Disabled = TagHelper.IsDisabled || GetAttribute() != null; if (!visible) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs index 1190e1794d..04a8761534 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs @@ -3,14 +3,13 @@ using Microsoft.AspNetCore.Razor.TagHelpers; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Text.Encodings.Web; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; -using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers; @@ -68,7 +67,9 @@ public abstract class AbpTagHelperResourceService : ITransientDependency if (file == null || !file.Exists) { - throw new AbpException($"Could not find the bundle file '{bundleFile}' for the bundle '{bundleName}'!"); + Logger.LogError($"Could not find the bundle file '{bundleFile}' for the bundle '{bundleName}'!"); + AddErrorScript(viewContext, tagHelper, context, output, bundleFile, bundleName); + continue; } if (file.Length > 0) @@ -87,6 +88,11 @@ public abstract class AbpTagHelperResourceService : ITransientDependency protected abstract void AddHtmlTag(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, string file); + protected virtual void AddErrorScript(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, string file, string bundleName) + { + output.Content.AppendHtml($"{Environment.NewLine}"); + } + protected virtual string GenerateBundleName(List bundleItems) { return bundleItems.JoinAsString("|").ToMd5(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js index 27ca6cfd97..6ea753044e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js @@ -643,8 +643,9 @@ var momentEndDate = getMoment(endDate, options); if (momentStartDate.isValid()) { picker.setStartDate(momentStartDate); + picker.setEndDate(momentEndDate); } - if (momentEndDate.isValid()) { + if (momentEndDate.isValid() && !singleDatePicker) { picker.setEndDate(momentEndDate); } }); @@ -766,6 +767,7 @@ abp.dom.initializers.initializeScript(args.$el); abp.dom.initializers.initializeAutocompleteSelects(args.$el.findWithSelf('.auto-complete-select')); abp.dom.initializers.initializeAbpCspStyles($("link[abp-csp-style]")); + abp.dom.initializers.initializeDateRangePickers(args.$el); }); abp.dom.onNodeRemoved(function (args) { @@ -777,6 +779,7 @@ abp.event.on('abp.configurationInitialized', function () { abp.libs.bootstrapDatepicker.normalizeLanguageConfig(); }); + $(function () { abp.dom.initializers.initializeToolTips($('[data-toggle="tooltip"]')); diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Internal/ResponseContentTypeHelper.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Internal/ResponseContentTypeHelper.cs new file mode 100644 index 0000000000..bff1290835 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Internal/ResponseContentTypeHelper.cs @@ -0,0 +1,78 @@ +using System; +using System.Net.Mime; +using System.Text; +using Microsoft.AspNetCore.Http; +using Microsoft.Net.Http.Headers; + +namespace Microsoft.AspNetCore.Internal; + +/// +/// https://github.com/dotnet/aspnetcore/blob/release/7.0/src/Shared/ResponseContentTypeHelper.cs +/// +public static class ResponseContentTypeHelper +{ + /// + /// Gets the content type and encoding that need to be used for the response. + /// The priority for selecting the content type is: + /// 1. ContentType property set on the action result + /// 2. property set on + /// 3. Default content type set on the action result + /// + /// + /// The user supplied content type is not modified and is used as is. For example, if user + /// sets the content type to be "text/plain" without any encoding, then the default content type's + /// encoding is used to write the response and the ContentType header is set to be "text/plain" without any + /// "charset" information. + /// + public static void ResolveContentTypeAndEncoding( + string? actionResultContentType, + string? httpResponseContentType, + (string defaultContentType, Encoding defaultEncoding) @default, + Func getEncoding, + out string resolvedContentType, + out Encoding resolvedContentTypeEncoding) + { + var (defaultContentType, defaultContentTypeEncoding) = @default; + + // 1. User sets the ContentType property on the action result + if (actionResultContentType != null) + { + resolvedContentType = actionResultContentType; + var actionResultEncoding = getEncoding(actionResultContentType); + resolvedContentTypeEncoding = actionResultEncoding ?? defaultContentTypeEncoding; + return; + } + + // 2. User sets the ContentType property on the http response directly + if (!string.IsNullOrEmpty(httpResponseContentType)) + { + var mediaTypeEncoding = getEncoding(httpResponseContentType); + if (mediaTypeEncoding != null) + { + resolvedContentType = httpResponseContentType; + resolvedContentTypeEncoding = mediaTypeEncoding; + } + else + { + resolvedContentType = httpResponseContentType; + resolvedContentTypeEncoding = defaultContentTypeEncoding; + } + + return; + } + + // 3. Fall-back to the default content type + resolvedContentType = defaultContentType; + resolvedContentTypeEncoding = defaultContentTypeEncoding; + } + + public static Encoding GetEncoding(string mediaType) + { + if (MediaTypeHeaderValue.TryParse(mediaType, out var parsed)) + { + return parsed.Encoding; + } + + return default; + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs index 31f209f98e..c303c1196a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs @@ -10,6 +10,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps; public class ChangeThemeStep : ProjectBuildPipelineStep { + private const string Basic = "Basic"; + private const string LeptonXLite = "LeptonXLite"; + private const string LeptonX = "LeptonX"; + private const string Lepton = "Lepton"; + public override void Execute(ProjectBuildContext context) { if (!context.BuildArgs.Theme.HasValue) @@ -28,50 +33,65 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } } - protected void ChangeToBasicTheme(ProjectBuildContext context) + protected virtual void ChangeToBasicTheme(ProjectBuildContext context) { var defaultThemeName = context.BuildArgs.TemplateName is AppTemplate.TemplateName or AppNoLayersTemplate.TemplateName - ? "LeptonXLite" - : "LeptonX"; - - #region MVC Projects + ? LeptonXLite : LeptonX; ChangeThemeToBasicForMvcProjects(context, defaultThemeName); + ChangeThemeToBasicForBlazorProjects(context, defaultThemeName); + ChangeThemeToBasicForBlazorServerProjects(context, defaultThemeName); + ChangeThemeForAngularProjects(context, defaultThemeName, Basic, GetAngularPackageName(context.BuildArgs.Theme!.Value), GetAngularPackageName(Theme.Basic)); + } - #endregion + protected virtual void ChangeToLeptonTheme(ProjectBuildContext context) + { + //common + RenameFolders(context, oldFolderName: LeptonX , newFolderName: Lepton); + AddLeptonThemeManagementReferenceToProjects(context); - #region MyCompanyName.MyProjectName.Blazor + ChangeThemeToLeptonForMvcProjects(context); + ChangeThemeToLeptonForBlazorProjects(context); + ChangeThemeToLeptonForBlazorServerProjects(context); + ChangeThemeForAngularProjects(context, oldThemeName: LeptonX, Lepton, GetAngularPackageName(Theme.LeptonX), GetAngularPackageName(Theme.Lepton)); + ConfigureLeptonManagementPackagesForNoLayersMvc(context, "/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.csproj", new[] { "Web", "HttpApi", "Application" }); + ChangeThemeToLeptonForNoLayersBlazorServerProjects(context); + ChangeThemeToLeptonForMauiBlazorProjects(context); + } + + private static string GetAngularPackageName(Theme theme) + { + return theme switch + { + Theme.LeptonX => "@volosoft/abp.ng.theme.lepton-x", + Theme.LeptonXLite => "@abp/ng.theme.lepton-x", + Theme.Basic => "@abp/ng.theme.basic", + _ => string.Empty + }; + } + + private static void ChangeThemeToBasicForBlazorProjects(ProjectBuildContext context, string defaultThemeName) + { ReplacePackageReferenceWithProjectReference( context, "/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj", $"Volo.Abp.AspNetCore.Components.WebAssembly.{defaultThemeName}Theme", @"..\..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.csproj" - ); - - ChangeNamespaceAndKeyword( - context, - "/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs", - $"Volo.Abp.AspNetCore.Components.WebAssembly.{defaultThemeName}Theme", - "Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme", - $"AbpAspNetCoreComponentsWebAssembly{defaultThemeName}ThemeModule", - "AbpAspNetCoreComponentsWebAssemblyBasicThemeModule" ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs", - $"Volo.Abp.AspNetCore.Components.Web.{defaultThemeName}Theme.Themes.{defaultThemeName}", - "Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic", - $"AbpAspNetCoreComponentsWebAssembly{defaultThemeName}ThemeModule", - "AbpAspNetCoreComponentsWebAssemblyBasicThemeModule" + $"{defaultThemeName}Theme.Components", + "BasicTheme.Themes.Basic" ); - - ChangeNamespace( + + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs", - $"Volo.Abp.AspNetCore.Components.Web.{defaultThemeName}Theme.Components", - "Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic" + defaultThemeName, + Basic ); ReplacePackageReferenceWithProjectReference( @@ -81,209 +101,94 @@ public class ChangeThemeStep : ProjectBuildPipelineStep @"..\..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" ); - ChangeNamespaceAndKeyword( - context, - "/MyCompanyName.MyProjectName.Host/MyProjectNameHostModule.cs", - $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}.Bundling", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling", - $"{defaultThemeName}ThemeBundles.Styles.Global", - "BasicThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.Host/MyProjectNameHostModule.cs", - $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic", - $"AbpAspNetCoreMvcUi{defaultThemeName}ThemeModule", - "AbpAspNetCoreMvcUiBasicThemeModule" + defaultThemeName, + Basic ); + } - #endregion - - #region Blazor.Server Projects - - ChangeThemeToBasicForBlazorProjects(context, defaultThemeName); - - #endregion - - #region Angular - - var angularPackageName = context.BuildArgs.TemplateName is AppTemplate.TemplateName or AppNoLayersTemplate.TemplateName - ? "@abp/ng.theme.lepton-x" - : "@volosoft/abp.ng.theme.lepton-x"; - + private static void ChangeThemeForAngularProjects(ProjectBuildContext context, string oldThemeName, string newThemeName, string oldPackageName, string newPackageName) + { + if (context.BuildArgs.UiFramework != UiFramework.Angular) + { + return; + } + ReplaceImportPackage( context, "/angular/src/app/app.module.ts", - angularPackageName, - "@abp/ng.theme.basic" + oldPackageName, + newPackageName ); - + RemoveLinesByStatement( context, "/angular/src/app/app.module.ts", "SideMenuLayoutModule" ); - - ReplaceMethodNames( + + ReplaceAllKeywords( context, "/angular/src/app/app.module.ts", - "ThemeLeptonXModule", - "ThemeBasicModule" - ); - - RemoveLinesByStatement( - context, - "/angular/angular.json", - "node_modules/bootstrap-icons/font/bootstrap-icons.css" + $"Theme{oldThemeName}Module", + $"Theme{newThemeName}Module" ); - if(defaultThemeName == "LeptonX") + if (oldThemeName != LeptonX) { - ReplaceMethodNames( - context, - "/angular/src/app/app.module.ts", - "HttpErrorComponent, ", - "" - ); - - ChangeModuleImportBetweenStatements( - context, - "/angular/src/app/app.module.ts", - "ThemeSharedModule.forRoot", - "AccountAdminConfigModule.forRoot", - "ThemeSharedModule.forRoot()," - ); + return; } - #endregion + ReplaceAllKeywords( + context, + "/angular/src/app/app.module.ts", + "HttpErrorComponent, ", + "" + ); + + ChangeModuleImportBetweenStatements( + context, + "/angular/src/app/app.module.ts", + "ThemeSharedModule.forRoot", + "AccountAdminConfigModule.forRoot", + "ThemeSharedModule.forRoot()," + ); } - protected void ChangeToLeptonTheme(ProjectBuildContext context) + private static void ChangeThemeToLeptonForBlazorProjects(ProjectBuildContext context) { - #region Common - - RenameLeptonXFolders(context, folderName: "Lepton"); - AddLeptonThemeManagementReferenceToProjects(context); - - #endregion - - #region MVC Projects - - ChangeThemeToLeptonForMvcProjects(context); - - #endregion - - #region MyCompanyName.MyProjectName.Blazor - ReplacePackageReferenceWithProjectReference( context, "/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj", "Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme", @"..\..\..\..\..\lepton-theme\src\Volo.Abp.AspNetCore.Components.WebAssembly.LeptonTheme\Volo.Abp.AspNetCore.Components.WebAssembly.LeptonTheme.csproj" ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs", - "Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components", - "Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components", - "AbpAspNetCoreComponentsWebAssemblyLeptonXThemeModule", - "AbpAspNetCoreComponentsWebAssemblyLeptonThemeModule" + LeptonX, + Lepton ); - ChangeNamespace( - context, - "/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs", - "Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme", - "Volo.Abp.AspNetCore.Components.WebAssembly.LeptonTheme" - ); - ReplacePackageReferenceWithProjectReference( context, "/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj", "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX", @"..\..\..\..\..\lepton-theme\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton\Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.csproj" ); - - ChangeNamespaceAndKeyword( - context, - "/MyCompanyName.MyProjectName.Host/MyProjectNameHostModule.cs", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Bundling", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.Bundling", - "LeptonXThemeBundles.Styles.Global", - "LeptonThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.Host/MyProjectNameHostModule.cs", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton", - "AbpAspNetCoreMvcUiLeptonXThemeModule", - "AbpAspNetCoreMvcUiLeptonThemeModule" - ); - - #endregion - - #region MyCompanyName.MyProjectName.Blazor.Server && MyCompanyName.MyProjectName.Blazor.Server.Tiered - - ChangeThemeToLeptonForBlazorServerProjects(context); - - #endregion - - #region Angular - - ReplaceImportPackage( - context, - "/angular/src/app/app.module.ts", - "@volosoft/abp.ng.theme.lepton-x", - "@volo/abp.ng.theme.lepton" - ); - - RemoveLinesByStatement( - context, - "/angular/src/app/app.module.ts", - "SideMenuLayoutModule" - ); - - ReplaceMethodNames( - context, - "/angular/src/app/app.module.ts", - "ThemeLeptonXModule", - "ThemeLeptonModule" - ); - - RemoveLinesByStatement( - context, - "/angular/angular.json", - "node_modules/bootstrap-icons/font/bootstrap-icons.css" + LeptonX, + Lepton ); - - #endregion - - #region MyCompanyName.MyProjectName.Mvc && MyCompanyName.MyProjectName.Mvc.Mongo - - var projectNames = new[] {"Web", "HttpApi", "Application"}; - ConfigureLeptonManagementPackagesForNoLayersMvc(context, @"/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.csproj", projectNames); - - #endregion - - #region MyCompanyName.MyProjectName.Blazor.Server && MyCompanyName.MyProjectName.Blazor.Server.Mongo - (app-nolayers) - - ChangeThemeToLeptonForNoLayersBlazorServerProjects(context); - - #endregion - - #region MyCompanyName.MyProjectName.MauiBlazor - - ChangeThemeToLeptonForMauiBlazorProjects(context); - - #endregion } - private void ConfigureLeptonManagementPackagesForNoLayersMvc(ProjectBuildContext context, string targetProjectPath, string[] projectNames) + private static void ConfigureLeptonManagementPackagesForNoLayersMvc(ProjectBuildContext context, string targetProjectPath, IEnumerable projectNames) { var file = context.Files.FirstOrDefault(f => !f.Name.Contains("Test") && f.Name.Contains(targetProjectPath) && f.Name.Contains(".csproj")); if (file == null) @@ -304,7 +209,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } } - private void ChangeThemeToLeptonForMvcProjects(ProjectBuildContext context) + private static void ChangeThemeToLeptonForMvcProjects(ProjectBuildContext context) { var projectNames = new[] { @@ -333,23 +238,12 @@ public class ChangeThemeStep : ProjectBuildPipelineStep "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX", @"..\..\..\..\..\lepton-theme\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton\Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.csproj" ); - - ChangeNamespaceAndKeyword( - context, - moduleFile.Name, - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Bundling", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.Bundling", - "LeptonXThemeBundles.Styles.Global", - "LeptonThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, moduleFile.Name, - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton", - "AbpAspNetCoreMvcUiLeptonXThemeModule", - "AbpAspNetCoreMvcUiLeptonThemeModule" + LeptonX, + Lepton ); RemoveLinesByStatement( @@ -360,7 +254,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } } - private void AddLeptonThemeManagementReferenceToProjects(ProjectBuildContext context) + private static void AddLeptonThemeManagementReferenceToProjects(ProjectBuildContext context) { var projects = new Dictionary { @@ -396,7 +290,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } } - private void AddUiProjectToProjects(Dictionary projects, ProjectBuildContext context) + private static void AddUiProjectToProjects(Dictionary projects, ProjectBuildContext context) { if (projects.IsNullOrEmpty()) { @@ -418,7 +312,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } } - private void AddLeptonThemeManagementReference(ProjectBuildContext context, KeyValuePair projectInfo) + private static void AddLeptonThemeManagementReference(ProjectBuildContext context, KeyValuePair projectInfo) { var reference = $@"..\..\..\..\..\lepton-theme\src\Volo.Abp.LeptonTheme.Management.{projectInfo.Key}\Volo.Abp.LeptonTheme.Management.{projectInfo.Key}.csproj"; var projectFile = context.Files.FirstOrDefault(f => !f.Name.Contains("Test") && f.Name.Contains(projectInfo.Value) && f.Name.Contains(".csproj")); @@ -439,7 +333,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep underManagementFolder: projectInfo.Key != "HttpApi"); } - private void AddModuleDependency(FileEntry moduleFile, string projectName, string dependency, bool underManagementFolder = true) + private static void AddModuleDependency(FileEntry moduleFile, string projectName, string dependency, bool underManagementFolder = true) { var projectNames = new[] { "Blazor", "Blazor.Server", "Blazor.WebAssembly" }; @@ -460,11 +354,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep moduleFile.SetLines(lines); } - protected void ReplacePackageReferenceWithProjectReference( - ProjectBuildContext context, - string targetProjectFilePath, - string packageReference, - string projectReference) + private static void ReplacePackageReferenceWithProjectReference(ProjectBuildContext context, string targetProjectFilePath, string packageReference, string projectReference) { var file = context.Files.FirstOrDefault(x => x.Name.Contains(targetProjectFilePath)); if (file == null) @@ -485,97 +375,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep file.SetLines(lines); } - protected void ChangeNamespaceAndKeyword( - ProjectBuildContext context, - string targetModuleFilePath, - string oldNamespace, - string newNamespace, - string oldKeyword, - string newKeyword) - { - var file = context.Files.FirstOrDefault(x => x.Name.Contains(targetModuleFilePath)); - if (file == null) - { - return; - } - - file.NormalizeLineEndings(); - - var lines = file.GetLines(); - - for (var i = 0; i < lines.Length; i++) - { - if (lines[i].Contains($"using {oldNamespace}")) - { - lines[i] = lines[i].Replace($"using {oldNamespace}", $"using {newNamespace}"); - } - else if (lines[i].Contains(oldKeyword)) - { - lines[i] = lines[i].Replace(oldKeyword, newKeyword); - } - } - - file.SetLines(lines); - } - - protected void ChangeNamespace( - ProjectBuildContext context, - string targetModuleFilePath, - string oldNamespace, - string newNamespace) - { - var file = context.Files.FirstOrDefault(x => x.Name.Contains(targetModuleFilePath)); - if (file == null) - { - return; - } - - file.NormalizeLineEndings(); - - var lines = file.GetLines(); - for (var i = 0; i < lines.Length; i++) - { - if (lines[i].Contains($"using {oldNamespace}")) - { - lines[i] = lines[i].Replace($"using {oldNamespace}", $"using {newNamespace}"); - } - } - - file.SetLines(lines); - } - - protected void ChangeKeyword( - ProjectBuildContext context, - string targetModuleFilePath, - string oldKeyword, - string newKeyword) - { - var file = context.Files.FirstOrDefault(x => x.Name.Contains(targetModuleFilePath)); - if (file == null) - { - return; - } - - file.NormalizeLineEndings(); - - var lines = file.GetLines(); - - for (var i = 0; i < lines.Length; i++) - { - if (lines[i].Contains(oldKeyword)) - { - lines[i] = lines[i].Replace(oldKeyword, newKeyword); - } - } - - file.SetLines(lines); - } - - protected void ReplaceImportPackage( - ProjectBuildContext context, - string filePath, - string oldImportPackage, - string newImportPackage) + private static void ReplaceImportPackage(ProjectBuildContext context, string filePath, string oldImportPackage, string newImportPackage) { var file = context.Files.FirstOrDefault(x => x.Name.Contains(filePath)); if (file == null) @@ -584,6 +384,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } file.NormalizeLineEndings(); + var lines = file.GetLines(); var lineIndex = lines.FindIndex(line => line.Contains($"from '{oldImportPackage}'")); if (lineIndex == -1) @@ -595,10 +396,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep file.SetLines(lines); } - protected void RemoveLinesByStatement( - ProjectBuildContext context, - string filePath, - string statement) + private static void RemoveLinesByStatement(ProjectBuildContext context, string filePath, string statement) { var file = context.Files.FirstOrDefault(x => x.Name.Contains(filePath)); if (file == null) @@ -620,12 +418,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep file.SetLines(lines.Where(x => x != null)); } - private void ChangeModuleImportBetweenStatements( - ProjectBuildContext context, - string filePath, - string firstStatement, - string lastStatement, - string newStatement) + private static void ChangeModuleImportBetweenStatements(ProjectBuildContext context, string filePath, string firstStatement, string lastStatement, string newStatement) { var file = context.Files.FirstOrDefault(x => x.Name.Contains(filePath)); if (file == null) @@ -651,36 +444,9 @@ public class ChangeThemeStep : ProjectBuildPipelineStep lines[i] = null; } - file.SetLines(lines.Where(x => x != null)); } - - protected void ReplaceMethodNames( - ProjectBuildContext context, - string filePath, - string oldMethodName, - string newMethodName) - { - var file = context.Files.FirstOrDefault(x => x.Name.Contains(filePath)); - if (file == null) - { - return; - } - - file.NormalizeLineEndings(); - - var lines = file.GetLines(); - for (var i = 0; i < lines.Length; i++) - { - if (lines[i].Contains(oldMethodName)) - { - lines[i] = lines[i].Replace(oldMethodName, newMethodName); - } - } - - file.SetLines(lines); - } - + private static void AddProjectReference(FileEntry file, string reference) { if (!file.Name.Contains(".csproj")) @@ -746,7 +512,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep splittedProjectFileName = splittedProjectFileName.Take(splittedProjectFileName.Length - 1).ToArray(); - var fileName = splittedProjectFileName?.Last(); + var fileName = splittedProjectFileName.Last(); if (fileName == null) { return null; @@ -765,16 +531,40 @@ public class ChangeThemeStep : ProjectBuildPipelineStep return moduleName.Replace(".", ""); } - private static void RenameLeptonXFolders(ProjectBuildContext context, string folderName) + private static void RenameFolders(ProjectBuildContext context, string oldFolderName, string newFolderName) { - var leptonXFiles = context.Files.Where(x => x.Name.Contains("LeptonX") && x.IsDirectory); - foreach (var file in leptonXFiles) + foreach (var file in context.Files.Where(x => x.Name.Contains(oldFolderName) && x.IsDirectory)) { - new MoveFolderStep(file.Name, file.Name.Replace("LeptonX", folderName)).Execute(context); + new MoveFolderStep(file.Name, file.Name.Replace(oldFolderName, newFolderName)).Execute(context); } } - private void ChangeThemeToBasicForMvcProjects(ProjectBuildContext context, string defaultThemeName) + private static void ReplaceAllKeywords(ProjectBuildContext context, string targetModuleFilePath, string oldKeyword, string newKeyword) + { + var file = context.Files.FirstOrDefault(x => x.Name.Contains(targetModuleFilePath)); + if (file == null) + { + return; + } + + file.NormalizeLineEndings(); + + var lines = file.GetLines(); + + for (var i = 0; i < lines.Length; i++) + { + if (!lines[i].Contains(oldKeyword)) + { + continue;; + } + + lines[i] = lines[i].Replace(oldKeyword, newKeyword); + } + + file.SetLines(lines); + } + + private static void ChangeThemeToBasicForMvcProjects(ProjectBuildContext context, string defaultThemeName) { var projects = new Dictionary { @@ -794,28 +584,17 @@ public class ChangeThemeStep : ProjectBuildPipelineStep $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}", @"..\..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, $"/MyCompanyName.MyProjectName{project.Key}/{project.Value}.cs", - $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic", - $"AbpAspNetCoreMvcUi{defaultThemeName}ThemeModule", - "AbpAspNetCoreMvcUiBasicThemeModule" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName{project.Key}/{project.Value}.cs", - $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}.Bundling", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling", - $"{defaultThemeName}ThemeBundles.Styles.Global", - "BasicThemeBundles.Styles.Global" + defaultThemeName, + Basic ); } } - private void ChangeThemeToBasicForBlazorProjects(ProjectBuildContext context, string defaultThemeName) + private static void ChangeThemeToBasicForBlazorServerProjects(ProjectBuildContext context, string defaultThemeName) { var projects = new Dictionary { @@ -840,73 +619,34 @@ public class ChangeThemeStep : ProjectBuildPipelineStep $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}", @"..\..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Components.Server.BasicTheme\Volo.Abp.AspNetCore.Components.Server.BasicTheme.csproj" ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{project.Key}/{project.Value}.cs", - $"Volo.Abp.AspNetCore.Components.Server.{defaultThemeName}Theme", - "Volo.Abp.AspNetCore.Components.Server.BasicTheme", - $"AbpAspNetCoreComponentsServer{defaultThemeName}ThemeModule", - "AbpAspNetCoreComponentsServerBasicThemeModule" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{project.Key}/{project.Value}.cs", - $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic", - $"AbpAspNetCoreMvcUi{defaultThemeName}ThemeModule", - "AbpAspNetCoreMvcUiBasicThemeModule" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{project.Key}/{project.Value}.cs", - $"Volo.Abp.AspNetCore.Components.Server.{defaultThemeName}Theme.Bundling", - "Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling", - $"{defaultThemeName}ThemeBundles.Styles.Global", - "BasicThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{project.Key}/{project.Value}.cs", - $"Volo.Abp.AspNetCore.Mvc.UI.Theme.{defaultThemeName}.Bundling", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling", - $"Blazor{defaultThemeName}ThemeBundles.Styles.Global", - "BlazorBasicThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, $"/MyCompanyName.MyProjectName.{project.Key}/Pages/_Host.cshtml", - $"Volo.Abp.AspNetCore.Components.Web.{defaultThemeName}Theme.Components", - "Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic", - $"Blazor{defaultThemeName}ThemeBundles.Styles.Global", - "BlazorBasicThemeBundles.Styles.Global" + $"{defaultThemeName}Theme.Components", + Basic ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, - $"/MyCompanyName.MyProjectName.{project.Key}/Pages/_Host.cshtml", - $"Volo.Abp.AspNetCore.Components.Server.{defaultThemeName}Theme.Bundling", - "Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling", - $"Blazor{defaultThemeName}ThemeBundles.Scripts.Global", - "BlazorBasicThemeBundles.Scripts.Global" + $"/MyCompanyName.MyProjectName.{project.Key}/{project.Value}.cs", + defaultThemeName, + Basic ); - - ChangeNamespace( + + ReplaceAllKeywords( context, $"/MyCompanyName.MyProjectName.{project.Key}/Pages/_Host.cshtml", - $"Volo.Abp.AspNetCore.Components.Web.{defaultThemeName}Theme.Themes.{defaultThemeName}", - "Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic" + defaultThemeName, + Basic ); } } - private void ChangeThemeToLeptonForBlazorServerProjects(ProjectBuildContext context) + private static void ChangeThemeToLeptonForBlazorServerProjects(ProjectBuildContext context) { - var projectNames = new[] {"Blazor", "Blazor.Server.Tiered"}; + var projectNames = new[] { "Blazor", "Blazor.Server.Tiered" }; + foreach (var projectName in projectNames) { ReplacePackageReferenceWithProjectReference( @@ -922,59 +662,19 @@ public class ChangeThemeStep : ProjectBuildPipelineStep "Volo.Abp.AspNetCore.Components.Server.LeptonXTheme", @"..\..\..\..\..\lepton-theme\src\Volo.Abp.AspNetCore.Components.Server.LeptonTheme\Volo.Abp.AspNetCore.Components.Server.LeptonTheme.csproj" ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameBlazorModule.cs", - "Volo.Abp.AspNetCore.Components.Server.LeptonXTheme", - "Volo.Abp.AspNetCore.Components.Server.LeptonTheme", - "AbpAspNetCoreComponentsServerLeptonXThemeModule", - "AbpAspNetCoreComponentsServerLeptonThemeModule" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameBlazorModule.cs", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton", - "AbpAspNetCoreMvcUiLeptonXThemeModule", - "AbpAspNetCoreMvcUiLeptonThemeModule" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameBlazorModule.cs", - "Volo.Abp.AspNetCore.Components.Server.LeptonXTheme.Bundling", - "Volo.Abp.AspNetCore.Components.Server.LeptonTheme.Bundling", - "LeptonXThemeBundles.Styles.Global", - "LeptonThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameBlazorModule.cs", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Bundling", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.Bundling", - "BlazorLeptonXThemeBundles.Styles.Global", - "BlazorLeptonThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{projectName}/Pages/_Host.cshtml", - "Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components", - "Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components", - "BlazorLeptonXThemeBundles.Styles.Global", - "BlazorLeptonThemeBundles.Styles.Global" + LeptonX, + Lepton ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, $"/MyCompanyName.MyProjectName.{projectName}/Pages/_Host.cshtml", - "Volo.Abp.AspNetCore.Components.Server.LeptonXTheme.Bundling", - "Volo.Abp.AspNetCore.Components.Server.LeptonTheme.Bundling", - "BlazorLeptonXThemeBundles.Scripts.Global", - "BlazorLeptonThemeBundles.Scripts.Global" + LeptonX, + Lepton ); RemoveLinesByStatement( @@ -985,11 +685,11 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } } - private void ChangeThemeToLeptonForNoLayersBlazorServerProjects(ProjectBuildContext context) + private static void ChangeThemeToLeptonForNoLayersBlazorServerProjects(ProjectBuildContext context) { var blazorServerProjects = new[] { "Blazor.Server", "HttpApi", "Application" }; - var projectNames = new[] { "Blazor.Server", "Blazor.Server.Mongo" }; + foreach (var projectName in projectNames) { ReplacePackageReferenceWithProjectReference( @@ -1006,67 +706,29 @@ public class ChangeThemeStep : ProjectBuildPipelineStep @"..\..\..\..\lepton-theme\src\Volo.Abp.AspNetCore.Components.Server.LeptonTheme\Volo.Abp.AspNetCore.Components.Server.LeptonTheme.csproj" ); - ConfigureLeptonManagementPackagesForNoLayersMvc(context, - $@"/MyCompanyName.MyProjectName.{projectName}/MyCompanyName.MyProjectName.{projectName}.csproj", - blazorServerProjects); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameModule.cs", - "Volo.Abp.AspNetCore.Components.Server.LeptonXTheme", - "Volo.Abp.AspNetCore.Components.Server.LeptonTheme", - "AbpAspNetCoreComponentsServerLeptonXThemeModule", - "AbpAspNetCoreComponentsServerLeptonThemeModule" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameModule.cs", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton", - "AbpAspNetCoreMvcUiLeptonXThemeModule", - "AbpAspNetCoreMvcUiLeptonThemeModule" - ); - - ChangeNamespaceAndKeyword( + ConfigureLeptonManagementPackagesForNoLayersMvc( context, - $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameModule.cs", - "Volo.Abp.AspNetCore.Components.Server.LeptonXTheme.Bundling", - "Volo.Abp.AspNetCore.Components.Server.LeptonTheme.Bundling", - "LeptonXThemeBundles.Styles.Global", - "LeptonThemeBundles.Styles.Global" + $@"/MyCompanyName.MyProjectName.{projectName}/MyCompanyName.MyProjectName.{projectName}.csproj", + blazorServerProjects ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameModule.cs", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Bundling", - "Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.Bundling", - "BlazorLeptonXThemeBundles.Styles.Global", - "BlazorLeptonThemeBundles.Styles.Global" - ); - - ChangeNamespaceAndKeyword( - context, - $"/MyCompanyName.MyProjectName.{projectName}/Pages/_Host.cshtml", - "Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components", - "Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components", - "BlazorLeptonXThemeBundles.Styles.Global", - "BlazorLeptonThemeBundles.Styles.Global" + LeptonX, + Lepton ); - - ChangeNamespaceAndKeyword( + + ReplaceAllKeywords( context, $"/MyCompanyName.MyProjectName.{projectName}/Pages/_Host.cshtml", - "Volo.Abp.AspNetCore.Components.Server.LeptonXTheme.Bundling", - "Volo.Abp.AspNetCore.Components.Server.LeptonTheme.Bundling", - "BlazorLeptonXThemeBundles.Scripts.Global", - "BlazorLeptonThemeBundles.Scripts.Global" + LeptonX, + Lepton ); } } - private void ChangeThemeToLeptonForMauiBlazorProjects(ProjectBuildContext context) + private static void ChangeThemeToLeptonForMauiBlazorProjects(ProjectBuildContext context) { ReplacePackageReferenceWithProjectReference( context, @@ -1074,44 +736,42 @@ public class ChangeThemeStep : ProjectBuildPipelineStep "Volo.Abp.AspNetCore.Components.MauiBlazor.LeptonXTheme", @"..\..\..\..\..\lepton-theme\src\Volo.Abp.AspNetCore.Components.MauiBlazor.LeptonTheme\Volo.Abp.AspNetCore.Components.MauiBlazor.LeptonTheme.csproj" ); - - ChangeNamespaceAndKeyword( - context, - "/MyCompanyName.MyProjectName.MauiBlazor/MyProjectNameMauiBlazorModule.cs", - "Volo.Abp.AspNetCore.Components.MauiBlazor.LeptonXTheme", - "Volo.Abp.AspNetCore.Components.MauiBlazor.LeptonTheme", - "AbpAspNetCoreComponentsMauiBlazorLeptonXThemeModule", - "AbpAspNetCoreComponentsMauiBlazorLeptonThemeModule" - ); - - ChangeKeyword( + + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.MauiBlazor/MainPage.xaml", "clr-namespace:Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components;assembly=Volo.Abp.AspNetCore.Components.Web.LeptonXTheme", "clr-namespace:Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components;assembly=Volo.Abp.AspNetCore.Components.Web.LeptonTheme"); - ChangeKeyword( + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.MauiBlazor/MainPage.xaml", "leptonXTheme", "leptonTheme"); - ChangeKeyword( + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.MauiBlazor/Pages/Account/Login.razor", "Volo.Abp.AspNetCore.Components.MauiBlazor.LeptonXTheme.Components.AccountLayout", "Volo.Abp.AspNetCore.Components.MauiBlazor.LeptonTheme.Components.AccountLayout"); - ChangeKeyword( + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.MauiBlazor/Pages/Account/RedirectToLogout.razor", "LeptonXResource", "LeptonThemeManagementResource"); - ChangeKeyword( + ReplaceAllKeywords( context, "/MyCompanyName.MyProjectName.MauiBlazor/Pages/Account/RedirectToLogout.razor", "Volo.Abp.LeptonX.Shared.Localization", "Volo.Abp.LeptonTheme.Management.Localization"); + + ReplaceAllKeywords( + context, + "/MyCompanyName.MyProjectName.MauiBlazor/MyProjectNameMauiBlazorModule.cs", + LeptonX, + Lepton + ); } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs index 88fc0dfcbe..b8d320fb45 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs @@ -25,6 +25,7 @@ public abstract class MicroserviceTemplateBase : TemplateInfo RandomizeStringEncryption(context, steps); RandomizeAuthServerPassPhrase(context, steps); UpdateNuGetConfig(context, steps); + UpdateDockerImages(context, steps); ConfigureTheme(context, steps); return steps; @@ -221,4 +222,9 @@ public abstract class MicroserviceTemplateBase : TemplateInfo { steps.Add(new RandomizeAuthServerPassPhraseStep()); } + + private static void UpdateDockerImages(ProjectBuildContext context, List steps) + { + steps.Add(new UpdateDockerImagesStep("/etc/docker/docker-compose.infrastructure.yml")); + } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/UpdateDockerImagesStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/UpdateDockerImagesStep.cs new file mode 100644 index 0000000000..752503c871 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/UpdateDockerImagesStep.cs @@ -0,0 +1,25 @@ +using System.Linq; +using System.Runtime.InteropServices; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.Cli.ProjectBuilding.Files; + +namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; + +public class UpdateDockerImagesStep : ProjectBuildPipelineStep +{ + private readonly string _ymlFilePath; + + public UpdateDockerImagesStep(string ymlFilePath) + { + _ymlFilePath = ymlFilePath; + } + + public override void Execute(ProjectBuildContext context) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && RuntimeInformation.OSArchitecture == Architecture.Arm64) + { + var file = context.Files.FirstOrDefault(f => f.Name == _ymlFilePath); + file?.ReplaceText("mcr.microsoft.com/mssql/server:2019-latest", "mcr.microsoft.com/azure-sql-edge"); + } + } +} diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/FodyWeavers.xml b/framework/src/Volo.Abp.Ddd.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..bc5a74a236 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/FodyWeavers.xsd b/framework/src/Volo.Abp.Ddd.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj new file mode 100644 index 0000000000..489d2cf271 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj @@ -0,0 +1,22 @@ + + + + + + + netstandard2.0;netstandard2.1;net7.0 + Volo.Abp.Ddd.Domain.Shared + Volo.Abp.Ddd.Domain.Shared + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/AbpDddDomainSharedModule.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/AbpDddDomainSharedModule.cs new file mode 100644 index 0000000000..3276f22310 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/AbpDddDomainSharedModule.cs @@ -0,0 +1,14 @@ +using Volo.Abp.EventBus.Abstractions; +using Volo.Abp.Modularity; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.Domain; + +[DependsOn( + typeof(AbpMultiTenancyModule), + typeof(AbpEventBusAbstractionsModule) +)] +public class AbpDddDomainSharedModule : AbpModule +{ + +} diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AbpDistributedEntityEventOptions.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/AbpDistributedEntityEventOptions.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AbpDistributedEntityEventOptions.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/AbpDistributedEntityEventOptions.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorList.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorList.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorList.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorList.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityCreatedEto.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityCreatedEto.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityCreatedEto.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityCreatedEto.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityDeletedEto.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityDeletedEto.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityDeletedEto.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityDeletedEto.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityUpdatedEto.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityUpdatedEto.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityUpdatedEto.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityUpdatedEto.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs similarity index 91% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs index 18c56bfca7..bb9e362ac2 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Volo.Abp.EventBus.Distributed; namespace Volo.Abp.Domain.Entities.Events.Distributed; diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IAutoEntityDistributedEventSelectorList.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IAutoEntityDistributedEventSelectorList.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IAutoEntityDistributedEventSelectorList.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IAutoEntityDistributedEventSelectorList.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IEntityEto.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityEto.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IEntityEto.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityEto.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs similarity index 100% rename from framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs rename to framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj index fd80a60544..c15f7c96a8 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj @@ -15,6 +15,7 @@ + diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs index 0b41fef1cf..536e31e51f 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs @@ -22,7 +22,8 @@ namespace Volo.Abp.Domain; typeof(AbpObjectMappingModule), typeof(AbpExceptionHandlingModule), typeof(AbpSpecificationsModule), - typeof(AbpCachingModule) + typeof(AbpCachingModule), + typeof(AbpDddDomainSharedModule) )] public class AbpDddDomainModule : AbpModule { diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/Volo.Abp.EventBus.Abstractions.csproj b/framework/src/Volo.Abp.EventBus.Abstractions/Volo.Abp.EventBus.Abstractions.csproj index 225b9b70ee..b61d8315c1 100644 --- a/framework/src/Volo.Abp.EventBus.Abstractions/Volo.Abp.EventBus.Abstractions.csproj +++ b/framework/src/Volo.Abp.EventBus.Abstractions/Volo.Abp.EventBus.Abstractions.csproj @@ -9,7 +9,7 @@ - + diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Abstractions/AbpEventBusAbstractionsModule.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Abstractions/AbpEventBusAbstractionsModule.cs index 85cddf42b8..5d19fa21ba 100644 --- a/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Abstractions/AbpEventBusAbstractionsModule.cs +++ b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Abstractions/AbpEventBusAbstractionsModule.cs @@ -1,7 +1,11 @@ using Volo.Abp.Modularity; +using Volo.Abp.ObjectExtending; namespace Volo.Abp.EventBus.Abstractions; +[DependsOn( + typeof(AbpObjectExtendingModule) +)] public class AbpEventBusAbstractionsModule : AbpModule { diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IDistributedEventBus.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IDistributedEventBus.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IDistributedEventBus.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IEventInbox.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IEventInbox.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IEventInbox.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IEventInbox.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IEventOutbox.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IEventOutbox.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IEventOutbox.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IEventOutbox.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IInboxProcessor.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IInboxProcessor.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IInboxProcessor.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IInboxProcessor.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IOutboxSender.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IOutboxSender.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IOutboxSender.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IOutboxSender.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/ISupportsEventBoxes.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/ISupportsEventBoxes.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/ISupportsEventBoxes.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/ISupportsEventBoxes.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxConfig.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/InboxConfig.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxConfig.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/InboxConfig.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxConfigDictionary.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/InboxConfigDictionary.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxConfigDictionary.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/InboxConfigDictionary.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IncomingEventInfo.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IncomingEventInfo.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IncomingEventInfo.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/IncomingEventInfo.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxConfig.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/OutboxConfig.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxConfig.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/OutboxConfig.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxConfigDictionary.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/OutboxConfigDictionary.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxConfigDictionary.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/OutboxConfigDictionary.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutgoingEventInfo.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/OutgoingEventInfo.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutgoingEventInfo.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Distributed/OutgoingEventInfo.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventBus.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventBus.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventBus.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventBus.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventDataMayHaveTenantId.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventDataMayHaveTenantId.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventDataMayHaveTenantId.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventDataMayHaveTenantId.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventDataWithInheritableGenericArgument.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventDataWithInheritableGenericArgument.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventDataWithInheritableGenericArgument.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventDataWithInheritableGenericArgument.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventHandlerDisposeWrapper.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventHandlerDisposeWrapper.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventHandlerDisposeWrapper.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventHandlerDisposeWrapper.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventHandlerFactory.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventHandlerFactory.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventHandlerFactory.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventHandlerFactory.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventHandlerInvoker.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventHandlerInvoker.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/IEventHandlerInvoker.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventHandlerInvoker.cs diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/ILocalEventBus.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Local/ILocalEventBus.cs similarity index 100% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/ILocalEventBus.cs rename to framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Local/ILocalEventBus.cs diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Local/LocalEventHandlerOrderAttribute.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Local/LocalEventHandlerOrderAttribute.cs new file mode 100644 index 0000000000..7900885e3e --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/Local/LocalEventHandlerOrderAttribute.cs @@ -0,0 +1,17 @@ +using System; + +namespace Volo.Abp.EventBus.Local; + +[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] +public class LocalEventHandlerOrderAttribute : Attribute +{ + /// + /// Handlers execute in ascending numeric value of the Order property. + /// + public int Order { get; set; } + + public LocalEventHandlerOrderAttribute(int order) + { + Order = order; + } +} diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs index 9570bf80e1..d73b2f8de9 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; using Volo.Abp.EventBus.Distributed; using Volo.Abp.MultiTenancy; +using Volo.Abp.Reflection; using Volo.Abp.Threading; using Volo.Abp.Uow; @@ -138,14 +139,19 @@ public class LocalEventBus : EventBusBase, ILocalEventBus, ISingletonDependency protected override IEnumerable GetHandlerFactories(Type eventType) { - var handlerFactoryList = new List(); - + var handlerFactoryList = new List>(); foreach (var handlerFactory in HandlerFactories.Where(hf => ShouldTriggerEventForHandler(eventType, hf.Key))) { - handlerFactoryList.Add(new EventTypeWithEventHandlerFactories(handlerFactory.Key, handlerFactory.Value)); + foreach (var factory in handlerFactory.Value) + { + handlerFactoryList.Add(new Tuple( + factory, + handlerFactory.Key, + ReflectionHelper.GetAttributesOfMemberOrDeclaringType(factory.GetHandler().EventHandler.GetType()).FirstOrDefault()?.Order ?? 0)); + } } - return handlerFactoryList.ToArray(); + return handlerFactoryList.OrderBy(x => x.Item3).Select(x => new EventTypeWithEventHandlerFactories(x.Item2, new List {x.Item1})).ToArray(); } private List GetOrCreateHandlerFactories(Type eventType) diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_MultiTenancyMiddlewareErrorPageBuilder_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_MultiTenancyMiddlewareErrorPageBuilder_Tests.cs index 8932745f29..2d2de48992 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_MultiTenancyMiddlewareErrorPageBuilder_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_MultiTenancyMiddlewareErrorPageBuilder_Tests.cs @@ -1,9 +1,10 @@ -using System.Collections.Generic; -using System.Net; +using System.Net; +using System.Text.Json; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Shouldly; +using Volo.Abp.Http; using Xunit; namespace Volo.Abp.AspNetCore.MultiTenancy; @@ -23,4 +24,17 @@ public class AspNetCoreMultiTenancy_MultiTenancyMiddlewareErrorPageBuilder_Tests var result = await GetResponseAsStringAsync($"http://abp.io?{_options.TenantKey}=", HttpStatusCode.NotFound); result.ShouldNotContain(""); } + + [Fact] + public async Task MultiTenancyMiddlewareErrorPageBuilder_Ajax_Test() + { + using (var response = await GetResponseAsync($"http://abp.io?{_options.TenantKey}=abpio", HttpStatusCode.NotFound, xmlHttpRequest: true)) + { + var result = await response.Content.ReadAsStringAsync(); + var error = JsonSerializer.Deserialize(result, new JsonSerializerOptions {PropertyNamingPolicy = JsonNamingPolicy.CamelCase}); + error.Error.ShouldNotBeNull(); + error.Error.Message.ShouldBe("Tenant not found!"); + error.Error.Details.ShouldBe("There is no tenant with the tenant id or name: abpio"); + } + } } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Order_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Order_Test.cs new file mode 100644 index 0000000000..3bf8c3a7b6 --- /dev/null +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Order_Test.cs @@ -0,0 +1,56 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Entities.Events; +using Xunit; + +namespace Volo.Abp.EventBus.Local; + +public class EventBus_Order_Test : EventBusTestBase +{ + public static string HandlerExecuteOrder { get; set; } + + [Fact] + public async Task Handler_Should_Execute_By_Order() + { + HandlerExecuteOrder = ""; + await LocalEventBus.PublishAsync(new MyOrderEventHandlerEventData()); + HandlerExecuteOrder.ShouldBe("321"); + } + + public class MyOrderEventHandlerEventData + { + + } + + public class MyOrderEventHandler : ILocalEventHandler, ITransientDependency + { + public Task HandleEventAsync(MyOrderEventHandlerEventData eventData) + { + HandlerExecuteOrder += "1"; + return Task.CompletedTask; + } + } + + [LocalEventHandlerOrder(-2)] + public class MyOrderEventHandler2 : ILocalEventHandler, ITransientDependency + { + public Task HandleEventAsync(MyOrderEventHandlerEventData eventData) + { + HandlerExecuteOrder += "2"; + return Task.CompletedTask; + } + } + + [LocalEventHandlerOrder(-3)] + public class MyOrderEventHandler3 : ILocalEventHandler, ITransientDependency + { + public Task HandleEventAsync(MyOrderEventHandlerEventData eventData) + { + HandlerExecuteOrder += "3"; + return Task.CompletedTask; + } + } + +} diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.Designer.cs b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.Designer.cs new file mode 100644 index 0000000000..6386b0eb88 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.Designer.cs @@ -0,0 +1,1489 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.BloggingTestApp.EntityFrameworkCore; + +#nullable disable + +namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(BloggingTestAppDbContext))] + [Migration("20230504070814_Added_BlogUser_Optionals")] + partial class AddedBlogUserOptionals + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("ProductVersion", "7.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("bit") + .HasColumnName("IsActive"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LastPasswordChangeTime") + .HasColumnType("datetimeoffset"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("ShouldChangePasswordOnNextLogin") + .HasColumnType("bit"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AbpUserDelegations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("MultiTenancySide") + .HasColumnType("tinyint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Providers") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("StateCheckers") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpPermissionGrants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissionGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); + + b.ToTable("AbpSettings", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Name"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)") + .HasColumnName("ShortName"); + + b.HasKey("Id"); + + b.ToTable("BlgBlogs", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier") + .HasColumnName("PostId"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier") + .HasColumnName("RepliedCommentId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)") + .HasColumnName("Text"); + + b.HasKey("Id"); + + b.HasIndex("PostId"); + + b.HasIndex("RepliedCommentId"); + + b.ToTable("BlgComments", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.Post", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("BlogId"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(1048576) + .HasColumnType("nvarchar(max)") + .HasColumnName("Content"); + + b.Property("CoverImage") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("CoverImage"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ReadCount") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("Title"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Url"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.ToTable("BlgPosts", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b => + { + b.Property("PostId") + .HasColumnType("uniqueidentifier") + .HasColumnName("PostId"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TagId"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.HasKey("PostId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("BlgPostTags", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Tagging.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("UsageCount") + .HasColumnType("int") + .HasColumnName("UsageCount"); + + b.HasKey("Id"); + + b.ToTable("BlgTags", (string)null); + }); + + modelBuilder.Entity("Volo.Blogging.Users.BlogUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Biography") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasColumnName("Biography"); + + b.Property("Company") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("Company"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Github") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Github"); + + b.Property("IsActive") + .HasColumnType("bit") + .HasColumnName("IsActive"); + + b.Property("JobTitle") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)") + .HasColumnName("JobTitle"); + + b.Property("Linkedin") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Linkedin"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Twitter") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Twitter"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.Property("WebSite") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("WebSite"); + + b.HasKey("Id"); + + b.ToTable("BlgUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Blogging.Comments.Comment", b => + { + b.HasOne("Volo.Blogging.Posts.Post", null) + .WithMany() + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Blogging.Comments.Comment", null) + .WithMany() + .HasForeignKey("RepliedCommentId"); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.Post", b => + { + b.HasOne("Volo.Blogging.Blogs.Blog", null) + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b => + { + b.HasOne("Volo.Blogging.Posts.Post", null) + .WithMany("Tags") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Blogging.Tagging.Tag", null) + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Blogging.Posts.Post", b => + { + b.Navigation("Tags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.cs b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.cs new file mode 100644 index 0000000000..f84cefc9f8 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20230504070814_Added_BlogUser_Optionals.cs @@ -0,0 +1,226 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations +{ + /// + public partial class AddedBlogUserOptionals : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Biography", + table: "BlgUsers", + type: "nvarchar(1000)", + maxLength: 1000, + nullable: true); + + migrationBuilder.AddColumn( + name: "Company", + table: "BlgUsers", + type: "nvarchar(128)", + maxLength: 128, + nullable: true); + + migrationBuilder.AddColumn( + name: "Github", + table: "BlgUsers", + type: "nvarchar(64)", + maxLength: 64, + nullable: true); + + migrationBuilder.AddColumn( + name: "JobTitle", + table: "BlgUsers", + type: "nvarchar(32)", + maxLength: 32, + nullable: true); + + migrationBuilder.AddColumn( + name: "Linkedin", + table: "BlgUsers", + type: "nvarchar(64)", + maxLength: 64, + nullable: true); + + migrationBuilder.AddColumn( + name: "Twitter", + table: "BlgUsers", + type: "nvarchar(64)", + maxLength: 64, + nullable: true); + + migrationBuilder.AddColumn( + name: "WebSite", + table: "BlgUsers", + type: "nvarchar(256)", + maxLength: 256, + nullable: true); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "AbpUsers", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "LastPasswordChangeTime", + table: "AbpUsers", + type: "datetimeoffset", + nullable: true); + + migrationBuilder.AddColumn( + name: "ShouldChangePasswordOnNextLogin", + table: "AbpUsers", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "AbpRoles", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "EntityVersion", + table: "AbpOrganizationUnits", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "AbpPermissionGroups", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGroups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpPermissions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + GroupName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ParentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + IsEnabled = table.Column(type: "bit", nullable: false), + MultiTenancySide = table.Column(type: "tinyint", nullable: false), + Providers = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + StateCheckers = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpUserDelegations", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + SourceUserId = table.Column(type: "uniqueidentifier", nullable: false), + TargetUserId = table.Column(type: "uniqueidentifier", nullable: false), + StartTime = table.Column(type: "datetime2", nullable: false), + EndTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserDelegations", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGroups_Name", + table: "AbpPermissionGroups", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissions_GroupName", + table: "AbpPermissions", + column: "GroupName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissions_Name", + table: "AbpPermissions", + column: "Name", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpPermissionGroups"); + + migrationBuilder.DropTable( + name: "AbpPermissions"); + + migrationBuilder.DropTable( + name: "AbpUserDelegations"); + + migrationBuilder.DropColumn( + name: "Biography", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Company", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Github", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "JobTitle", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Linkedin", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "Twitter", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "WebSite", + table: "BlgUsers"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "LastPasswordChangeTime", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "ShouldChangePasswordOnNextLogin", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "AbpRoles"); + + migrationBuilder.DropColumn( + name: "EntityVersion", + table: "AbpOrganizationUnits"); + } + } +} diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs index 882783d768..b6dc962eaf 100644 --- a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs @@ -19,10 +19,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("ProductVersion", "7.0.1") .HasAnnotation("Relational:MaxIdentifierLength", 128); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => { @@ -183,6 +183,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -369,6 +372,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasDefaultValue(false) .HasColumnName("EmailConfirmed"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -397,6 +403,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); + b.Property("LastPasswordChangeTime") + .HasColumnType("datetimeoffset"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -445,6 +454,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(256)") .HasColumnName("SecurityStamp"); + b.Property("ShouldChangePasswordOnNextLogin") + .HasColumnType("bit"); + b.Property("Surname") .HasMaxLength(64) .HasColumnType("nvarchar(64)") @@ -507,6 +519,33 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations b.ToTable("AbpUserClaims", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AbpUserDelegations", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { b.Property("UserId") @@ -647,6 +686,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(128)") .HasColumnName("DisplayName"); + b.Property("EntityVersion") + .HasColumnType("int"); + b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); @@ -708,6 +750,59 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations b.ToTable("AbpOrganizationUnitRoles", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("MultiTenancySide") + .HasColumnType("tinyint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Providers") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("StateCheckers") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissions", (string)null); + }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") @@ -742,6 +837,34 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations b.ToTable("AbpPermissionGrants", (string)null); }); + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissionGroups", (string)null); + }); + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") @@ -1099,6 +1222,16 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("Biography") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasColumnName("Biography"); + + b.Property("Company") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("Company"); + b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasMaxLength(40) @@ -1121,10 +1254,25 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); + b.Property("Github") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Github"); + b.Property("IsActive") .HasColumnType("bit") .HasColumnName("IsActive"); + b.Property("JobTitle") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)") + .HasColumnName("JobTitle"); + + b.Property("Linkedin") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Linkedin"); + b.Property("Name") .HasMaxLength(64) .HasColumnType("nvarchar(64)") @@ -1150,12 +1298,22 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); + b.Property("Twitter") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Twitter"); + b.Property("UserName") .IsRequired() .HasMaxLength(256) .HasColumnType("nvarchar(256)") .HasColumnName("UserName"); + b.Property("WebSite") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("WebSite"); + b.HasKey("Id"); b.ToTable("BlgUsers", (string)null); diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/CustomIdentityBlogUserUpdateDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/CustomIdentityBlogUserUpdateDto.cs new file mode 100644 index 0000000000..8cd675ec1f --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/CustomIdentityBlogUserUpdateDto.cs @@ -0,0 +1,38 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Blogging.Users; + +namespace Volo.Blogging.Members; + +public class CustomIdentityBlogUserUpdateDto +{ + [StringLength(UserConsts.MaxNameLength)] + public string Name { get; set; } + + [StringLength(UserConsts.MaxSurnameLength)] + public string Surname { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "PersonalSiteUrlValidationMessage")] + [StringLength(UserConsts.MaxWebSiteLength)] + public string WebSite { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "TwitterUserNameValidationMessage")] + [StringLength(UserConsts.MaxTwitterLength)] + public string Twitter { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "GitHubUserNameValidationMessage")] + [StringLength(UserConsts.MaxGithubLength)] + public string Github { get; set; } + + [RegularExpression(@"^((?!\s).)*$", ErrorMessage= "LinkedinUrlValidationMessage")] + [StringLength(UserConsts.MaxLinkedinLength)] + public string Linkedin { get; set; } + + [StringLength(UserConsts.MaxCompanyLength)] + public string Company { get; set; } + + [StringLength(UserConsts.MaxJobTitleLength)] + public string JobTitle { get; set; } + + [StringLength(UserConsts.MaxBiographyLength)] + public string Biography { get; set; } +} \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs index 5e06d20956..a085d039ac 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Members/IMemberAppService.cs @@ -7,4 +7,6 @@ namespace Volo.Blogging.Members; public interface IMemberAppService : IApplicationService { Task FindAsync(string username); + + Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input); } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs index eb4f707e34..23e65b9e95 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/BlogUserDto.cs @@ -8,6 +8,10 @@ namespace Volo.Blogging.Posts { public Guid? TenantId { get; set; } + public string Name { get; set; } + + public string Surname { get; set; } + public string UserName { get; set; } public string Email { get; set; } @@ -17,7 +21,21 @@ namespace Volo.Blogging.Posts public string PhoneNumber { get; set; } public bool PhoneNumberConfirmed { get; set; } + + public string WebSite { get; set; } + + public string Twitter { get; set; } + + public string Github { get; set; } + + public string Linkedin { get; set; } + + public string Company { get; set; } + public string JobTitle { get; set; } + + public string Biography { get; set; } + public Dictionary ExtraProperties { get; set; } } } diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs index e4af45a345..2fbb5bd845 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs @@ -23,5 +23,7 @@ namespace Volo.Blogging.Posts Task UpdateAsync(Guid id, UpdatePostDto input); Task> GetListByUserIdAsync(Guid userId); + + Task> GetLatestBlogPostsAsync(Guid blogId, int count); } } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs index e27c0baefa..afc5eac0b6 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs @@ -26,4 +26,21 @@ public class MemberAppService : BloggingAppServiceBase, IMemberAppService return ObjectMapper.Map(user); } + + public async Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input) + { + var user = await _userRepository.GetAsync(CurrentUser.Id.Value); + + user.Name = input.Name; + user.Surname = input.Surname; + user.WebSite = input.WebSite; + user.Twitter = input.Twitter; + user.Github = input.Github; + user.Linkedin = input.Linkedin; + user.Company = input.Company; + user.JobTitle = input.JobTitle; + user.Biography = input.Biography; + + await _userRepository.UpdateAsync(user); + } } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 0158dc0e5a..1983bd3cbf 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -195,6 +195,36 @@ namespace Volo.Blogging.Posts return ObjectMapper.Map, List>(posts); } + public async Task> GetLatestBlogPostsAsync(Guid blogId, int count) + { + var posts = await PostRepository.GetLatestBlogPostsAsync(blogId, count); + var userDictionary = new Dictionary(); + var postDtos = new List(ObjectMapper.Map, List>(posts)); + + foreach (var postDto in postDtos) + { + if (!postDto.CreatorId.HasValue) + { + continue; + } + + if (userDictionary.TryGetValue(postDto.CreatorId.Value, out var creatorUserDto)) + { + postDto.Writer = creatorUserDto; + continue; + } + + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + if (creatorUser != null) + { + postDto.Writer = ObjectMapper.Map(creatorUser); + userDictionary[creatorUser.Id] = postDto.Writer; + } + } + + return new List(postDtos); + } + [Authorize(BloggingPermissions.Posts.Create)] public async Task CreateAsync(CreatePostDto input) { diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json index d4bfede795..989926f760 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json @@ -61,6 +61,18 @@ "FileUploadInfo": "Drag, drop, or paste a copied image.", "PostDescriptionHint": "* Will be rendered in the article link preview, supports HTML", "ReadMore": "Continue Reading", - "MemberNotPublishedPostYet": "No posts yet!" + "MemberNotPublishedPostYet": "No posts yet!", + "UpdateUserWebSiteInfo": "Example: https://johndoe.com", + "UpdateUserTwitterInfo": "Example: johndoe", + "UpdateUserGithubInfo": "Example: johndoe", + "UpdateUserLinkedinInfo": "Example: https://www.linkedin.com/...", + "UpdateUserCompanyInfo": "Example: Volosoft", + "UpdateUserJobTitleInfo": "Example: Software Developer", + "WebSite": "Web Site", + "UserName": "Username", + "FullURL": "Full URL", + "JobTitle": "Job Title", + "PersonalWebsite": "PERSONAL WEBSITE", + "EditProfile": "Edit Profile" } } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs new file mode 100644 index 0000000000..3cd7dd2252 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Users/UserConsts.cs @@ -0,0 +1,22 @@ +namespace Volo.Blogging.Users; + +public class UserConsts +{ + public const int MaxNameLength = 64; + + public const int MaxSurnameLength = 64; + + public const int MaxBiographyLength = 1000; + + public const int MaxWebSiteLength = 256; + + public const int MaxTwitterLength = 128; + + public const int MaxGithubLength = 256; + + public const int MaxLinkedinLength = 256; + + public const int MaxCompanyLength = 256; + + public const int MaxJobTitleLength = 128; +} diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs index 33a6377264..d29d72fc8b 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/IPostRepository.cs @@ -17,5 +17,7 @@ namespace Volo.Blogging.Posts Task> GetOrderedList(Guid blogId,bool descending = false, CancellationToken cancellationToken = default); Task> GetListByUserIdAsync(Guid userId, CancellationToken cancellationToken = default); + + Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default); } } diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs index 4b7e5b63e8..cbe530f11f 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Users; @@ -23,6 +24,27 @@ namespace Volo.Blogging.Users public virtual string PhoneNumber { get; protected set; } public virtual bool PhoneNumberConfirmed { get; protected set; } + + [CanBeNull] + public virtual string WebSite { get; set; } + + [CanBeNull] + public virtual string Twitter { get; set; } + + [CanBeNull] + public virtual string Github { get; set; } + + [CanBeNull] + public virtual string Linkedin { get; set; } + + [CanBeNull] + public virtual string Company { get; set; } + + [CanBeNull] + public virtual string JobTitle { get; set; } + + [CanBeNull] + public virtual string Biography { get; set; } protected BlogUser() { diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs index abf96ebcef..5388c4f313 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs @@ -26,8 +26,16 @@ namespace Volo.Blogging.EntityFrameworkCore builder.Entity(b => { b.ToTable(AbpBloggingDbProperties.DbTablePrefix + "Users", AbpBloggingDbProperties.DbSchema); - b.ConfigureByConvention(); + + b.Property(nameof(BlogUser.Biography)).HasMaxLength(UserConsts.MaxBiographyLength).HasColumnName(nameof(BlogUser.Biography)); + b.Property(nameof(BlogUser.WebSite)).HasMaxLength(UserConsts.MaxWebSiteLength).HasColumnName(nameof(BlogUser.WebSite)); + b.Property(nameof(BlogUser.Twitter)).HasMaxLength(UserConsts.MaxTwitterLength).HasColumnName(nameof(BlogUser.Twitter)); + b.Property(nameof(BlogUser.Github)).HasMaxLength(UserConsts.MaxGithubLength).HasColumnName(nameof(BlogUser.Github)); + b.Property(nameof(BlogUser.Linkedin)).HasMaxLength(UserConsts.MaxLinkedinLength).HasColumnName(nameof(BlogUser.Linkedin)); + b.Property(nameof(BlogUser.Company)).HasMaxLength(UserConsts.MaxCompanyLength).HasColumnName(nameof(BlogUser.Company)); + b.Property(nameof(BlogUser.JobTitle)).HasMaxLength(UserConsts.MaxJobTitleLength).HasColumnName(nameof(BlogUser.JobTitle)); + b.ConfigureAbpUser(); b.ApplyObjectExtensionMappings(); diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs index 48dfabb77e..98d2d76685 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs @@ -70,6 +70,15 @@ namespace Volo.Blogging.Posts return await query.ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) + { + var query = (await GetDbSetAsync()).Where(p => p.BlogId == blogId) + .OrderByDescending(p => p.CreationTime) + .Take(count); + + return await query.ToListAsync(GetCancellationToken(cancellationToken)); + } + public override async Task> WithDetailsAsync() { return (await GetQueryableAsync()).IncludeDetails(); diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs index dfabaed346..4a563e79e3 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/MembersClientProxy.Generated.cs @@ -25,4 +25,12 @@ public partial class MembersClientProxy : ClientProxyBase, IM { typeof(string), username } }); } + + public Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input) + { + return RequestAsync(nameof(UpdateUserProfileAsync), new ClientProxyRequestTypeValue + { + { typeof(CustomIdentityBlogUserUpdateDto), input } + }); + } } diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs index 697606f05c..7f730ee3f2 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/ClientProxies/PostsClientProxy.Generated.cs @@ -74,6 +74,15 @@ public partial class PostsClientProxy : ClientProxyBase, IPostA }); } + public Task> GetLatestBlogPostsAsync(Guid blogId, int count) + { + return RequestAsync>(nameof(GetLatestBlogPostsAsync), new ClientProxyRequestTypeValue + { + { typeof(Guid), blogId }, + { typeof(int), count } + }); + } + public virtual async Task DeleteAsync(Guid id) { await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs index f2f31261a6..52d7a6426a 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs @@ -69,6 +69,13 @@ namespace Volo.Blogging return _postAppService.GetListByUserIdAsync(userId); } + [HttpGet] + [Route("{blogId}/latest/{count}")] + public Task> GetLatestBlogPostsAsync(Guid blogId, int count) + { + return _postAppService.GetLatestBlogPostsAsync(blogId, count); + } + [HttpDelete] [Route("{id}")] public Task DeleteAsync(Guid id) diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs index be6942eac2..eea6e82015 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; +using Nito.AsyncEx; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; @@ -66,5 +67,14 @@ namespace Volo.Blogging.Posts return await query.ToListAsync(GetCancellationToken(cancellationToken)); } + + public async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) + { + var query = (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.BlogId == blogId) + .OrderByDescending(x => x.CreationTime) + .Take(count); + + return await query.ToListAsync(GetCancellationToken(cancellationToken)); + } } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml index df6ab306e0..9c44b0feb2 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -1,4 +1,5 @@ @page +@using System.Globalization @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Http.Extensions @using Microsoft.Extensions.Options @@ -11,6 +12,7 @@ @inject IAuthorizationService Authorization @inject IOptionsSnapshot twitterOptions @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.AspNetCore.Mvc.TagHelpers @using Volo.Blogging.Localization @using Volo.Blogging.Pages.Blog @inject IHtmlLocalizer L @@ -49,314 +51,442 @@ }
- -
-
-
-
-
-
-

@Model.Post.Title

+ +
+
+
+
+
+
+

@Model.Post.Title

+
+ +
+
+
+ Cover Image +
+
+
+
+

+ @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) +

+
+
+
+
+
+ @if (Model.Post.Writer != null) + { + + User Avatar + + } +
+
+
+ + @if (Model.Post.Writer.Name != null && Model.Post.Writer.Surname != null) + { +

@Model.Post.Writer.Name @Model.Post.Writer.Surname

+ } + else + { +

@Model.Post.Writer.UserName

+ } +
+
+
+ @if (Model.Post.Writer.JobTitle != null) + { +

@Model.Post.Writer.JobTitle

+ } +
+ @if (CurrentUser.UserName == Model.Post.Writer.UserName) + { + @L["EditProfile"] + } +
+
+

More from Blog

+ @for (var index = 0; index < Model.LatestPosts.Count && index < 5; index++) + { + if (Model.LatestPosts[index].Id != Model.Post.Id) + { + var post = Model.LatestPosts[index]; + +
+
-
- Cover Image -
-
-
-
+
+ } + }
+
+
+ +
+
+@if (Model.Post.Tags.Count > 0) +{ +
+
@L["TagsInThisArticle"]
+ @foreach (var tag in Model.Post.Tags) + { + @tag.Name + } +
+} + +@if (Model.CommentsWithReplies.Count > 0) +{ + + +

@L["CommentWithCount", @Model.CommentCount]

+ @if (hasCommentingPermission) + { + @L["LeaveComment"] + } + else + { + @L["LeaveComment"] + } +
+
-
-
-
-

- @Html.Raw(BloggingPageHelper.RenderMarkdownToHtml(Model.Post.Content)) +

+ @foreach (var commentWithRepliesDto in Model.CommentsWithReplies) + { +
+ User Avatar +
+
+ @(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) + @BloggingPageHelper.ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime) +
+

+ @commentWithRepliesDto.Comment.Text

-
-
-
+
-
-
-
-
- @(L["ShareOn"].Value + " :") - - Twitter - - - Linkedin - - - E-mail - -
- @if (Model.Post.Tags.Count > 0) - { -
-
@L["TagsInThisArticle"]
- @foreach (var tag in Model.Post.Tags) + @if (hasCommentingPermission) { - @tag.Name + + @L["Reply"] + } -
- } - @if (Model.CommentsWithReplies.Count > 0) - { - - -

@L["CommentWithCount", @Model.CommentCount]

- @if (hasCommentingPermission) - { - @L["LeaveComment"] - } - else - { - @L["LeaveComment"] - } -
-
+ @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { + | + + @L["Delete"] + + } -
- @foreach (var commentWithRepliesDto in Model.CommentsWithReplies) + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) { -
- User Avatar -
-
- @(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) - @BloggingPageHelper.ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime) -
-

- @commentWithRepliesDto.Comment.Text -

-
+ | + + @L["Edit"] + + } +
- @if (hasCommentingPermission) - { - - @L["Reply"] - - } + @if (hasCommentingPermission) + { +
+
+

+ @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Delete"] - - } +

+
+
+ + - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Edit"] - - } -
+
+ +
+ + + +
+
+
+ } + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { +
+
+
+
+ + +
+ +
+ + + +
+
+
+ } + + @foreach (var reply in commentWithRepliesDto.Replies) + { +
+ User Avatar +
+
+ @(reply.Writer == null ? "" : reply.Writer.UserName) + @BloggingPageHelper.ConvertDatetimeToTimeAgo(reply.CreationTime) +
+

+ @reply.Text +

+
@if (hasCommentingPermission) { -
-
-

- @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] - -

-
-
- - - -
- -
- - - -
-
-
+ + @L["Reply"] + } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) { -
-
-
-
- - -
- -
- - - -
-
-
+ | + + @L["Delete"] + } - @foreach (var reply in commentWithRepliesDto.Replies) + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) { -
- User Avatar -
-
- @(reply.Writer == null ? "" : reply.Writer.UserName) - @BloggingPageHelper.ConvertDatetimeToTimeAgo(reply.CreationTime) -
-

- @reply.Text -

-
- - @if (hasCommentingPermission) - { - - @L["Reply"] - - } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Delete"] - - } - - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Edit"] - - } -
+ | + + @L["Edit"] + + } +
- @if (hasCommentingPermission) - { -
-
-

- @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] -

-
-
- - -
- -
- - - -
-
+ @if (hasCommentingPermission) + { +
+
+

+ @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] +

+
+
+ + +
+
- } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { -
-
-
- - -
- -
- - - -
-
+ + + +
+
+
+ } + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { +
+
+
+
+ +
+
- } + + +
- } -
-
- } -
- } - - @if (hasCommentingPermission) - { -
-
-

@L["LeaveComment"]

-
-
-
-
- - -
-
- - + }
+ } +
+
+ } +
+} + +@if (hasCommentingPermission) +{ +
+
+

@L["LeaveComment"]

+
+
+
+
+ + +
+
- } - else - { - @L["LeaveComment"] - } + +
+} +else +{ + @L["LeaveComment"] +} +
+
+

More from @CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Model.Post.Writer.UserName)

+ @for (var index = 0; index < Model.PostsList.Count; index++) + { + if (Model.PostsList[index].Id != Model.Post.Id) + { + var post = Model.PostsList[index]; +
+
+ + + + + + + @L["Blog"].Value.ToUpper() + +
+
+ +

+ + @post.Title + +

+

+ + @post.Description.TruncateWithPostfix(150) + + @L["ReadMore"] +

+
+
+
+ +
+
+
+ } + + } +
+
+
+
+ +
+
+
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs index 0dd95c0769..54d1a4e71d 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs @@ -40,6 +40,13 @@ namespace Volo.Blogging.Pages.Blog.Posts public BlogDto Blog { get; set; } + public List PostsList { get; set; } + + public IReadOnlyList LatestPosts { get; set; } + + [BindProperty(SupportsGet = true)] + public string TagName { get; set; } + public DetailModel(IPostAppService postAppService, IBlogAppService blogAppService, ICommentAppService commentAppService) { _postAppService = postAppService; @@ -79,6 +86,8 @@ namespace Volo.Blogging.Pages.Blog.Posts { Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl }); + PostsList = await _postAppService.GetListByUserIdAsync(Post.Writer.Id); + LatestPosts = await _postAppService.GetLatestBlogPostsAsync(Blog.Id, 5); CommentsWithReplies = await _commentAppService.GetHierarchicalListOfPostAsync(Post.Id); CountComments(); } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js index 7a0d0da168..59a148ef91 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js @@ -15,6 +15,12 @@ pageHeader + ' | ' + blogName + ' | ' + window.location.href ) ); + + $('#FacebookShareLink').attr( + 'href', + 'https://www.facebook.com/sharer/sharer.php?u=' + + encodeURI(window.location.href) + ); $('#LinkedinShareLink').attr( 'href', @@ -44,7 +50,16 @@ '&' ); }; - + + $('#CopyLink').click(function (event) { + event.preventDefault(); + var $temp = $(''); + $('body').append($temp); + $temp.val(window.location.href).select(); + document.execCommand('copy'); + $temp.remove(); + }); + $('div .replyForm').hide(); $('div .editForm').hide(); diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css index 6aac0e363b..b24425f547 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css @@ -320,3 +320,31 @@ div.vs-blog { text-decoration: none; } div.vs-blog > .form-group { margin: 0 !important; } +.last-post-title{ + font-size: 15px; + line-height: 20px; + font-weight: 700; + letter-spacing: 0px; + text-decoration: none; + color: black; +} +.last-post-image{ + width: 30px; + height: 30px; + border-top-left-radius: 50%; + border-top-right-radius: 50%; + border-bottom-right-radius: 50%; + border-bottom-left-radius: 50%; +} +.last-post-name{ + padding-right: 2px; + max-height: 16px; + padding-top: 0.5em; + padding-right: 0.5em; +} +#CopyLink{ + padding: 0; + border: none; + background: none; +} + diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml index 62841ae158..12ed3cc854 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml @@ -1,7 +1,12 @@ @page +@using System.Globalization @using Microsoft.Extensions.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Utils @using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers @using Volo.Abp.Users +@using Volo.Blogging +@using Volo.Blogging.Areas.Blog.Helpers.TagHelpers @using Volo.Blogging.Localization @model Volo.Blogging.Pages.Members.IndexModel @inject IStringLocalizer L @@ -10,6 +15,10 @@ ViewBag.Title = @Model.User.UserName.ToUpper() + " - " + L["Blogs"].Value; } +@section scripts { + +} + @section styles { } @@ -23,74 +32,167 @@
- @if (Model.User.UserName != null) + @if (Model.User.Name != null && Model.User.Surname != null) + { +

@Model.User.Name @Model.User.Surname

+ } + @if (Model.User.Company != null) + { +

@Model.User.Company

+ } + @if (Model.User.JobTitle != null) { -

@Model.User.UserName

+

@Model.User.JobTitle

} - @L["UserName"].Value.ToUpper() + + @L["UserName"].Value.ToUpper()
@Model.User.UserName
+ + @if (Model.User.WebSite != null) + { + @L["PersonalWebsite"].Value.ToUpper() +
+ @Model.User.WebSite +
+ } + + + @if (Model.User.Twitter != null || Model.User.Github != null || Model.User.Linkedin != null) + { + @L["Social"].Value.ToUpper() +
    + @if (Model.User.Twitter != null) + { +
  • + +
    +
    +
  • + } + @if (Model.User.Github != null) + { +
  • + +
    +
    +
  • + } + @if (Model.User.Linkedin != null) + { +
  • + +
    +
    +
  • + } +
+ } + + @if (Model.User.Biography != null) + { +
+ @L["Biography"].Value.ToUpper() +

@Model.User.Biography

+
+ }
- @if (Model.Posts is not null && Model.Posts.Any()) - { -
+
- -
- @foreach (var post in Model.Posts) - { -
-
- - - - - - - @L["Blog"].Value.ToUpper() - -
-
- -

- - @post.Title - -

-

- - @post.Description.TruncateWithPostfix(150) - - @L["ReadMore"] -

-
-
-
- -
+ @if (Model.Posts is not null && Model.Posts.Any()) + { + +
+ @foreach (var post in Model.Posts) + { +
+
+ + + + + + + @L["Blog"].Value.ToUpper() + +
+
+ +

+ + @post.Title + +

+

+ + @post.Description.TruncateWithPostfix(150) + + @L["ReadMore"] +

+
+
+
+ +
+
+
+ } +
+
+ } + else + { +
+
+

@L["MemberNotPublishedPostYet"]

+
+
+ } + @if (CurrentUser.UserName == Model.User.UserName) + { + +
+
+ + + + + + + + + + + + + + + + + + +
+ + +
+
+
+
+
-
- } -
- + +
+ + }
- } - else - { -
-
-

@L["MemberNotPublishedPostYet"]

-
-
- }
\ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs index 8018ea23e8..43cd31fd4a 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.cshtml.cs @@ -23,6 +23,9 @@ public class IndexModel : AbpPageModel public Dictionary BlogShortNameMap { get; set; } + [BindProperty] + public CustomIdentityBlogUserUpdateDto CustomUserUpdate { get; set; } + public IndexModel(IPostAppService postAppService, IMemberAppService memberAppService, IBlogAppService blogAppService) { _postAppService = postAppService; @@ -51,6 +54,14 @@ public class IndexModel : AbpPageModel return Page(); } + + public async Task OnPostAsync() + { + await _memberAppService.UpdateUserProfileAsync(CustomUserUpdate); + + return Redirect($"/members/{CurrentUser.UserName}"); + } + public string GetBlogPostUrl(PostWithDetailsDto post) { var blogShortName = BlogShortNameMap[post.BlogId]; diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css index 4c5167a694..668e566cba 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.css @@ -1,3 +1,6 @@ .post-desc { overflow-wrap: break-word; -} \ No newline at end of file +} +a:not(#all-posts-tab,#edit-profile-tab) { + color: unset!important; +} diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js new file mode 100644 index 0000000000..6cafed0455 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Members/Index.js @@ -0,0 +1,9 @@ +$(function () { + if (window.location.hash === '#edit-profile'){ + $('#all-posts-tab').removeClass('active'); + $('#all-posts').removeClass('show').removeClass('active'); + $('#edit-profile-tab').addClass('active'); + $('#edit-profile').addClass('show').addClass('active'); + window.location.hash = ''; + } +}); diff --git a/modules/openiddict/app/OpenIddict.Demo.Server/ExtensionGrants/MyTokenExtensionGrant.cs b/modules/openiddict/app/OpenIddict.Demo.Server/ExtensionGrants/MyTokenExtensionGrant.cs index 62e4cba0b3..b5167621ef 100644 --- a/modules/openiddict/app/OpenIddict.Demo.Server/ExtensionGrants/MyTokenExtensionGrant.cs +++ b/modules/openiddict/app/OpenIddict.Demo.Server/ExtensionGrants/MyTokenExtensionGrant.cs @@ -78,7 +78,7 @@ public class MyTokenExtensionGrant : ITokenExtensionGrant var claimsPrincipal = await userClaimsPrincipalFactory.CreateAsync(user); claimsPrincipal.SetScopes(principal.GetScopes()); claimsPrincipal.SetResources(await GetResourcesAsync(context, principal.GetScopes())); - await context.HttpContext.RequestServices.GetRequiredService().SetAsync(principal); + await context.HttpContext.RequestServices.GetRequiredService().HandleAsync(context.Request, principal); return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, claimsPrincipal); } diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs index 3ee5dbf126..23f41900b5 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs @@ -22,9 +22,9 @@ public class AbpOpenIddictAspNetCoreModule : AbpModule { AddOpenIddictServer(context.Services); - Configure(options => + Configure(options => { - options.ClaimDestinationsProvider.Add(); + options.ClaimsPrincipalHandlers.Add(); }); Configure(options => diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsManager.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsManager.cs deleted file mode 100644 index 2974f8ba1d..0000000000 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsManager.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Linq; -using System.Security.Claims; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.OpenIddict; - -public class AbpOpenIddictClaimDestinationsManager : ISingletonDependency -{ - protected IServiceScopeFactory ServiceScopeFactory { get; } - protected IOptions Options { get; } - - public AbpOpenIddictClaimDestinationsManager(IServiceScopeFactory serviceScopeFactory, IOptions options) - { - ServiceScopeFactory = serviceScopeFactory; - Options = options; - } - - public virtual async Task SetAsync(ClaimsPrincipal principal) - { - using (var scope = ServiceScopeFactory.CreateScope()) - { - foreach (var providerType in Options.Value.ClaimDestinationsProvider) - { - var provider = (IAbpOpenIddictClaimDestinationsProvider)scope.ServiceProvider.GetRequiredService(providerType); - await provider.SetDestinationsAsync(new AbpOpenIddictClaimDestinationsProviderContext(scope.ServiceProvider, principal, principal.Claims.ToArray())); - } - } - } -} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsOptions.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsOptions.cs deleted file mode 100644 index e6094dbc03..0000000000 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsOptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.Collections; - -namespace Volo.Abp.OpenIddict; - -public class AbpOpenIddictClaimDestinationsOptions -{ - public ITypeList ClaimDestinationsProvider { get; } - - public AbpOpenIddictClaimDestinationsOptions() - { - ClaimDestinationsProvider = new TypeList(); - } -} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsProviderContext.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsProviderContext.cs deleted file mode 100644 index ff5d993e95..0000000000 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpOpenIddictClaimDestinationsProviderContext.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Security.Claims; - -namespace Volo.Abp.OpenIddict; - -public class AbpOpenIddictClaimDestinationsProviderContext -{ - public IServiceProvider ScopeServiceProvider { get; } - - public ClaimsPrincipal Principal{ get;} - - public Claim[] Claims { get; } - - public AbpOpenIddictClaimDestinationsProviderContext(IServiceProvider scopeServiceProvider, ClaimsPrincipal principal, Claim[] claims) - { - ScopeServiceProvider = scopeServiceProvider; - Principal = principal; - Claims = claims; - } -} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/IAbpOpenIddictClaimDestinationsProvider.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/IAbpOpenIddictClaimDestinationsProvider.cs deleted file mode 100644 index e499545163..0000000000 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/IAbpOpenIddictClaimDestinationsProvider.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Threading.Tasks; - -namespace Volo.Abp.OpenIddict; - -public interface IAbpOpenIddictClaimDestinationsProvider -{ - Task SetDestinationsAsync(AbpOpenIddictClaimDestinationsProviderContext context); -} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpDefaultOpenIddictClaimDestinationsProvider.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpDefaultOpenIddictClaimsPrincipalHandler.cs similarity index 91% rename from modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpDefaultOpenIddictClaimDestinationsProvider.cs rename to modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpDefaultOpenIddictClaimsPrincipalHandler.cs index b200dfc4a4..7a5b3d2835 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ClaimDestinations/AbpDefaultOpenIddictClaimDestinationsProvider.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpDefaultOpenIddictClaimsPrincipalHandler.cs @@ -9,16 +9,16 @@ using Volo.Abp.Security.Claims; namespace Volo.Abp.OpenIddict; -public class AbpDefaultOpenIddictClaimDestinationsProvider : IAbpOpenIddictClaimDestinationsProvider, ITransientDependency +public class AbpDefaultOpenIddictClaimsPrincipalHandler : IAbpOpenIddictClaimsPrincipalHandler, ITransientDependency { - public virtual Task SetDestinationsAsync(AbpOpenIddictClaimDestinationsProviderContext context) + public virtual Task HandleAsync(AbpOpenIddictClaimsPrincipalHandlerContext context) { var securityStampClaimType = context .ScopeServiceProvider .GetRequiredService>().Value .ClaimsIdentity.SecurityStampClaimType; - foreach (var claim in context.Claims) + foreach (var claim in context.Principal.Claims) { if (claim.Type == AbpClaimTypes.TenantId) { diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalHandlerContext.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalHandlerContext.cs new file mode 100644 index 0000000000..314f3a63ed --- /dev/null +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalHandlerContext.cs @@ -0,0 +1,21 @@ +using System; +using System.Security.Claims; +using OpenIddict.Abstractions; + +namespace Volo.Abp.OpenIddict; + +public class AbpOpenIddictClaimsPrincipalHandlerContext +{ + public IServiceProvider ScopeServiceProvider { get; } + + public OpenIddictRequest OpenIddictRequest { get; } + + public ClaimsPrincipal Principal { get;} + + public AbpOpenIddictClaimsPrincipalHandlerContext(IServiceProvider scopeServiceProvider, OpenIddictRequest openIddictRequest, ClaimsPrincipal principal) + { + ScopeServiceProvider = scopeServiceProvider; + OpenIddictRequest = openIddictRequest; + Principal = principal; + } +} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalManager.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalManager.cs new file mode 100644 index 0000000000..fa72e6c6bd --- /dev/null +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalManager.cs @@ -0,0 +1,32 @@ +using System.Security.Claims; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using OpenIddict.Abstractions; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.OpenIddict; + +public class AbpOpenIddictClaimsPrincipalManager : ISingletonDependency +{ + protected IServiceScopeFactory ServiceScopeFactory { get; } + protected IOptions Options { get; } + + public AbpOpenIddictClaimsPrincipalManager(IServiceScopeFactory serviceScopeFactory, IOptions options) + { + ServiceScopeFactory = serviceScopeFactory; + Options = options; + } + + public virtual async Task HandleAsync(OpenIddictRequest openIddictRequest, ClaimsPrincipal principal) + { + using (var scope = ServiceScopeFactory.CreateScope()) + { + foreach (var providerType in Options.Value.ClaimsPrincipalHandlers) + { + var provider = (IAbpOpenIddictClaimsPrincipalHandler)scope.ServiceProvider.GetRequiredService(providerType); + await provider.HandleAsync(new AbpOpenIddictClaimsPrincipalHandlerContext(scope.ServiceProvider, openIddictRequest, principal)); + } + } + } +} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalOptions.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalOptions.cs new file mode 100644 index 0000000000..b8931f6f41 --- /dev/null +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpOpenIddictClaimsPrincipalOptions.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Collections; + +namespace Volo.Abp.OpenIddict; + +public class AbpOpenIddictClaimsPrincipalOptions +{ + public ITypeList ClaimsPrincipalHandlers { get; } + + public AbpOpenIddictClaimsPrincipalOptions() + { + ClaimsPrincipalHandlers = new TypeList(); + } +} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/IAbpOpenIddictClaimsPrincipalHandler.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/IAbpOpenIddictClaimsPrincipalHandler.cs new file mode 100644 index 0000000000..3e2752e819 --- /dev/null +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/IAbpOpenIddictClaimsPrincipalHandler.cs @@ -0,0 +1,8 @@ +using System.Threading.Tasks; + +namespace Volo.Abp.OpenIddict; + +public interface IAbpOpenIddictClaimsPrincipalHandler +{ + Task HandleAsync(AbpOpenIddictClaimsPrincipalHandlerContext context); +} diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AbpOpenIdDictControllerBase.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AbpOpenIdDictControllerBase.cs index d1321ad9e1..7e8f6386b9 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AbpOpenIdDictControllerBase.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AbpOpenIdDictControllerBase.cs @@ -25,7 +25,7 @@ public abstract class AbpOpenIdDictControllerBase : AbpController protected IOpenIddictAuthorizationManager AuthorizationManager => LazyServiceProvider.LazyGetRequiredService(); protected IOpenIddictScopeManager ScopeManager => LazyServiceProvider.LazyGetRequiredService(); protected IOpenIddictTokenManager TokenManager => LazyServiceProvider.LazyGetRequiredService(); - protected AbpOpenIddictClaimDestinationsManager OpenIddictClaimDestinationsManager => LazyServiceProvider.LazyGetRequiredService(); + protected AbpOpenIddictClaimsPrincipalManager OpenIddictClaimsPrincipalManager => LazyServiceProvider.LazyGetRequiredService(); protected AbpOpenIdDictControllerBase() { @@ -55,11 +55,6 @@ public abstract class AbpOpenIdDictControllerBase : AbpController return resources; } - protected virtual async Task SetClaimsDestinationsAsync(ClaimsPrincipal principal) - { - await OpenIddictClaimDestinationsManager.SetAsync(principal); - } - protected virtual async Task HasFormValueAsync(string name) { if (Request.HasFormContentType) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AuthorizeController.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AuthorizeController.cs index ec764ab242..961252aae7 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AuthorizeController.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/AuthorizeController.cs @@ -132,7 +132,7 @@ public class AuthorizeController : AbpOpenIdDictControllerBase principal.SetAuthorizationId(await AuthorizationManager.GetIdAsync(authorization)); - await SetClaimsDestinationsAsync(principal); + await OpenIddictClaimsPrincipalManager.HandleAsync(request, principal); return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); @@ -227,7 +227,7 @@ public class AuthorizeController : AbpOpenIdDictControllerBase principal.SetScopes(request.GetScopes()); principal.SetResources(await GetResourcesAsync(request.GetScopes())); - await SetClaimsDestinationsAsync(principal); + await OpenIddictClaimsPrincipalManager.HandleAsync(request, principal); // Returning a SignInResult will ask OpenIddict to issue the appropriate access/identity tokens. return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.AuthorizationCode.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.AuthorizationCode.cs index 89a00f1a8a..58812f8111 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.AuthorizationCode.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.AuthorizationCode.cs @@ -44,7 +44,7 @@ public partial class TokenController })); } - await SetClaimsDestinationsAsync(principal); + await OpenIddictClaimsPrincipalManager.HandleAsync(request, principal); // Returning a SignInResult will ask OpenIddict to issue the appropriate access/identity tokens. return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.DeviceCode.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.DeviceCode.cs index cbe021854c..a581dbcf7b 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.DeviceCode.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.DeviceCode.cs @@ -44,7 +44,7 @@ public partial class TokenController })); } - await SetClaimsDestinationsAsync(principal); + await OpenIddictClaimsPrincipalManager.HandleAsync(request, principal); // Returning a SignInResult will ask OpenIddict to issue the appropriate access/identity tokens. return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs index dd9d46b2de..a91745b519 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs @@ -323,7 +323,7 @@ public partial class TokenController principal.SetScopes(request.GetScopes()); principal.SetResources(await GetResourcesAsync(request.GetScopes())); - await SetClaimsDestinationsAsync(principal); + await OpenIddictClaimsPrincipalManager.HandleAsync(request, principal); await IdentitySecurityLogManager.SaveAsync( new IdentitySecurityLogContext diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.RefreshToken.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.RefreshToken.cs index c234ddd62e..e13cd3c595 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.RefreshToken.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.RefreshToken.cs @@ -44,7 +44,7 @@ public partial class TokenController })); } - await SetClaimsDestinationsAsync(principal); + await OpenIddictClaimsPrincipalManager.HandleAsync(request, principal); // Returning a SignInResult will ask OpenIddict to issue the appropriate access/identity tokens. return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs index 66e2d2f4e8..8466c8d30e 100644 --- a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs +++ b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs @@ -1,9 +1,10 @@ using System; using JetBrains.Annotations; +using Volo.Abp.Data; namespace Volo.Abp.Users; -public interface IUserData +public interface IUserData : IHasExtraProperties { Guid Id { get; } diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs index dbe0c7ab44..e08d6fbaf0 100644 --- a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs +++ b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs @@ -1,5 +1,8 @@ using System; +using System.Collections.Generic; using JetBrains.Annotations; +using Volo.Abp.Data; +using Volo.Abp.ObjectExtending; namespace Volo.Abp.Users; @@ -24,6 +27,8 @@ public class UserData : IUserData public string PhoneNumber { get; set; } public bool PhoneNumberConfirmed { get; set; } + + public ExtraPropertyDictionary ExtraProperties { get; } public UserData() { @@ -42,6 +47,7 @@ public class UserData : IUserData PhoneNumber = userData.PhoneNumber; PhoneNumberConfirmed = userData.PhoneNumberConfirmed; TenantId = userData.TenantId; + ExtraProperties = userData.ExtraProperties; } public UserData( @@ -54,7 +60,8 @@ public class UserData : IUserData [CanBeNull] string phoneNumber = null, bool phoneNumberConfirmed = false, Guid? tenantId = null, - bool isActive = true) + bool isActive = true, + ExtraPropertyDictionary extraProperties = null) { Id = id; UserName = userName; @@ -66,5 +73,6 @@ public class UserData : IUserData PhoneNumber = phoneNumber; PhoneNumberConfirmed = phoneNumberConfirmed; TenantId = tenantId; + ExtraProperties = extraProperties; } } diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserEto.cs b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserEto.cs index e99befa225..663540169b 100644 --- a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserEto.cs +++ b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserEto.cs @@ -6,7 +6,7 @@ using Volo.Abp.MultiTenancy; namespace Volo.Abp.Users; [EventName("Volo.Abp.Users.User")] -public class UserEto : IUserData, IHasExtraProperties, IMultiTenant +public class UserEto : IUserData, IMultiTenant { public Guid Id { get; set; } diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs index 5bace83c1b..d026509dba 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs @@ -14,7 +14,8 @@ public static class AbpUserExtensions emailConfirmed: user.EmailConfirmed, phoneNumber: user.PhoneNumber, phoneNumberConfirmed: user.PhoneNumberConfirmed, - tenantId: user.TenantId + tenantId: user.TenantId, + extraProperties: user.ExtraProperties ); } } diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs index 5fca8c32dc..689e60c242 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs @@ -1,11 +1,12 @@ using System; using JetBrains.Annotations; +using Volo.Abp.Data; using Volo.Abp.Domain.Entities; using Volo.Abp.MultiTenancy; namespace Volo.Abp.Users; -public interface IUser : IAggregateRoot, IMultiTenant +public interface IUser : IAggregateRoot, IMultiTenant, IHasExtraProperties { string UserName { get; } diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 27e0d13b5f..ff3721ce50 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -117,6 +117,7 @@ "perfect-scrollbar": "^1.5.5", "postcss": "^8.3.9", "postcss-import": "14.1.0", + "perfect-scrollbar": "^1.5.5", "postcss-preset-env": "7.5.0", "postcss-url": "10.1.3", "prettier": "2.7.1", @@ -128,8 +129,10 @@ "ts-toolbelt": "6.15.4", "tslib": "^2.3.0", "tslint": "~6.1.0", - "typescript": "4.8.4", - "zone.js": "0.11.4" + "typescript": "~4.8.4", + "zone.js": "0.11.4", + "@abp/ng.theme.lepton-x": "^2.2.0", + "bootstrap-icons": "^1.10.3" }, "lint-staged": { "**/*.{js,jsx,ts,tsx,html,css,scss}": [ diff --git a/npm/ng-packs/packages/identity/ng-package.json b/npm/ng-packs/packages/identity/ng-package.json index a0824f39e5..68f95303e4 100644 --- a/npm/ng-packs/packages/identity/ng-package.json +++ b/npm/ng-packs/packages/identity/ng-package.json @@ -6,6 +6,7 @@ }, "allowedNonPeerDependencies": [ "@abp/ng.theme.shared", - "@abp/ng.permission-management" + "@abp/ng.permission-management", + "@abp/ng.components" ] } diff --git a/npm/ng-packs/packages/schematics/package.json b/npm/ng-packs/packages/schematics/package.json index c5d270674c..21d3f4264e 100644 --- a/npm/ng-packs/packages/schematics/package.json +++ b/npm/ng-packs/packages/schematics/package.json @@ -15,7 +15,7 @@ "got": "^11.5.2", "jsonc-parser": "^2.3.0", "should-quote": "^1.0.0", - "typescript": "4.8.4" + "typescript": "~4.8.4" }, "devDependencies": { "@schematics/angular": "~14.2.1", diff --git a/npm/ng-packs/packages/schematics/src/constants/volo.ts b/npm/ng-packs/packages/schematics/src/constants/volo.ts index d45a4b9e72..f42f4ed196 100644 --- a/npm/ng-packs/packages/schematics/src/constants/volo.ts +++ b/npm/ng-packs/packages/schematics/src/constants/volo.ts @@ -1,2 +1,5 @@ export const VOLO_REGEX = /^Volo\.Abp\.(Application\.Dtos|ObjectExtending)/; -export const VOLO_REMOTE_STREAM_CONTENT = 'Volo.Abp.Content.IRemoteStreamContent' +export const VOLO_REMOTE_STREAM_CONTENT = [ + 'Volo.Abp.Content.IRemoteStreamContent', + 'Volo.Abp.Content.RemoteStreamContent', +]; diff --git a/npm/ng-packs/packages/schematics/src/enums/binding-source-id.ts b/npm/ng-packs/packages/schematics/src/enums/binding-source-id.ts index 1e4e65c5f5..308b8dfc32 100644 --- a/npm/ng-packs/packages/schematics/src/enums/binding-source-id.ts +++ b/npm/ng-packs/packages/schematics/src/enums/binding-source-id.ts @@ -3,4 +3,5 @@ export enum eBindingSourceId { Model = 'ModelBinding', Path = 'Path', Query = 'Query', + FormFile = 'FormFile', } diff --git a/npm/ng-packs/packages/schematics/src/models/method.ts b/npm/ng-packs/packages/schematics/src/models/method.ts index 6e86853ec0..043df6d458 100644 --- a/npm/ng-packs/packages/schematics/src/models/method.ts +++ b/npm/ng-packs/packages/schematics/src/models/method.ts @@ -59,6 +59,7 @@ export class Body { case eBindingSourceId.Query: this.params.push(paramName === value ? value : `${getParamName(paramName)}: ${value}`); break; + case eBindingSourceId.FormFile: case eBindingSourceId.Body: this.body = value; break; @@ -78,7 +79,7 @@ export class Body { } isBlobMethod() { - return this.responseTypeWithNamespace === VOLO_REMOTE_STREAM_CONTENT; + return VOLO_REMOTE_STREAM_CONTENT.some(x => x === this.responseTypeWithNamespace); } private setUrlQuotes() { diff --git a/npm/ng-packs/packages/schematics/src/utils/angular/latest-versions/package.json b/npm/ng-packs/packages/schematics/src/utils/angular/latest-versions/package.json index c04d111f07..600b1c9fc1 100644 --- a/npm/ng-packs/packages/schematics/src/utils/angular/latest-versions/package.json +++ b/npm/ng-packs/packages/schematics/src/utils/angular/latest-versions/package.json @@ -17,7 +17,7 @@ "rxjs": "~7.5.0", "tslib": "^2.3.0", "ts-node": "~10.9.0", - "typescript": "~4.8.2", + "typescript": "~4.8.4", "zone.js": "~0.12.0" } } diff --git a/npm/ng-packs/packages/schematics/src/utils/methods.ts b/npm/ng-packs/packages/schematics/src/utils/methods.ts index 97ed8ce6c7..6767adf540 100644 --- a/npm/ng-packs/packages/schematics/src/utils/methods.ts +++ b/npm/ng-packs/packages/schematics/src/utils/methods.ts @@ -1,4 +1,5 @@ import { camel } from './text'; + // eslint-disable-next-line @typescript-eslint/no-var-requires const shouldQuote = require('should-quote'); export const getParamName = (paramName: string) => diff --git a/npm/ng-packs/packages/schematics/src/utils/service.ts b/npm/ng-packs/packages/schematics/src/utils/service.ts index 0b633a8dd5..b32dd5fba5 100644 --- a/npm/ng-packs/packages/schematics/src/utils/service.ts +++ b/npm/ng-packs/packages/schematics/src/utils/service.ts @@ -55,9 +55,12 @@ export function createControllerToServiceMapper({ function getTypesWithoutIRemoteStreamContent(types: Record) { const newType = { ...types }; - delete newType[VOLO_REMOTE_STREAM_CONTENT]; + VOLO_REMOTE_STREAM_CONTENT.forEach(fileType => { + delete newType[fileType]; + }); return newType; } + function sortMethods(methods: Method[]) { methods.sort((a, b) => (a.signature.name > b.signature.name ? 1 : -1)); } @@ -99,7 +102,13 @@ export function createActionToSignatureMapper() { ...action.parametersOnMethod, ...(versionParameter ? [versionParameter] : []), ]; + signature.parameters = parameters.map(p => { + const isFormData = isRemoteStreamContent(p.type); + const isFormArray = isRemoteStreamContentArray(p.type); + if (isFormData || isFormArray) { + return new Property({ name: p.name, type: 'FormData' }); + } const type = adaptType(p.typeSimple); const parameter = new Property({ name: p.name, type }); parameter.setDefault(p.defaultValue); @@ -112,6 +121,14 @@ export function createActionToSignatureMapper() { }; } +export function isRemoteStreamContent(type: string) { + return VOLO_REMOTE_STREAM_CONTENT.some(x => x === type); +} + +export function isRemoteStreamContentArray(type: string) { + return VOLO_REMOTE_STREAM_CONTENT.map(x => `${x}[]`).some(x => x === type); +} + function getMethodNameFromAction(action: Action): string { return action.uniqueName.split('Async')[0]; } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts index 991383fe5a..8aa68a2047 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts @@ -36,7 +36,6 @@ export class FormInputComponent extends AbstractNgModelComponent { @Input() label = ''; @Input() labelClass = 'form-label'; @Input() inputPlaceholder = ''; - @Input() inputType = 'text'; @Input() inputStyle: | { [klass: string]: any; diff --git a/npm/ng-packs/scripts/package.json b/npm/ng-packs/scripts/package.json index 92cb001545..c187b58d44 100644 --- a/npm/ng-packs/scripts/package.json +++ b/npm/ng-packs/scripts/package.json @@ -27,6 +27,6 @@ "esm": "^3.2.25", "ts-node": "^10.9.1", "tsconfig-paths": "^3.9.0", - "typescript": "4.7.4" + "typescript": "~4.8.4" } } diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index a9594343db..bf3cf46bad 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -164,6 +164,7 @@ $projects = ( "framework/src/Volo.Abp.Ddd.Application", "framework/src/Volo.Abp.Ddd.Application.Contracts", "framework/src/Volo.Abp.Ddd.Domain", + "framework/src/Volo.Abp.Ddd.Domain.Shared", "framework/src/Volo.Abp.DistributedLocking.Abstractions", "framework/src/Volo.Abp.DistributedLocking", "framework/src/Volo.Abp.DistributedLocking.Dapr", diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj index 6ad1317813..2c65ca90c5 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj @@ -10,6 +10,7 @@ + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs index 26e8c12d42..5c0c1cae56 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs @@ -1,6 +1,7 @@ using Volo.Abp.Modularity; using Volo.Abp.Localization; using MyCompanyName.MyProjectName.Localization; +using Volo.Abp.Domain; using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Validation; using Volo.Abp.Validation.Localization; @@ -9,7 +10,8 @@ using Volo.Abp.VirtualFileSystem; namespace MyCompanyName.MyProjectName; [DependsOn( - typeof(AbpValidationModule) + typeof(AbpValidationModule), + typeof(AbpDddDomainSharedModule) )] public class MyProjectNameDomainSharedModule : AbpModule {