diff --git a/.github/workflows/auto-pr.yml b/.github/workflows/auto-pr.yml index 987a3ada1b..be8ad519d4 100644 --- a/.github/workflows/auto-pr.yml +++ b/.github/workflows/auto-pr.yml @@ -4,7 +4,7 @@ on: branches: - rel-4.2 jobs: - merge-dev-with-rel: + merge-dev-with-rel-4-2: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -12,8 +12,8 @@ jobs: ref: dev - name: Reset promotion branch run: | - git fetch origin $GITHUB_REF:$GITHUB_REF - git reset --hard $GITHUB_REF + git fetch origin rel-4.2:rel-4.2 + git reset --hard rel-4.2 - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index c190a91470..a292da5f9b 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -198,6 +198,21 @@ "Language": "Language", "Optional": "Optional", "CreateArticleLanguageInfo": "The language in which the post is written", - "Enum:ContentSource:2": "Video Post" + "Enum:ContentSource:2": "Video Post", + "VideoPreview": "Video Preview", + "VideoPreviewErrorMessage": "Given video url couldn't retrieve from Youtube. This can be caused by either video is private or the given URL is not available.", + "DeleteCoverImage": "Delete Cover Image", + "DeleteCoverImageConfirmationMessage": "Are you sure you want to delete the cover image for \"{0}\"?", + "DeleteCoverImageSuccessMessage": "Cover image successfully deleted", + "PaymentsOf": "Payments of", + "ShowPaymentsOfOrganization": "Show payments", + "Date": "Date", + "Products": "Products", + "TotalAmount": "Total amount", + "Currency": "Currency", + "Gateway": "Gateway", + "State": "State", + "FailReason": "Fail reason" + } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json index 9ac7e39b9e..1884b0025f 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json @@ -159,6 +159,10 @@ "UnlimitedQuestionCount": "Sınırsız soru sayısı", "Language": "Dil", "Optional": "Opsiyonel", - "CreateArticleLanguageInfo": "Makalenin yazıldığı dil" + "CreateArticleLanguageInfo": "Makalenin yazıldığı dil", + "Enum:ContentSource:2": "Video İçerik", + "DeleteCoverImage": "Kapak Fotoğrafını Sil", + "DeleteCoverImageConfirmationMessage": "Kapak fotoğrafını \"{0}\" isimli makale için silmek istediğinize emin misiniz?", + "DeleteCoverImageSuccessMessage": "Kapak fotoğrafı başarılı bir şekilde silinmiştir" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index c6eb1ad645..4de287778f 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -34,6 +34,13 @@ "JoinOurMarketingNewsletter": "Join our marketing newsletter", "WouldLikeToReceiveMarketingMaterials": "I would like to receive marketing materials like product deals & special offers.", "StartUsingYourLicenseNow": "Start using your license now!", - "WelcomePage": "Welcome Page" + "WelcomePage": "Welcome Page", + "UnsubscriptionExpireEmail": "Unsubscribe from license expire date reminder emails", + "UnsubscribeLicenseExpireEmailReminderMessage": "This email subscription only contains reminding your license expiration date.", + "UnsubscribeFromLicenseExpireEmails": "If you don't want to receive the emails about your license expiration date, you can unsubscribe at any time you want.", + "Unsubscribe": "Unsubscribe", + "NotOrganizationMember": "You are not member of any organization.", + "UnsubscribeLicenseExpirationEmailSuccessTitle": "Successfully unsubscribed", + "UnsubscribeLicenseExpirationEmailSuccessMessage": "You will not receive license expiration date reminder emails anymore." } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json index 8b5fa2014e..9c1e434ac1 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json @@ -34,8 +34,8 @@ "MyOrganizations": "My organizations", "EmailNotValid": "Please enter a valid email address.", "FeatureRequest": "Feature Request", - "CreateArticleTitleInfo": "Title of the article to be shown on the article list.", - "CreateArticleSummaryInfo": "A short summary of the article to be shown on the article list.", + "CreateArticleTitleInfo": "Title of the post to be shown on the post list.", + "CreateArticleSummaryInfo": "A short summary of the post to be shown on the post list.", "CreateArticleCoverInfo": "For creating an effective article, add a cover photo. Upload 16:9 aspect ratio pictures for the best view. Maximum file size: 1MB.", "ThisExtensionIsNotAllowed": "This extension is not allowed.", "TheFileIsTooLarge": "The file is too large.", @@ -100,17 +100,42 @@ "ArticleRequestMessageTitle": "Open an issue on the GitHub to request an article/tutorial you want to see on this web site.", "ArticleRequestMessageBody": "Here, the list of the requested articles by the community. Do you want to write a requested article? Please click to the request and join to the discussion.", "Language": "Language", - "CreateArticleLanguageInfo": "The language in which the article is written", + "CreateArticleLanguageInfo": "The language for the post content.", "VideoPost": "Video Post", "Article": "Article", "Read": "Read", "CreateGithubArticleUrlInfo": "Original GitHub URL of the article.", - "CreateVideoContentUrlInfo": "Original Youtube URL of the article.", + "CreateVideoContentUrlInfo": "Original Youtube URL of the post.", "CreateExternalArticleUrlInfo": "Original External Url of the article.", - "VideoContentForm": "Video Content Form", - "GithubPostForm": "Github Post Form", - "ExternalPostForm": "External Post Form", - "PostSourceTypeChooses": "We accept three source types for the posts;", - "Posts": "Posts" + "VideoContentForm": "Submit Video on YouTube", + "GithubPostForm": "Submit Article on GitHub", + "ExternalPostForm": "Submit an External Content", + "HowToPost": "How to Post?", + "Posts": "Posts", + "VideoUrl": "Video Url", + "GithubArticleUrl": "Github Article Url", + "ExternalArticleUrl": "External Article Url", + "CreatePostCoverInfo": "For creating an effective post, add a cover photo. Upload 16:9 aspect ratio pictures for the best view. Maximum file size: 1MB.", + "ThankYouForContribution": "Thank you for contributing to the ABP Community.", + "GithubArticle": "Github Article", + "GithubArticleSubmitStepOne": "1. Write an article on any public GitHub repository with the Markdown format. example", + "GithubArticleSubmitStepTwo": "2. Submit your article URL using the form.", + "GithubArticleSubmitStepThree": "3. Your article will be rendered in this web site.", + "YoutubeVideo": "Youtube Video", + "YoutubeVideoSubmitStepOne": "1. Publish your video on YouTube.", + "YoutubeVideoSubmitStepTwo": "2. Submit the video URL using the form.", + "YoutubeVideoSubmitStepThree": "3. Visitors will be able to watch your video content directly on this website.", + "ExternalContent": "External Content", + "ExternalContentSubmitStepOne": "1. Create a content on any public platform (medium, your own blog or anywhere you like).", + "ExternalContentSubmitStepTwo": "2. Submit your content URL using the form.", + "ExternalContentSubmitStepThree": "3. Visitors are redirected to the content on the original website.", + "ChooseYourContentType": "Please choose the way you want to add your content.", + "PostContentViaGithub": "I want to add my article with GitHub in accordance with the markdown rules.", + "PostContentViaYoutube": "I want to share my videos available on Youtube here.", + "PostContentViaExternalSource": "I want to add the content I published on another platform here.", + "GitHubUserNameValidationMessage": "Your Github username can not include whitespace, please be sure your Github username is correct.", + "PersonalSiteUrlValidationMessage": "Your personal site URL can not include whitespace, please be sure your personal site URL is correct.", + "TwitterUserNameValidationMessage": "Your Twitter username can not include whitespace, please be sure your Twitter username is correct.", + "LinkedinUrlValidationMessage": "Your Linkedin URL can not include whitespace, please be sure your Linkedin URL is correct." } } diff --git a/common.props b/common.props index f5db446396..593fe92213 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ - latest - 4.2.0 + latest + 4.3.0 $(NoWarn);CS1591;CS0436 https://abp.io/assets/abp_nupkg.png https://abp.io/ diff --git a/docs/en/Application-Services.md b/docs/en/Application-Services.md index 7fe9825f2a..5d779ec8c9 100644 --- a/docs/en/Application-Services.md +++ b/docs/en/Application-Services.md @@ -43,12 +43,14 @@ public class Book : AggregateRoot { if (string.IsNullOrWhiteSpace(name)) { - throw new ArgumentException($"name can not be empty or white space!"); + throw new ArgumentException( + $"name can not be empty or white space!"); } if (name.Length > MaxNameLength) { - throw new ArgumentException($"name can not be longer than {MaxNameLength} chars!"); + throw new ArgumentException( + $"name can not be longer than {MaxNameLength} chars!"); } return name; @@ -349,8 +351,9 @@ public class DistrictAppService protected async override Task GetEntityByIdAsync(DistrictKey id) { + var queryable = await Repository.GetQueryableAsync(); return await AsyncQueryableExecuter.FirstOrDefaultAsync( - Repository.Where(d => d.CityId == id.CityId && d.Name == id.Name) + queryable.Where(d => d.CityId == id.CityId && d.Name == id.Name) ); } } diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index f4c2ec712b..52a2fced6a 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -184,7 +184,7 @@ public class PersonAppService : ApplicationService, IPersonAppService } ```` -ABP Framework's repository doesn't have this method. Instead, it implements the `IQueryable` itself. So, you can directly use LINQ on the repository: +ABP Framework's repository have `GetQueryableAsync` instead: ````csharp public class PersonAppService : ApplicationService, IPersonAppService @@ -198,14 +198,15 @@ public class PersonAppService : ApplicationService, IPersonAppService public async Task DoIt() { - var people = await _personRepository + var queryable = await _personRepository.GetQueryableAsync(); + var people = await queryable .Where(p => p.BirthYear > 2000) //Use LINQ extension methods .ToListAsync(); } } ```` -> Note that in order to use the async LINQ extension methods (like `ToListAsync` here), you may need to depend on the database provider (like EF Core) since these methods are defined in the database provider package, they are not standard LINQ methods. +> Note that in order to use the async LINQ extension methods (like `ToListAsync` here), you may need to depend on the database provider (like EF Core) since these methods are defined in the database provider package, they are not standard LINQ methods. See the [repository document](Repositories.md) for alternative approaches for async query execution. #### FirstOrDefault(predicate), Single()... Methods diff --git a/docs/en/Best-Practices/Entity-Framework-Core-Integration.md b/docs/en/Best-Practices/Entity-Framework-Core-Integration.md index f487f9d61d..04ddeaeba4 100644 --- a/docs/en/Best-Practices/Entity-Framework-Core-Integration.md +++ b/docs/en/Best-Practices/Entity-Framework-Core-Integration.md @@ -144,7 +144,7 @@ public virtual async Task FindByNormalizedUserNameAsync( bool includeDetails = true, CancellationToken cancellationToken = default) { - return await DbSet + return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, @@ -175,14 +175,15 @@ public static IQueryable IncludeDetails( } ```` -* **Do** use the `IncludeDetails` extension method in the repository methods just like used in the example code above (see FindByNormalizedUserNameAsync). +* **Do** use the `IncludeDetails` extension method in the repository methods just like used in the example code above (see `FindByNormalizedUserNameAsync`). - **Do** override `WithDetails` method of the repository for aggregates root which have **sub collections**. Example: ````C# -public override IQueryable WithDetails() +public override async Task> WithDetailsAsync() { - return GetQueryable().IncludeDetails(); // Uses the extension method defined above + // Uses the extension method defined above + return (await GetQueryableAsync()).IncludeDetails(); } ```` diff --git a/docs/en/Best-Practices/MongoDB-Integration.md b/docs/en/Best-Practices/MongoDB-Integration.md index 74a0e429f1..90f7871a70 100644 --- a/docs/en/Best-Practices/MongoDB-Integration.md +++ b/docs/en/Best-Practices/MongoDB-Integration.md @@ -128,7 +128,7 @@ public async Task FindByNormalizedUserNameAsync( bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable() + return await (await GetMongoQueryableAsync()) .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, GetCancellationToken(cancellationToken) @@ -139,8 +139,8 @@ public async Task FindByNormalizedUserNameAsync( `GetCancellationToken` fallbacks to the `ICancellationTokenProvider.Token` to obtain the cancellation token if it is not provided by the caller code. * **Do** ignore the `includeDetails` parameters for the repository implementation since MongoDB loads the aggregate root as a whole (including sub collections) by default. -* **Do** use the `GetMongoQueryable()` method to obtain an `IQueryable` to perform queries wherever possible. Because; - * `GetMongoQueryable()` method automatically uses the `ApplyDataFilters` method to filter the data based on the current data filters (like soft delete and multi-tenancy). +* **Do** use the `GetMongoQueryableAsync()` method to obtain an `IQueryable` to perform queries wherever possible. Because; + * `GetMongoQueryableAsync()` method automatically uses the `ApplyDataFilters` method to filter the data based on the current data filters (like soft delete and multi-tenancy). * Using `IQueryable` makes the code as much as similar to the EF Core repository implementation and easy to write and read. * **Do** implement data filtering if it is not possible to use the `GetMongoQueryable()` method. diff --git a/docs/en/Best-Practices/Repositories.md b/docs/en/Best-Practices/Repositories.md index c0058df433..4f646a7d94 100644 --- a/docs/en/Best-Practices/Repositories.md +++ b/docs/en/Best-Practices/Repositories.md @@ -42,24 +42,6 @@ Task FindByNormalizedUserNameAsync( ); ```` -* **Do** create a **synchronous extension** method for each asynchronous repository method. Example: - -````C# -public static class IdentityUserRepositoryExtensions -{ - public static IdentityUser FindByNormalizedUserName( - this IIdentityUserRepository repository, - [NotNull] string normalizedUserName) - { - return AsyncHelper.RunSync( - () => repository.FindByNormalizedUserNameAsync(normalizedUserName) - ); - } -} -```` - -This will allow synchronous code to use the repository methods easier. - * **Do** add an optional `bool includeDetails = true` parameter (default value is `true`) for every repository method which returns a **single entity**. Example: ````C# diff --git a/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/POST.md b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/POST.md new file mode 100644 index 0000000000..d16afb4244 --- /dev/null +++ b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/POST.md @@ -0,0 +1,241 @@ +# ABP Framework 4.2 RC Has Been Published + +Today, we have released the [ABP Framework](https://abp.io/) and the [ABP Commercial](https://commercial.abp.io/) 4.2.0 RC (Release Candidate). This blog post introduces the new features and important changes in this new version. + +> **The planned release date for the [4.2.0 final](https://github.com/abpframework/abp/milestone/48) version is January 28, 2021**. + +## Get Started with the 4.2 RC + +If you want to try the version `4.2.0` today, follow the steps below; + +1) **Upgrade** the ABP CLI to the version `4.2.0-rc.2` using a command line terminal: + +````bash +dotnet tool update Volo.Abp.Cli -g --version 4.2.0-rc.2 +```` + +**or install** if you haven't installed before: + +````bash +dotnet tool install Volo.Abp.Cli -g --version 4.2.0-rc.2 +```` + +2) Create a **new application** with the `--preview` option: + +````bash +abp new BookStore --preview +```` + +See the [ABP CLI documentation](https://docs.abp.io/en/abp/latest/CLI) for all the available options. + +> You can also use the *Direct Download* tab on the [Get Started](https://abp.io/get-started) page by selecting the **Preview checkbox**. + +## What's new with the ABP Framework 4.2 + +## IRepository.GetQueryableAsync() + +> **This version comes with an important change about using `IQueryable` features over the [repositories](https://docs.abp.io/en/abp/4.2/Repositories). It is suggested to read this section carefully and apply in your applications.** + +`IRepository` interface inherits `IQueryable`, so you can directly use the standard LINQ extension methods, like `Where`, `OrderBy`, `First`, `Sum`... etc. + +**Example: Using LINQ directly over the repository object** + +````csharp +public class BookAppService : ApplicationService, IBookAppService +{ + private readonly IRepository _bookRepository; + + public BookAppService(IRepository bookRepository) + { + _bookRepository = bookRepository; + } + + public async Task DoItInOldWayAsync() + { + //Apply any standard LINQ extension method + var query = _bookRepository + .Where(x => x.Price > 10) + .OrderBy(x => x.Name); + + //Execute the query asynchronously + var books = await AsyncExecuter.ToListAsync(query); + } +} +```` + +*See [the documentation](https://docs.abp.io/en/abp/4.2/Repositories#iqueryable-async-operations) if you wonder what is the `AsyncExecuter`.* + +Beginning from the version 4.2, the recommended way is using `IRepository.GetQueryableAsync()` to obtain an `IQueryable`, then use the LINQ extension methods over it. + +**Example: Using the new GetQueryableAsync method** + +````csharp +public async Task DoItInNewWayAsync() +{ + //Use GetQueryableAsync to obtain the IQueryable first + var queryable = await _bookRepository.GetQueryableAsync(); + + //Then apply any standard LINQ extension method + var query = queryable + .Where(x => x.Price > 10) + .OrderBy(x => x.Name); + + //Finally, execute the query asynchronously + var books = await AsyncExecuter.ToListAsync(query); +} +```` + +ABP may start a database transaction when you get an `IQueryable` (If current [Unit Of Work](https://docs.abp.io/en/abp/latest/Unit-Of-Work) is transactional). In this new way, it is possible to **start the database transaction in an asynchronous way**. Previously, we could not get the advantage of asynchronous while starting the transactions. + +> **The new way has a significant performance and scalability gain. The old usage (directly using LINQ over the repositories) will be removed in the next major version.** You have a lot of time for the change, but we recommend to immediately take the action since the old usage has a big scalability problem. + +#### About IRepository Async Extension Methods + +Using IRepository Async Extension Methods has no such a problem. The examples below are pretty fine: + +````csharp +var countAll = await _personRepository + .CountAsync(); + +var count = await _personRepository + .CountAsync(x => x.Name.StartsWith("A")); + +var book1984 = await _bookRepository + .FirstOrDefaultAsync(x => x.Name == "John"); +```` + +See the [repository documentation](https://docs.abp.io/en/abp/4.2/Repositories#iqueryable-async-operations) to understand the relation between `IQueryable` and asynchronous operations. + +### Repository Bulk Operations + +This version adds the following methods to the repositories: + +* `InsertManyAsync` +* `UpdateManyAsync` +* `DeleteManyAsync` + +The purpose of these methods to insert, update or delete many entities in one call with a better performance. + +Currently, **MongoDB** provider implements these methods as a single bulk operation since MongoDB API natively supports. But current **Entity Framework Core** implementation is not a real bulk operation. Instead, it does its best with the native API of the EF Core. If you want to implement in a more performant way, you can [customize the bulk operations](https://docs.abp.io/en/abp/4.2/Entity-Framework-Core#customize-bulk-operations) with your own implementation or by using a library. We could find a good open source library for EF Core 5.0 to implement it. + +### Selecting DBMS on Template Creation + +[ABP CLI](https://docs.abp.io/en/abp/4.2/CLI#new) now has an option to specify the DBMS when you use EF Core as the database provider. + +**Example: Select MySQL as the DBMS** + +````bash +abp new BookStore -dbms mysql --preview +```` + +Available options: `SqlServer` (default), `MySQL`, `SQLite`, `Oracle-Devart`, `PostgreSQL`. See the [documentation](https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Other-DBMS) to use any other DBMS or switch the DBMS later. + +One change related to this feature is that: Now, the startup template doesn't come with an **initial migration** file. This is because the database migrations are different based on your DBMS preference and should be re-created. However, when you first run the `.DbMigrator` application, it will create the initial migration and create the database just like before. + +> See The Initial Migration section in the [Getting Started](https://docs.abp.io/en/abp/4.2/Getting-Started-Running-Solution?DB=EF#database-migrations) document if you have problems on running the `.DbMigrator` application first time. + +### Swagger UI Login / Authorization + +Testing the swagger UI was requiring some additional work, especially your authentication server is separated from the application that hosts the Swagger UI. + +With the version 4.2, the startup templates come with the authorization pre-configured for you. An Authorize button is available when you open the Swagger UI: + +![swagger-authorize](swagger-authorize.png) + +When you click, it opens a modal to authorize: + +![swagger-authorize](swagger-authorize-modal.png) + +When you click to the Authorize button here, you are redirected to the login page to login with your username and password (default username is `admin` and password is `1q2w3E*`). + +> Remember to select the Scopes (typically **select all**) you want to use before clicking to the Authorize button. + +### Angular Unit Testing + +We've improved the modules and the startup template to setup and write unit tests easier with the Angular UI. See the [Angular Unit Testing document](https://docs.abp.io/en/abp/4.2/UI/Angular/Testing) for details. + +### Other News + +* Improved HTTP **request-response performance** by resolving dependencies in a deferred way in the action/page filters, interceptors and some other services. +* Removed `MultipleActiveResultSets` from connection strings for new templates for SQL Server, since the new EF Core gives a warning when using it. If you want to use it, you need to change the connection string yourself. +* Added `HardDeleteAsync` extension method that takes a predicate to delete multiple entities. This extension method is available if the entity [Soft Delete](https://docs.abp.io/en/abp/latest/Data-Filtering). +* Implemented the [Page Alerts](https://docs.abp.io/en/abp/4.2/UI/Angular/Page-Alerts) for the **Angular UI**. +* Implemented [Page Progress](https://docs.abp.io/en/abp/4.2/UI/Blazor/Page-Progress) for the **Blazor UI**. It automatically shows an undetermined progress bar on top of the page while performing an AJAX request. It also proves an API to you if you need to show/hide the progress bar in your code. + +## What's new with the ABP Commercial 4.2 + +### Microservice Startup Template + +The new [Microservice Startup Template](https://docs.abp.io/en/commercial/4.2/startup-templates/microservice/index) is a generic solution to start a new microservice solution. + +While we accept that every microservice solution will be different and every system has its own design requirements and trade-offs, we believe such a startup solution is a very useful starting point for most of the solutions, and a useful example for others. + +![microservice-template-diagram](microservice-template-diagram.png) + +*Figure: A simplified overall diagram of the microservice solution.* + +You can [follow the documentation](https://docs.abp.io/en/commercial/4.2/startup-templates/microservice/index) to get started with this startup template. **This template should be considered as an early release**. We will improve it and write a lot of guides. + +If you want to use the ABP Suite to create your solution, then you need to first upgrade it: + +````bash +abp suite update +```` + +If you want, you can directly create a new solution from the command line: + +````bash +abp new Volosoft.MyMicroserviceSystem -t microservice-pro --preview +```` + +Company Name is optional. Solution name could be *MyMicroserviceSystem* for this example. + +### Public Website in the Startup Templates + +As mentioned in the previous release post, we've added a *Public Website* application to the startup templates. It is configured to authenticate through the IdentityServer with a single sign-on system. + +You can use this application to create a landing page for your actual application or a corporate website for your business. An example screenshot: + +![public-website](public-website.jpg) + +It uses the same *Lepton Theme*, so you can apply [all the styles](https://commercial.abp.io/themes). The Public Website has a different layout and also has a different setting for the styling (that can be configured in the *Settings / Lepton Theme* page of the main web application). + +> *Public Website* is optional and you need to select the "Public Website" option while creating a new solution using the ABP Suite, or use the `--with-public-website` option while using the `abp new` CLI command. + +### Easy CRM Blazor UI + +[Easy CRM](https://docs.abp.io/en/commercial/latest/samples/easy-crm) is an example application built with the ABP Commercial. MVC (Razor Pages) and Angular UI implementations were already provided. With the version 4.2, we are providing the Blazor UI implementation for this application. + +![easy-crm](easy-crm.png) + +### Other News + +* Implemented Iyzico as a payment gateway provider for the [payment module](https://commercial.abp.io/modules/Volo.Payment) in addition to Paypal, Stripe, 2Checkout and Payu providers. +* ABP Suite supports the new microservice template creation, public website and DBMS selection options. +* Swagger authorization and other features mentioned in the ABP Framework section are already implemented for the ABP Commercial too. + +## ABP Community News + +### Sharing Video Contents + +[community.abp.io](https://community.abp.io/) is a place to share ABP related contents. It started with publishing articles. Now, it supports to publish video contents. [See this example](https://community.abp.io/articles/be-a-superhero-on-day-1-with-abp.io-wvifcy9s). All you need to do is to create a video and upload to YouTube. Then you can [submit](https://community.abp.io/articles/submit) the YouTube link to the ABP Community website. + +### Multi-language support + +We planned ABP Community to publish English-only contents. However, we see that people want to share contents in other languages too. Now, **it is possible to submit a content in any language**. Just select the Language option while submitting your content. + +**When you submit a non-English content, it is not visible to all the visitors by default**. Visitors can see a non-English content only if their browser language or the selected language matches to the content language (there is a language selection at the end of the website). + +### External Contents + +If you want to publish your content anywhere else, but want to post a link of your content, you can select *External Content* option while submitting the post. For example, [this article](https://community.abp.io/articles/aspnet-boilerplate-to-abp-framework-xml-to-json-localization-conversion-0mxyjrzj) is an external article and also written in Chinese language. + +## About the Next Release + +The next feature version will be 4.3.0. It is planned to release the 4.3 RC (Release Candidate) on March 11 and the final version on March 25, 2021. + +We decided to slow down the feature development for the [next milestone](https://github.com/abpframework/abp/milestone/49). We will continue to improve the existing features and introduce new ones, sure, but wanted to have more time for the planning, documentation, creating guides and improving the development experience. + +## Feedback + +Please check out the ABP Framework 4.2.0 RC and [provide feedback](https://github.com/abpframework/abp/issues/new) to help us to release a more stable version. **The planned release date for the [4.2.0 final](https://github.com/abpframework/abp/milestone/48) version is January 28, 2021**. diff --git a/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/easy-crm.png b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/easy-crm.png new file mode 100644 index 0000000000..02c47777a4 Binary files /dev/null and b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/easy-crm.png differ diff --git a/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/microservice-template-diagram.png b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/microservice-template-diagram.png new file mode 100644 index 0000000000..2c6df5ab74 Binary files /dev/null and b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/microservice-template-diagram.png differ diff --git a/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/public-website.jpg b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/public-website.jpg new file mode 100644 index 0000000000..b5784519bd Binary files /dev/null and b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/public-website.jpg differ diff --git a/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/swagger-authorize-modal.png b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/swagger-authorize-modal.png new file mode 100644 index 0000000000..52b43f248e Binary files /dev/null and b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/swagger-authorize-modal.png differ diff --git a/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/swagger-authorize.png b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/swagger-authorize.png new file mode 100644 index 0000000000..650a212fe5 Binary files /dev/null and b/docs/en/Blog-Posts/2021-01-14 v4_2_Preview/swagger-authorize.png differ diff --git a/docs/en/Blog-Posts/2021-01-28 v4_2_Release_Stable/POST.md b/docs/en/Blog-Posts/2021-01-28 v4_2_Release_Stable/POST.md new file mode 100644 index 0000000000..fac8484411 --- /dev/null +++ b/docs/en/Blog-Posts/2021-01-28 v4_2_Release_Stable/POST.md @@ -0,0 +1,53 @@ +# ABP.IO Platform 4.2 Final Has Been Released! + +[ABP Framework](https://abp.io/) and [ABP Commercial](https://commercial.abp.io/) 4.2 versions have been released today. + +## What's New With 4.2? + +Since all the new features are already explained in details with the [4.2 RC Announcement Post](https://blog.abp.io/abp/ABP-IO-Platform-v4-2-RC-Has-Been-Released), I will not repeat all the details again. See the [RC Blog Post](https://blog.abp.io/abp/ABP-IO-Platform-v4-2-RC-Has-Been-Released) for all the features and enhancements. + +## Creating New Solutions + +You can create a new solution with the ABP Framework version 4.2 by either using the `abp new` command or using the **direct download** tab on the [get started page](https://abp.io/get-started). + +> See the [getting started document](https://docs.abp.io/en/abp/latest/Getting-Started) for details. + +## How to Upgrade an Existing Solution + +### Install/Update the ABP CLI + +First of all, install the ABP CLI or upgrade to the latest version. + +If you haven't installed yet: + +```bash +dotnet tool install -g Volo.Abp.Cli +``` + +To update an existing installation: + +```bash +dotnet tool update -g Volo.Abp.Cli +``` + +### ABP UPDATE Command + +[ABP CLI](https://docs.abp.io/en/abp/latest/CLI) provides a handy command to update all the ABP related NuGet and NPM packages in your solution with a single command: + +```bash +abp update +``` + +Run this command in the root folder of your solution. + +## Migration Guide + +Check [the migration guide](https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-4_2) for the applications with the version 4.x upgrading to the version 4.2. + +> It is strongly recommended to check the migration guide for this version. Especially, the new `IRepository.GetQueryableAsync()` method is a core change should be considered after upgrading the solution. + +## About the Next Version + +The next feature version will be 4.3. It is planned to release the 4.3 RC (Release Candidate) on March 11 and the final version on March 25, 2021. + +We decided to slow down the feature development for the [next milestone](https://github.com/abpframework/abp/milestone/49). We will continue to improve the existing features and introduce new ones, sure, but wanted to have more time for the planning, documentation, creating guides and improving the development experience. \ No newline at end of file diff --git a/docs/en/CSRF-Anti-Forgery.md b/docs/en/CSRF-Anti-Forgery.md index 720edc5924..ee684aaa52 100644 --- a/docs/en/CSRF-Anti-Forgery.md +++ b/docs/en/CSRF-Anti-Forgery.md @@ -144,4 +144,19 @@ Let's talk about why. First, take a look at [Angular's code](https://github.com/angular/angular/blob/master/packages/common/http/src/xsrf.ts#L81) -It does not intercept any request that starts with `http://` or `https://`. There is a good reason for that. Any cross-site request does not need this token for security. This verification is only valid if the request is made to the same domain from which the web page is served. So, simply put, if you serve everything from a single domain, you just use a relative path. \ No newline at end of file +It does not intercept any request that starts with `http://` or `https://`. There is a good reason for that. Any cross-site request does not need this token for security. This verification is only valid if the request is made to the same domain from which the web page is served. So, simply put, if you serve everything from a single domain, you just use a relative path. + +If you serve your APIs from the root, i.e. no context root (https://testdomain.com/api/identity/users), leave `url` empty as follows: + +```typescript +export const environment = { + production: true, + // .... + apis: { + default: { + url: '', // <- should be empty string, not '/' + // ... + }, + }, +} as Config.Environment; +``` diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/POST.md b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/POST.md new file mode 100644 index 0000000000..f30f31d541 --- /dev/null +++ b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/POST.md @@ -0,0 +1,103 @@ +## Using MatBlazor UI Components With the ABP Framework + +Hi, in this step by step article, I will show you how to integrate [MatBlazor](https://www.matblazor.com/), a blazor UI components into ABP Framework-based applications. + +![example-result](example-result.png) + +*(A screenshot from the example application developed in this article)* + +## Create the Project + +> First thing is to create the project. ABP Framework offers startup templates to get into business faster. + +In this article, I will create a new startup template with EF Core as a database provider and Blazor for UI framework. But if you already have a project with Blazor UI, you don't need to create a new startup template, you can directly implement the following steps to your existing project. + +> If you already have a project with the Blazor UI, you can skip this section. + +* Before starting the development, we will create a new solution named `MatBlazorSample` (or whatever you want). We will create a new startup template with EF Core as a database provider and Blazor for UI framework by using [ABP CLI](https://docs.abp.io/en/abp/latest/CLI): + +````bash +abp new MatBlazorSample -u blazor +```` + +This will create new project inside of `aspnet-core`, so: + +````bash +cd aspnet-core +```` + +and + +````bash +dotnet restore +```` + +* Our project boilerplate will be ready after the download is finished. Then, we can open the solution in the Visual Studio (or any other IDE) and run the `MatBlazorSample.DbMigrator` to create the database and seed initial data (which creates the admin user, admin role, permissions etc.) + +![initial-project](initial-project.png) + +* After database and initial data created, +* Run the `MatBlazorSample.HttpApi.Host` to see our server side working and +* Run the `MatBlazorSample.Blazor` to see our UI working properly. + +> _Default login credentials for admin: username is **admin** and password is **1q2w3E\***_ + +## Install MatBlazor + +You can follow [this documentation](https://www.matblazor.com/) to install MatBlazor packages into your computer. + +### Adding MatBlazor NuGet Packages + +```bash +Install-Package MatBlazor +``` + +### Register MatBlazor Resources + +1. Add the following line to the HEAD section of the `wwwroot/index.html` file within the `MatBlazorSample.Blazor` project: + + ```Razor + + + + + + ``` + +2. In the `MatBlazorSampleBlazorModule` class, call the `AddMatBlazor()` method from your project's `ConfigureServices()` method: + + ```csharp + public override void ConfigureServices(ServiceConfigurationContext context) + { + var environment = context.Services.GetSingletonInstance(); + var builder = context.Services.GetSingletonInstance(); + // ... + builder.Services.AddMatBlazor(); + } + ``` + +3. Register the **MatBlazorSample.Blazor** namespace in the `_Imports.razor` file: + + ```Razor + @using MatBlazor + ``` + +## The Sample Application + +We have created a sample application with [Table](https://www.matblazor.com/Table) example. + +### The Source Code + +You can download the source code from [here](https://github.com/abpframework/abp-samples/tree/master/MatBlazorSample). + +The related files for this example are marked in the following screenshots. + +![table-app-contract](table-app-contract.png) + +![table-application](table-application.png) + +![table-web](table-web.png) + +## Conclusion + +In this article, I've explained how to use [MatBlazor](https://www.matblazor.com/) components in your application. ABP Framework is designed so that it can work with any UI library/framework. \ No newline at end of file diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/example-result.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/example-result.png new file mode 100644 index 0000000000..89a2fecdce Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/example-result.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/initial-project.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/initial-project.png new file mode 100644 index 0000000000..85e71d5692 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/initial-project.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-app-contract.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-app-contract.png new file mode 100644 index 0000000000..8108cdc606 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-app-contract.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-application.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-application.png new file mode 100644 index 0000000000..7f07af97e1 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-application.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-web.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-web.png new file mode 100644 index 0000000000..0034aec095 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-web.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/POST.md b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/POST.md new file mode 100644 index 0000000000..7a854291d5 --- /dev/null +++ b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/POST.md @@ -0,0 +1,343 @@ +# How to Use PrimeNG Components with the ABP Angular UI + +## Introduction + +In this article, we will use components of the [PrimeNG](https://www.primefaces.org/primeng/) that is a popular UI component library for Angular with the ABP Framework Angular UI that will be generated via [ABP CLI](https://docs.abp.io/en/abp/latest/CLI). + +We will create an organization units page and use PrimeNG's [OrganizationChart](https://primefaces.org/primeng/showcase/#/organizationchart) and [Table](https://primefaces.org/primeng/showcase/#/table) components on the page. + +![Introduction](intro.gif) + +The UI shown above contains many PrimeNG components. You can reach the source code of this rich UI. Take a look at the source code section below. + +> This article does not cover any backend code. I used mock data to provide data source to the components. + +## Pre-Requirements + +The following tools should be installed on your development machine: + +* [.NET Core 5.0+](https://www.microsoft.com/net/download/dotnet-core/) +* [Node v12 or v14](https://nodejs.org/) +* [VS Code](https://code.visualstudio.com/) or another IDE + +## Source Code + +I have prepared a sample project that contains more PrimeNG components than described in this article. You can download the source code [on GitHub](https://github.com/abpframework/abp-samples/tree/master/PrimengSample). + +## Creating a New Solution + +In this step, we will create a new solution that contains Angular UI and backend startup templates. If you have a startup template with Angular UI, you can skip this step. + +Run the following command to install the ABP CLI: + +```bash +dotnet tool install -g Volo.Abp.Cli +``` + +...or update: + +```bash +dotnet tool update -g Volo.Abp.Cli +``` + +Create a new solution named `AbpPrimengSample` by running the following command: + +```bash +abp new AbpPrimengSample -u angular -csf +``` + +See the [ABP CLI documentation](https://docs.abp.io/en/abp/latest/CLI) for all available options. + +You can also use the Direct Download tab on the [Get Started](https://abp.io/get-started) page. + +## Running the Solution + +You can run the solution as described in [here](https://docs.abp.io/en/abp/latest/Getting-Started-Running-Solution?UI=NG&DB=EF&Tiered=No). + +## PrimeNG Setup + +Open the `angular` folder and run the following command to install packages: + +```bash +npm install +``` + +Next, we need to install `primeng` and required packages (`primeicons` and `@angular/cdk`) for the library. Run the command below to install these packages: + +```bash +npm install primeng primeicons @angular/cdk --save +``` + +The packages we have installed; + + - `primeng` is the main package that is a component library. + - `primeicons` is an icon font library. Many PrimeNG components use this font internally. + - `@angular/cdk` is a component dev kit created by the Angular team. Some PrimeNG modules depend on it. + +As the last step of the setup, we should add the required style files for the library to `angular.json`: + +```js +//angular.json + +"projects": { + "AbpPrimengSample": { + //... + "styles": { + "node_modules/primeicons/primeicons.css", + "node_modules/primeng/resources/themes/saga-blue/theme.css", + "node_modules/primeng/resources/primeng.min.css", + //...other styles + } + } +} +``` + +We have added the `primeng.min.css`, Saga Blue theme's `theme.css`, and `primeicons.css` files to the project. You can choose another theme instead of the Sage Blue. See available themes on the [Get Started](https://www.primefaces.org/primeng/showcase/#/setup) document of the PrimeNG. + + +> You have to restart the running `ng serve` process to see the effect of the changes you made in the `angular.json`. + + +## Creating the Organization Units Page + +Run the following command to create a new module named `OrganizationUnits`: + +```bash +npm run ng -- generate module organization-units --route organization-units --module app.module +``` + +Then open the `src/route.provider.ts` and add a new route as an array element to add a navigation link labeled "Organization Units" to the menu: + +```js +//route.provider.ts + +import { eThemeSharedRouteNames } from '@abp/ng.theme.shared'; +//... + +routesService.add([ + //... + { + path: '/organization-units', + name: 'Organization Units', + parentName: eThemeSharedRouteNames.Administration, + iconClass: 'fas fa-sitemap', + layout: eLayoutType.application, + }, +]); +``` + +We have created a lazy-loadable module and defined a menu navigation link. We can navigate to the page as shown below: + +![organization units menu navigation item](organization-units-menu-item.jpg) + +## Using the PrimeNG Components + +### Implementing the Organization Chart Component + +When you would like to use any component from PrimeNG, you have to import the component's module to your module. Since we will use the `OrganizationChart` on the organization units page, we need to import `OrganizationChartModule` into `OrganizationUnitsModule`. + +Open the `src/organization-units/organization-units.module.ts` and add the `OrganizationChartModule` to the imports array as shown below: + +```js +import { OrganizationChartModule } from 'primeng/organizationchart'; +//... + +@NgModule({ + //... + imports: [ + //... + OrganizationChartModule + ], +}) +export class OrganizationUnitsModule {} +``` + +> Since NGCC need to work in some cases, restarting the `ng serve` process would be good when you import any modules from `primeng` package to your module. + +Let's define a mock data source for the `OrganizationChartComponent` and add the component to the page. + +Open the `src/organization-units/organization-units.component.ts` and add two variables as shown below: + +```js +//... +import { TreeNode } from 'primeng/api'; + +@Component(/* component metadata*/) +export class OrganizationUnitsComponent implements OnInit { + //... + + organizationUnits: TreeNode[] = [ + { + label: 'Management', + expanded: true, + children: [ + { + label: 'Selling', + expanded: true, + children: [ + { + label: 'Customer Relations', + }, + { + label: 'Marketing', + }, + ], + }, + { + label: 'Supporting', + expanded: true, + children: [ + { + label: 'Buying', + }, + { + label: 'Human Resources', + }, + ], + }, + ], + }, + ]; + + selectedUnit: TreeNode; +``` + +- First variable is `organizationUnits`. It provides mock data source to `OrganizationChartComponent`. +- Second variable is `selectedUnit`. It keeps chosen unit on the chart. + +Then, open the `src/organization-units/organization-units.component.html` and replace the file content with the following: + +```html +
+
+
Organization Units
+
+
+ +
+
+``` + +We have implemented the `OrganizationChart`. The final UI looks like below: + +![organization chart](organization-chart.jpg) + +## Implementing the Table Component + +In order to use the `TableComponent`, we have to import the `TableModule` to the `OrganizationUnitsModule`. + +Open the `organization-units.module.ts` and add `TableModule` to the imports array as shown below: + +```js +import { TableModule } from 'primeng/table'; +//... + +@NgModule({ + //... + imports: [ + //... + TableModule + ], +}) +export class OrganizationUnitsModule {} +``` + +Open the `organization-units.component.ts` and add a variable named `members` with initial value and add a getter named `tableData` as shown below: + +```js +//... +export class OrganizationUnitsComponent implements OnInit { + //... + + members = [ + { + fullName: 'John Doe', + username: 'John.Doe', + phone: '+1-202-555-0125', + email: 'john.doe@example.com', + parent: 'Customer Relations', + }, + { + fullName: 'Darrion Walter', + username: 'Darrion.Walter', + phone: '+1-262-155-0355', + email: 'Darrion_Walter@example.com', + parent: 'Marketing', + }, + { + fullName: 'Rosa Labadie', + username: 'Rosa.Labadie', + phone: '+1-262-723-2255', + email: 'Rosa.Labadie@example.com', + parent: 'Marketing', + }, + { + fullName: 'Adelle Hills', + username: 'Adelle.Hills', + phone: '+1-491-112-9011', + email: 'Adelle.Hills@example.com', + parent: 'Buying', + }, + { + fullName: 'Brian Hane', + username: 'Brian.Hane', + phone: '+1-772-509-1823', + email: 'Brian.Hane@example.com', + parent: 'Human Resources', + }, + ]; + + get tableData() { + return this.members.filter(user => user.parent === this.selectedUnit.label); + } +``` + +What we have done above? + +- We defined a variable named `members` to provide mock data to the table. +- We have defined a getter named `tableData` to provide filtered data source to the table using `members` variable. + +We are now ready to add the table to the HTML template. + +Open the `organization-units.component.html`, find the `p-organizationChart` tag and place the following code to the bottom of this tag: + +```html +
+
Members of {{ selectedUnit.label }}
+ + + + + Name + Username + Email + Phone + + + + + {{ member.fullName }} + {{ member.username }} + {{ member.email }} + {{ member.phone }} + + + +
+``` + +We have added a new `div` that contains the `TableComponent`. The table appears when an organization unit is selected. +The table contains 4 columns which are name, username, email, and phone for displaying the members' information. + +After adding the table, the final UI looks like this: + +![PrimeNG TableComponent](table.gif) + + +## Conclusion + +We have implemented the PrimeNG component library on the ABP Angular UI project and used two components on a page in a short time. You can use any PrimeNG components by following the documentation. The ABP Angular UI will not block you in any case. diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/intro.gif b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/intro.gif new file mode 100644 index 0000000000..5f96a65422 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/intro.gif differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-chart.jpg b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-chart.jpg new file mode 100644 index 0000000000..9d18f35ba1 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-chart.jpg differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-units-menu-item.jpg b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-units-menu-item.jpg new file mode 100644 index 0000000000..dc6111f553 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-units-menu-item.jpg differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/table.gif b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/table.gif new file mode 100644 index 0000000000..d27dcb26bd Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/table.gif differ diff --git a/docs/en/Dependency-Injection.md b/docs/en/Dependency-Injection.md index 335e829461..f94901ad84 100644 --- a/docs/en/Dependency-Injection.md +++ b/docs/en/Dependency-Injection.md @@ -1,6 +1,6 @@ # Dependency Injection -ABP's Dependency Injection system is developed based on Microsoft's [dependency injection extension](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection) library (Microsoft.Extensions.DependencyInjection nuget package). So, it's documentation is valid in ABP too. +ABP's Dependency Injection system is developed based on Microsoft's [dependency injection extension](https://medium.com/volosoft/asp-net-core-dependency-injection-best-practices-tips-tricks-c6e9c67f9d96) library (Microsoft.Extensions.DependencyInjection nuget package). So, it's documentation is valid in ABP too. > While ABP has no core dependency to any 3rd-party DI provider, it's required to use a provider that supports dynamic proxying and some other advanced features to make some ABP features properly work. Startup templates come with Autofac installed. See [Autofac integration](Autofac-Integration.md) document for more information. diff --git a/docs/en/Domain-Driven-Design-Implementation-Guide.md b/docs/en/Domain-Driven-Design-Implementation-Guide.md index 9341df703b..cf2ce6bf14 100644 --- a/docs/en/Domain-Driven-Design-Implementation-Guide.md +++ b/docs/en/Domain-Driven-Design-Implementation-Guide.md @@ -754,7 +754,8 @@ namespace IssueTracking.Issues { var daysAgo30 = DateTime.Now.Subtract(TimeSpan.FromDays(30)); - return await DbSet.Where(i => + var dbSet = await GetDbSetAsync(); + return await dbSet.Where(i => //Open !i.IsClosed && @@ -906,7 +907,8 @@ public class EfCoreIssueRepository : public async Task> GetIssuesAsync(ISpecification spec) { - return await DbSet + var dbSet = await GetDbSetAsync(); + return await dbSet .Where(spec.ToExpression()) .ToListAsync(); } @@ -952,8 +954,9 @@ public class IssueAppService : ApplicationService, IIssueAppService public async Task DoItAsync() { + var queryable = await _issueRepository.GetQueryableAsync(); var issues = AsyncExecuter.ToListAsync( - _issueRepository.Where(new InActiveIssueSpecification()) + queryable.Where(new InActiveIssueSpecification()) ); } } @@ -996,8 +999,9 @@ public class IssueAppService : ApplicationService, IIssueAppService public async Task DoItAsync(Guid milestoneId) { + var queryable = await _issueRepository.GetQueryableAsync(); var issues = AsyncExecuter.ToListAsync( - _issueRepository + queryable .Where( new InActiveIssueSpecification() .And(new MilestoneSpecification(milestoneId)) diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md index b2b216397a..a2c0e79996 100644 --- a/docs/en/Entity-Framework-Core.md +++ b/docs/en/Entity-Framework-Core.md @@ -236,7 +236,8 @@ public class BookRepository public async Task DeleteBooksByType(BookType type) { - await DbContext.Database.ExecuteSqlRawAsync( + var dbContext = await GetDbContextAsync(); + await dbContext.Database.ExecuteSqlRawAsync( $"DELETE FROM Books WHERE Type = {(int)type}" ); } @@ -344,7 +345,7 @@ You have different options when you want to load the related entities while quer #### Repository.WithDetails -`IRepository.WithDetails(...)` can be used to include one relation collection/property to the query. +`IRepository.WithDetailsAsync(...)` can be used to get an `IQueryable` by including one relation collection/property. **Example: Get an order with lines** @@ -355,7 +356,7 @@ using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; -namespace MyCrm +namespace AbpDemo.Orders { public class OrderManager : DomainService { @@ -368,35 +369,39 @@ namespace MyCrm public async Task TestWithDetails(Guid id) { - var query = _orderRepository - .WithDetails(x => x.Lines) - .Where(x => x.Id == id); - + //Get a IQueryable by including sub collections + var queryable = await _orderRepository.WithDetailsAsync(x => x.Lines); + + //Apply additional LINQ extension methods + var query = queryable.Where(x => x.Id == id); + + //Execute the query and get the result var order = await AsyncExecuter.FirstOrDefaultAsync(query); } } } ```` -> `AsyncExecuter` is used to execute async LINQ extensions without depending on the EF Core. If you add EF Core NuGet package reference to your project, then you can directly use `await _orderRepository.WithDetails(x => x.Lines).FirstOrDefaultAsync()`. But, this time you depend on the EF Core in your domain layer. See the [repository document](Repositories.md) to learn more. +> `AsyncExecuter` is used to execute async LINQ extensions without depending on the EF Core. If you add EF Core NuGet package reference to your project, then you can directly use `await query.FirstOrDefaultAsync()`. But, this time you depend on the EF Core in your domain layer. See the [repository document](Repositories.md) to learn more. **Example: Get a list of orders with their lines** ````csharp public async Task TestWithDetails() { - var query = _orderRepository - .WithDetails(x => x.Lines); + //Get a IQueryable by including sub collections + var queryable = await _orderRepository.WithDetailsAsync(x => x.Lines); - var orders = await AsyncExecuter.ToListAsync(query); + //Execute the query and get the result + var orders = await AsyncExecuter.ToListAsync(queryable); } ```` -> `WithDetails` method can get more than one expression parameter if you need to include more than one navigation property or collection. +> `WithDetailsAsync` method can get more than one expression parameter if you need to include more than one navigation property or collection. #### DefaultWithDetailsFunc -If you don't pass any expression to the `WithDetails` method, then it includes all the details using the `DefaultWithDetailsFunc` option you provide. +If you don't pass any expression to the `WithDetailsAsync` method, then it includes all the details using the `DefaultWithDetailsFunc` option you provide. You can configure `DefaultWithDetailsFunc` for an entity in the `ConfigureServices` method of your [module](Module-Development-Basics.md) in your `EntityFrameworkCore` project. @@ -419,12 +424,15 @@ Then you can use the `WithDetails` without any parameter: ````csharp public async Task TestWithDetails() { - var query = _orderRepository.WithDetails(); - var orders = await AsyncExecuter.ToListAsync(query); + //Get a IQueryable by including all sub collections + var queryable = await _orderRepository.WithDetailsAsync(); + + //Execute the query and get the result + var orders = await AsyncExecuter.ToListAsync(queryable); } ```` -`WithDetails()` executes the expression you've setup as the `DefaultWithDetailsFunc`. +`WithDetailsAsync()` executes the expression you've setup as the `DefaultWithDetailsFunc`. #### Repository Get/Find Methods @@ -466,7 +474,7 @@ public async Task TestWithDetails() #### Alternatives -The repository patters tries to encapsulate the EF Core, so your options are limited. If you need an advanced scenario, you can follow one of the options; +The repository pattern tries to encapsulate the EF Core, so your options are limited. If you need an advanced scenario, you can follow one of the options; * Create a custom repository method and use the complete EF Core API. * Reference to the `Volo.Abp.EntityFrameworkCore` package from your project. In this way, you can directly use `Include` and `ThenInclude` in your code. @@ -550,24 +558,15 @@ See also [lazy loading document](https://docs.microsoft.com/en-us/ef/core/queryi In most cases, you want to hide EF Core APIs behind a repository (this is the main purpose of the repository pattern). However, if you want to access the `DbContext` instance over the repository, you can use `GetDbContext()` or `GetDbSet()` extension methods. Example: ````csharp -public class BookService +public async Task TestAsync() { - private readonly IRepository _bookRepository; - - public BookService(IRepository bookRepository) - { - _bookRepository = bookRepository; - } - - public void Foo() - { - DbContext dbContext = _bookRepository.GetDbContext(); - DbSet books = _bookRepository.GetDbSet(); - } + var dbContext = await _orderRepository.GetDbContextAsync(); + var dbSet = await _orderRepository.GetDbSetAsync(); + //var dbSet = dbContext.Set(); //Alternative, when you have the DbContext } ```` -* `GetDbContext` returns a `DbContext` reference instead of `BookStoreDbContext`. You can cast it, however in most cases you don't need it. +* `GetDbContextAsync` returns a `DbContext` reference instead of `BookStoreDbContext`. You can cast it if you need. However, you don't need it in most cases. > Important: You must reference to the `Volo.Abp.EntityFrameworkCore` package from the project you want to access to the `DbContext`. This breaks encapsulation, but this is what you want in that case. @@ -742,32 +741,36 @@ If you have better logic or using an external library for bulk operations, you c - You may use example template below: ```csharp -public class MyCustomEfCoreBulkOperationProvider : IEfCoreBulkOperationProvider, ITransientDependency -{ - public async Task DeleteManyAsync(IEfCoreRepository repository, - IEnumerable entities, - bool autoSave, - CancellationToken cancellationToken) +public class MyCustomEfCoreBulkOperationProvider + : IEfCoreBulkOperationProvider, ITransientDependency +{ + public async Task DeleteManyAsync( + IEfCoreRepository repository, + IEnumerable entities, + bool autoSave, + CancellationToken cancellationToken) where TDbContext : IEfCoreDbContext where TEntity : class, IEntity { // Your logic here. } - public async Task InsertManyAsync(IEfCoreRepository repository, - IEnumerable entities, - bool autoSave, - CancellationToken cancellationToken) + public async Task InsertManyAsync( + IEfCoreRepository repository, + IEnumerable entities, + bool autoSave, + CancellationToken cancellationToken) where TDbContext : IEfCoreDbContext where TEntity : class, IEntity { // Your logic here. } - public async Task UpdateManyAsync(IEfCoreRepository repository, - IEnumerable entities, - bool autoSave, - CancellationToken cancellationToken) + public async Task UpdateManyAsync( + IEfCoreRepository repository, + IEnumerable entities, + bool autoSave, + CancellationToken cancellationToken) where TDbContext : IEfCoreDbContext where TEntity : class, IEntity { @@ -779,3 +782,4 @@ public class MyCustomEfCoreBulkOperationProvider : IEfCoreBulkOperationProvider, ## See Also * [Entities](Entities.md) +* [Repositories](Repositories.md) diff --git a/docs/en/Getting-Started-Running-Solution.md b/docs/en/Getting-Started-Running-Solution.md index d1f02c887b..163a3890b2 100644 --- a/docs/en/Getting-Started-Running-Solution.md +++ b/docs/en/Getting-Started-Running-Solution.md @@ -25,53 +25,41 @@ Check the **connection string** in the `appsettings.json` file under the {{if Ti } ```` -The solution is configured to use **Entity Framework Core** with **MS SQL Server** by default. EF Core supports [various](https://docs.microsoft.com/en-us/ef/core/providers/) database providers, so you can use any supported DBMS. See [the Entity Framework integration document](Entity-Framework-Core.md) to learn how to [switch to another DBMS](Entity-Framework-Core-Other-DBMS.md). - -### Apply the Migrations - -The solution uses the [Entity Framework Core Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli). So, you need to apply migrations to create the database. There are two ways of applying the database migrations. +> **About the Connection Strings and Database Management Systems** +> +> The solution is configured to use **Entity Framework Core** with **MS SQL Server** by default. However, if you've selected another DBMS using the `-dbms` parameter on the ABP CLI `new` command (like `-dbms MySQL`), the connection string might be different for you. +> +> EF Core supports [various](https://docs.microsoft.com/en-us/ef/core/providers/) database providers and you can use any supported DBMS. See [the Entity Framework integration document](Entity-Framework-Core.md) to learn how to [switch to another DBMS](Entity-Framework-Core-Other-DBMS.md) if you need later. -#### Apply Migrations Using the DbMigrator +### Database Migrations -The solution comes with a `.DbMigrator` console application which applies migrations and also **seeds the initial data**. It is useful on **development** as well as on **production** environment. +The solution uses the [Entity Framework Core Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli). It comes with a `.DbMigrator` console application which **applies the migrations** and also **seeds the initial data**. It is useful on **development** as well as on **production** environment. > `.DbMigrator` project has its own `appsettings.json`. So, if you have changed the connection string above, you should also change this one. -Right click to the `.DbMigrator` project and select **Set as StartUp Project** - -![set-as-startup-project](images/set-as-startup-project.png) - - Hit F5 (or Ctrl+F5) to run the application. It will have an output like shown below: +### The Initial Migration - ![db-migrator-output](images/db-migrator-output.png) - -> Initial [seed data](Data-Seeding.md) creates the `admin` user in the database (with the password is `1q2w3E*`) which is then used to login to the application. So, you need to use `.DbMigrator` at least once for a new database. +`.DbMigrator` application automatically **creates the Initial migration** on first run. -#### Using EF Core Update-Database Command +**If you are using Visual Studio, you can skip to the *Running the DbMigrator* section.** However, other IDEs (e.g. Rider) may have problems for the first run since it adds the initial migration and compiles the project. In this case, open a command line terminal in the folder of the `.DbMigrator` project and run the following command: -Ef Core has `Update-Database` command which creates database if necessary and applies pending migrations. - -{{ if UI == "MVC" }} - -Right click to the {{if Tiered == "Yes"}}`.IdentityServer`{{else}}`.Web`{{end}} project and select **Set as StartUp project**: +````bash +dotnet run +```` -{{ else if UI != "MVC" }} +For the next time, you can just run it in your IDE as you normally do. -Right click to the `.HttpApi.Host` project and select **Set as StartUp Project**: +### Running the DbMigrator -{{ end }} +Right click to the `.DbMigrator` project and select **Set as StartUp Project** ![set-as-startup-project](images/set-as-startup-project.png) -Open the **Package Manager Console**, select `.EntityFrameworkCore.DbMigrations` project as the **Default Project** and run the `Update-Database` command: - -![package-manager-console-update-database](images/package-manager-console-update-database.png) + Hit F5 (or Ctrl+F5) to run the application. It will have an output like shown below: -This will create a new database based on the configured connection string. + ![db-migrator-output](images/db-migrator-output.png) -> **Using the `.DbMigrator` tool is the suggested way**, because it also seeds the initial data to be able to properly run the web application. -> -> If you just use the `Update-Database` command, you will have an empty database, so you can not login to the application since there is no initial admin user in the database. You can use the `Update-Database` command in development time when you don't need to seed the database. However, using the `.DbMigrator` application is easier and you can always use it to migrate the schema and seed the database. +> Initial [seed data](Data-Seeding.md) creates the `admin` user in the database (with the password is `1q2w3E*`) which is then used to login to the application. So, you need to use `.DbMigrator` at least once for a new database. {{ else if DB == "Mongo" }} diff --git a/docs/en/Migration-Guides/Abp-4_2.md b/docs/en/Migration-Guides/Abp-4_2.md new file mode 100644 index 0000000000..084ae24caa --- /dev/null +++ b/docs/en/Migration-Guides/Abp-4_2.md @@ -0,0 +1,101 @@ +# ABP version 4.2 Migration Guide + +This version has no breaking changes but there is an important change on the repositories that should be applied for your application for an important performance and scalability gain. + +## IRepository.GetQueryableAsync + +`IRepository` interface inherits `IQueryable`, so you can directly use the standard LINQ extension methods, like `Where`, `OrderBy`, `First`, `Sum`... etc. + +**Example: Using LINQ directly over the repository object** + +````csharp +public class BookAppService : ApplicationService, IBookAppService +{ + private readonly IRepository _bookRepository; + + public BookAppService(IRepository bookRepository) + { + _bookRepository = bookRepository; + } + + public async Task DoItInOldWayAsync() + { + //Apply any standard LINQ extension method + var query = _bookRepository + .Where(x => x.Price > 10) + .OrderBy(x => x.Name); + + //Execute the query asynchronously + var books = await AsyncExecuter.ToListAsync(query); + } +} +```` + +*See [the documentation](https://docs.abp.io/en/abp/4.2/Repositories#iqueryable-async-operations) if you wonder what is the `AsyncExecuter`.* + +**Beginning from the version 4.2, the recommended way is using `IRepository.GetQueryableAsync()` to obtain an `IQueryable`, then use the LINQ extension methods over it.** + +**Example: Using the new GetQueryableAsync method** + +````csharp +public async Task DoItInNewWayAsync() +{ + //Use GetQueryableAsync to obtain the IQueryable first + var queryable = await _bookRepository.GetQueryableAsync(); + + //Then apply any standard LINQ extension method + var query = queryable + .Where(x => x.Price > 10) + .OrderBy(x => x.Name); + + //Finally, execute the query asynchronously + var books = await AsyncExecuter.ToListAsync(query); +} +```` + +ABP may start a database transaction when you get an `IQueryable` (If current [Unit Of Work](https://docs.abp.io/en/abp/latest/Unit-Of-Work) is transactional). In this new way, it is possible to **start the database transaction in an asynchronous way**. Previously, we could not get the advantage of asynchronous while starting the transactions. + +> **The new way has a significant performance and scalability gain. The old usage (directly using LINQ over the repositories) will be removed in the next major version (5.0).** You have a lot of time for the change, but we recommend to immediately take the action since the old usage has a big **scalability problem**. + +### Actions to Take + +* Use the repository's queryable feature as explained before. +* If you've overridden `CreateFilteredQuery` in a class derived from `CrudAppService`, you should override the `CreateFilteredQueryAsync` instead and remove the `CreateFilteredQuery` in your class. +* If you've overridden `WithDetails` in your custom repositories, remove it and override `WithDetailsAsync` instead. +* If you've used `DbContext` or `DbSet` properties in your custom repositories, use `GetDbContextAsync()` and `GetDbSetAsync()` methods instead of them. + +You can re-build your solution and check the `Obsolete` warnings to find some of the usages need to change. + +#### About IRepository Async Extension Methods + +Using IRepository Async Extension Methods has no such a problem. The examples below are pretty fine: + +````csharp +var countAll = await _personRepository + .CountAsync(); + +var count = await _personRepository + .CountAsync(x => x.Name.StartsWith("A")); + +var book1984 = await _bookRepository + .FirstOrDefaultAsync(x => x.Name == "John"); +```` + +See the [repository documentation](https://docs.abp.io/en/abp/4.2/Repositories#iqueryable-async-operations) to understand the relation between `IQueryable` and asynchronous operations. + +## .NET Package Upgrades + +ABP uses the latest 5.0.* .NET packages. If your application is using 5.0.0 packages, you may get an error on build. We recommend to depend on the .NET packages like `5.0.*` in the `.csproj` files to use the latest patch versions. + +Example: + +````xml + +```` + +## Blazorise Library Upgrade + +If you are upgrading to 4.2, you also need also upgrade the following packages in your Blazor application; + +* `Blazorise.Bootstrap` to `0.9.3-preview6` +* `Blazorise.Icons.FontAwesome` to `0.9.3-preview6` \ No newline at end of file diff --git a/docs/en/Migration-Guides/Index.md b/docs/en/Migration-Guides/Index.md index 5973ee0a0d..26fe825f50 100644 --- a/docs/en/Migration-Guides/Index.md +++ b/docs/en/Migration-Guides/Index.md @@ -1,5 +1,6 @@ # ABP Framework Migration Guides -* [3.3.x to 4.0 Migration Guide](Abp-4_0.md) -* [2.9.x to 3.0 Migration Guide](../UI/Angular/Migration-Guide-v3.md) +* [4.x to 4.2](Abp-4_2.md) +* [3.3.x to 4.0](Abp-4_0.md) +* [2.9.x to 3.0](../UI/Angular/Migration-Guide-v3.md) diff --git a/docs/en/MongoDB.md b/docs/en/MongoDB.md index 7fae9c3892..a12d216b3d 100644 --- a/docs/en/MongoDB.md +++ b/docs/en/MongoDB.md @@ -149,7 +149,7 @@ public class Book : AggregateRoot } ``` -(`BookType` is a simple enum here) And you want to create a new `Book` entity in a [domain service](Domain-Services.md): +(`BookType` is a simple `enum` here) And you want to create a new `Book` entity in a [domain service](Domain-Services.md): ```csharp public class BookManager : DomainService @@ -215,7 +215,8 @@ public class BookRepository : BookType type, CancellationToken cancellationToken = default(CancellationToken)) { - await Collection.DeleteManyAsync( + var collection = await GetCollectionAsync(cancellationToken); + await collection.DeleteManyAsync( Builders.Filter.Eq(b => b.Type, type), cancellationToken ); @@ -253,7 +254,7 @@ public async override Task DeleteAsync( ### Access to the MongoDB API -In most cases, you want to hide MongoDB APIs behind a repository (this is the main purpose of the repository). However, if you want to access the MongoDB API over the repository, you can use `GetDatabase()` or `GetCollection()` extension methods. Example: +In most cases, you want to hide MongoDB APIs behind a repository (this is the main purpose of the repository). However, if you want to access the MongoDB API over the repository, you can use `GetDatabaseAsync()`, `GetCollectionAsync()` or `GetAggregateAsync()` extension methods. Example: ```csharp public class BookService @@ -265,10 +266,11 @@ public class BookService _bookRepository = bookRepository; } - public void Foo() + public async Task FooAsync() { - IMongoDatabase database = _bookRepository.GetDatabase(); - IMongoCollection books = _bookRepository.GetCollection(); + IMongoDatabase database = await _bookRepository.GetDatabaseAsync(); + IMongoCollection books = await _bookRepository.GetCollectionAsync(); + IAggregateFluent bookAggregate = await _bookRepository.GetAggregateAsync(); } } ``` @@ -390,36 +392,45 @@ If you have better logic or using an external library for bulk operations, you c - You may use example template below: ```csharp -public class MyCustomMongoDbBulkOperationProvider : IMongoDbBulkOperationProvider, ITransientDependency +public class MyCustomMongoDbBulkOperationProvider + : IMongoDbBulkOperationProvider, ITransientDependency { - public async Task DeleteManyAsync(IMongoDbRepository repository, - IEnumerable entities, - IClientSessionHandle sessionHandle, - bool autoSave, - CancellationToken cancellationToken) + public async Task DeleteManyAsync( + IMongoDbRepository repository, + IEnumerable entities, + IClientSessionHandle sessionHandle, + bool autoSave, + CancellationToken cancellationToken) where TEntity : class, IEntity { // Your logic here. } - public async Task InsertManyAsync(IMongoDbRepository repository, - IEnumerable entities, - IClientSessionHandle sessionHandle, - bool autoSave, - CancellationToken cancellationToken) + public async Task InsertManyAsync( + IMongoDbRepository repository, + IEnumerable entities, + IClientSessionHandle sessionHandle, + bool autoSave, + CancellationToken cancellationToken) where TEntity : class, IEntity { // Your logic here. } - public async Task UpdateManyAsync(IMongoDbRepository repository, - IEnumerable entities, - IClientSessionHandle sessionHandle, - bool autoSave, - CancellationToken cancellationToken) + public async Task UpdateManyAsync( + IMongoDbRepository repository, + IEnumerable entities, + IClientSessionHandle sessionHandle, + bool autoSave, + CancellationToken cancellationToken) where TEntity : class, IEntity { // Your logic here. } } -``` \ No newline at end of file +``` + +## See Also + +* [Entities](Entities.md) +* [Repositories](Repositories.md) \ No newline at end of file diff --git a/docs/en/Repositories.md b/docs/en/Repositories.md index 5ad3107ca6..3d0ea84821 100644 --- a/docs/en/Repositories.md +++ b/docs/en/Repositories.md @@ -13,84 +13,178 @@ ABP can provide a **default generic repository** for each aggregate root or enti **Example usage of a default generic repository:** ````C# -public class PersonAppService : ApplicationService -{ - private readonly IRepository _personRepository; +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; - public PersonAppService(IRepository personRepository) +namespace Demo +{ + public class PersonAppService : ApplicationService { - _personRepository = personRepository; - } + private readonly IRepository _personRepository; - public async Task Create(CreatePersonDto input) - { - var person = new Person { Name = input.Name, Age = input.Age }; + public PersonAppService(IRepository personRepository) + { + _personRepository = personRepository; + } - await _personRepository.InsertAsync(person); - } + public async Task CreateAsync(CreatePersonDto input) + { + var person = new Person(input.Name); - public List GetList(string nameFilter) - { - var people = _personRepository - .Where(p => p.Name.Contains(nameFilter)) - .ToList(); + await _personRepository.InsertAsync(person); + } - return people - .Select(p => new PersonDto {Id = p.Id, Name = p.Name, Age = p.Age}) - .ToList(); + public async Task GetCountAsync(string filter) + { + return await _personRepository.CountAsync(p => p.Name.Contains(filter)); + } } } ```` -> See the "*IQueryable & Async Operations*" section below to understand how you can use **async extension methods**, like `ToListAsync()` (which is strongly suggested) instead of `ToList()`. - In this example; * `PersonAppService` simply injects `IRepository` in it's constructor. -* `Create` method uses `InsertAsync` to save a newly created entity. -* `GetList` method uses the standard LINQ `Where` and `ToList` methods to filter and get a list of people from the data source. +* `CreateAsync` method uses `InsertAsync` to save the new entity. +* `GetCountAsync` method gets a filtered count of all people in the database. -> The example above uses hand-made mapping between [entities](Entities.md) and [DTO](Data-Transfer-Objects.md)s. See [object to object mapping document](Object-To-Object-Mapping.md) for an automatic way of mapping. +### Standard Repository Methods Generic Repositories provides some standard CRUD features out of the box: -* Provides `Insert` method to save a new entity. +* `GetAsync`: Returns a single entity by its `Id` or a predicate (lambda expression). + * Throws `EntityNotFoundException` if the requested entity was not found. + * Throws `InvalidOperationException` if there are multiple entities with given predicate. +* `FindAsync`: Returns a single entity by its `Id` or a predicate (lambda expression). + * Returns `null` if the requested entity was not found. + * Throws `InvalidOperationException` if there are multiple entities with given predicate. +* `InsertAsync`: Inserts a new entity to the database. +* `UpdateAsync`: Updates an existing entity in the database. +* `DeleteAsync`: Deletes the given entity from database. + * This method has an overload that takes a predicate (lambda expression) to delete multiple entities satisfies the given condition. +* `GetListAsync`: Returns the list of all entities in the database. +* `GetPagedListAsync`: Returns a limited list of entities. Gets `skipCount`, `maxResultCount` and `sorting` parameters. +* `GetCountAsync`: Gets count of all entities in the database. + +There are overloads of these methods. + * Provides `Update` and `Delete` methods to update or delete an entity by entity object or it's id. * Provides `Delete` method to delete multiple entities by a filter. -* Implements `IQueryable`, so you can use LINQ and extension methods like `FirstOrDefault`, `Where`, `OrderBy`, `ToList` and so on... -### Basic Repositories +### Querying / LINQ over the Repositories -Standard `IRepository` interface extends standard `IQueryable` and you can freely query using standard LINQ methods. However, some ORM providers or database systems may not support standard `IQueryable` interface. +Repositories provide the `GetQueryableAsync()` method that returns an `IQueryable` object. You can use this object to perform LINQ queries on the entities in the database. -ABP provides `IBasicRepository` and `IBasicRepository` interfaces to support such scenarios. You can extend these interfaces (and optionally derive from `BasicRepositoryBase`) to create custom repositories for your entities. +**Example: Use LINQ with the repositories** -Depending on `IBasicRepository` but not depending on `IRepository` has an advantage to make possible to work with all data sources even if they don't support `IQueryable`. But major vendors, like Entity Framework, NHibernate or MongoDb already support `IQueryable`. +````csharp +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; -So, working with `IRepository` is the **suggested** way for typical applications. But reusable module developers may consider `IBasicRepository` to support a wider range of data sources. +namespace Demo +{ + public class PersonAppService : ApplicationService + { + private readonly IRepository _personRepository; -### Read Only Repositories + public PersonAppService(IRepository personRepository) + { + _personRepository = personRepository; + } -There are also `IReadOnlyRepository` and `IReadOnlyBasicRepository` interfaces for who only want to depend on querying capabilities of the repositories. + public async Task> GetListAsync(string filter) + { + //Obtain the IQueryable + IQueryable queryable = await _personRepository.GetQueryableAsync(); -### Generic Repository without a Primary Key + //Create a query + var query = from person in queryable + where person.Name == filter + orderby person.Name + select person; -If your entity does not have an Id primary key (it may have a composite primary key for instance) then you cannot use the `IRepository` (or basic/readonly versions) defined above. In that case, you can inject and use `IRepository` for your entity. + //Execute the query to get list of people + var people = query.ToList(); -> `IRepository` has a few missing methods those normally works with the `Id` property of an entity. Because of the entity has no `Id` property in that case, these methods are not available. One example is the `Get` method that gets an id and returns the entity with given id. However, you can still use `IQueryable` features to query entities by standard LINQ methods. + //Convert to DTO and return to the client + return people.Select(p => new PersonDto {Name = p.Name}).ToList(); + } + } +} +```` + +You could also use the LINQ extension methods: + +````csharp +public async Task> GetListAsync(string filter) +{ + //Obtain the IQueryable + IQueryable queryable = await _personRepository.GetQueryableAsync(); + + //Execute a query + var people = queryable + .Where(p => p.Name.Contains(filter)) + .OrderBy(p => p.Name) + .ToList(); + + //Convert to DTO and return to the client + return people.Select(p => new PersonDto {Name = p.Name}).ToList(); +} +```` + +Any standard LINQ method can be used over the `IQueryable` returned from the repository. + +> This sample uses `ToList()` method, but it is **strongly suggested to use the asynchronous methods** to perform database queries, like `ToListAsync()` for this example. +> +> See the **IQueryable & Async Operations** section to learn how you can do it. + +### Bulk Operations + +There are some methods to perform bulk operations in the database; + +* `InsertManyAsync` +* `UpdateManyAsync` +* `DeleteManyAsync` + +These methods work with multiple entities and can take advantage of bulk operations if supported by the underlying database provider. + +> Optimistic concurrency control may not be possible when you use `UpdateManyAsync` and `DeleteManyAsync` methods. ### Soft / Hard Delete `DeleteAsync` method of the repository doesn't delete the entity if the entity is a **soft-delete** entity (that implements `ISoftDelete`). Soft-delete entities are marked as "deleted" in the database. Data Filter system ensures that the soft deleted entities are not retrieved from database normally. -If your entity is a soft-delete entity, you can use the `HardDeleteAsync` method to really delete the entity from database in case of you need it. +If your entity is a soft-delete entity, you can use the `HardDeleteAsync` method to physically delete the entity from database in case of you need it. + +> See the [Data Filtering](Data-Filtering.md) documentation for more about soft-delete. + +## Other Generic Repository Types + +Standard `IRepository` interface exposes the standard `IQueryable` and you can freely query using the standard LINQ methods. This is fine for most of the applications. However, some ORM providers or database systems may not support standard `IQueryable` interface. If you want to use such providers, you can't rely on the `IQueryable`. + +### Basic Repositories + +ABP provides `IBasicRepository` and `IBasicRepository` interfaces to support such scenarios. You can extend these interfaces (and optionally derive from `BasicRepositoryBase`) to create custom repositories for your entities. + +Depending on `IBasicRepository` but not depending on `IRepository` has an advantage to make possible to work with all data sources even if they don't support `IQueryable`. -See the [Data Filtering](Data-Filtering.md) documentation for more about soft-delete. +Major vendors, like Entity Framework, NHibernate or MongoDB already support `IQueryable`. So, working with `IRepository` is the **suggested** way for typical applications. But reusable module developers may consider `IBasicRepository` to support a wider range of data sources. -## Bulk Operations -You can execute bulk operations with `InsertManyAsync`, `UpdateManyAsync`, `DeleteManyAsync` methods. +### Read Only Repositories -> **WARNING:** ConcurrencyStamp can't be checked at bulk operations! +There are also `IReadOnlyRepository` and `IReadOnlyBasicRepository` interfaces for who only want to depend on querying capabilities of the repositories. + +### Generic Repository without a Primary Key + +If your entity does not have an Id primary key (it may have a composite primary key for instance) then you cannot use the `IRepository` (or basic/readonly versions) defined above. In that case, you can inject and use `IRepository` for your entity. + +> `IRepository` has a few missing methods those normally works with the `Id` property of an entity. Because of the entity has no `Id` property in that case, these methods are not available. One example is the `Get` method that gets an id and returns the entity with given id. However, you can still use `IQueryable` features to query entities by standard LINQ methods. ## Custom Repositories @@ -128,7 +222,8 @@ public class PersonRepository : EfCoreRepository, IPe public async Task FindByNameAsync(string name) { - return await DbContext.Set() + var dbSet = await GetDbSetAsync(); + return await dbSet.Set() .Where(p => p.Name == name) .FirstOrDefaultAsync(); } @@ -141,12 +236,13 @@ You can directly access the data access provider (`DbContext` in this case) to p ## IQueryable & Async Operations -`IRepository` inherits from `IQueryable`, that means you can **directly use LINQ extension methods** on it, as shown in the example of the "*Generic Repositories*" section above. +`IRepository` provides `GetQueryableAsync()` to obtain an `IQueryable`, that means you can **directly use LINQ extension methods** on it, as shown in the example of the "*Querying / LINQ over the Repositories*" section above. **Example: Using the `Where(...)` and the `ToList()` extension methods** ````csharp -var people = _personRepository +var queryable = await _personRepository.GetQueryableAsync(); +var people = queryable .Where(p => p.Name.Contains(nameFilter)) .ToList(); ```` @@ -175,7 +271,8 @@ When you add the NuGet package to your project, you can take full power of the E **Example: Directly using the `ToListAsync()` after adding the EF Core package** ````csharp -var people = _personRepository +var queryable = await _personRepository.GetQueryableAsync(); +var people = queryable .Where(p => p.Name.Contains(nameFilter)) .ToListAsync(); ```` @@ -191,7 +288,8 @@ If you are using [MongoDB](MongoDB.md), you need to add the [Volo.Abp.MongoDB](h **Example: Cast `IQueryable` to `IMongoQueryable` and use `ToListAsync()`** ````csharp -var people = ((IMongoQueryable)_personRepository +var queryable = await _personRepository.GetQueryableAsync(); +var people = ((IMongoQueryable) queryable .Where(p => p.Name.Contains(nameFilter))) .ToListAsync(); ```` @@ -218,10 +316,11 @@ The standard LINQ extension methods are supported: *AllAsync, AnyAsync, AverageA This approach still **has a limitation**. You need to call the extension method directly on the repository object. For example, the below usage is **not supported**: ```csharp -var count = await _bookRepository.Where(x => x.Name.Contains("A")).CountAsync(); +var queryable = await _bookRepository.GetQueryableAsync(); +var count = await queryable.Where(x => x.Name.Contains("A")).CountAsync(); ``` -This is because the object returned from the `Where` method is not a repository object, it is a standard `IQueryable` interface. See the other options for such cases. +This is because the `CountAsync()` method in this example is called on a `IQueryable` interface, not on the repository object. See the other options for such cases. This method is suggested **wherever possible**. @@ -258,8 +357,11 @@ namespace AbpDemo public async Task> GetListAsync(string name) { + //Obtain the IQueryable + var queryable = await _productRepository.GetQueryableAsync(); + //Create the query - var query = _productRepository + var query = queryable .Where(p => p.Name.Contains(name)) .OrderBy(p => p.Name); diff --git a/docs/en/Road-Map.md b/docs/en/Road-Map.md index 6f4213a6bd..0920639106 100644 --- a/docs/en/Road-Map.md +++ b/docs/en/Road-Map.md @@ -18,4 +18,4 @@ You can always check the milestone planning and the prioritized backlog issues o The backlog items are subject to change. We are adding new items and changing priorities based on the community feedbacks and goals of the project. -Vote for your favorite feature on the related GitHub issues (and write your thoughts). You can create an issue on [the GitHub repository](https://github.com/abpframework/abp) for your feature requests, but first search in in the existing issues. \ No newline at end of file +Vote for your favorite feature on the related GitHub issues (and write your thoughts). You can create an issue on [the GitHub repository](https://github.com/abpframework/abp) for your feature requests, but first search in the existing issues. diff --git a/docs/en/Samples/Index.md b/docs/en/Samples/Index.md index b5dd0fab29..18312e4b55 100644 --- a/docs/en/Samples/Index.md +++ b/docs/en/Samples/Index.md @@ -17,6 +17,9 @@ A simple CRUD application to show basic principles of developing an application * **Book Store: Razor Pages UI & Entity Framework Core** * [Tutorial](https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC&DB=EF) * [Source code](https://github.com/abpframework/abp-samples/tree/master/BookStore-Mvc-EfCore) +* **Book Store: Blazor UI & Entity Framework Core** + * [Tutorial](https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=Blazor&DB=EF) + * [Source code](https://github.com/abpframework/abp-samples/tree/master/BookStore-Blazor-EfCore) * **Book Store: Angular UI & MongoDB** * [Tutorial](https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=NG&DB=Mongo) * [Source code](https://github.com/abpframework/abp-samples/tree/master/BookStore-Angular-MongoDb) diff --git a/docs/en/Specifications.md b/docs/en/Specifications.md index 036baa749e..bfe1d031d3 100644 --- a/docs/en/Specifications.md +++ b/docs/en/Specifications.md @@ -122,7 +122,8 @@ namespace MyProject public async Task> GetCustomersCanBuyAlcohol() { - var query = _customerRepository.Where( + var queryable = await _customerRepository.GetQueryableAsync(); + var query = queryable.Where( new Age18PlusCustomerSpecification().ToExpression() ); @@ -137,7 +138,8 @@ namespace MyProject Actually, using the `ToExpression()` method is not necessary since the specifications are automatically casted to Expressions. This would also work: ````csharp -var query = _customerRepository.Where( +var queryable = await _customerRepository.GetQueryableAsync(); +var query = queryable.Where( new Age18PlusCustomerSpecification() ); ```` diff --git a/docs/en/Tutorials/Part-10.md b/docs/en/Tutorials/Part-10.md index a9de3a062e..ec68dfe955 100644 --- a/docs/en/Tutorials/Part-10.md +++ b/docs/en/Tutorials/Part-10.md @@ -364,10 +364,11 @@ namespace Acme.BookStore.Books public override async Task GetAsync(Guid id) { - await CheckGetPolicyAsync(); + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); //Prepare a query to join books and authors - var query = from book in Repository + var query = from book in queryable join author in _authorRepository on book.AuthorId equals author.Id where book.Id == id select new { book, author }; @@ -384,17 +385,24 @@ namespace Acme.BookStore.Books return bookDto; } - public override async Task> GetListAsync( - PagedAndSortedResultRequestDto input) + public override async Task> GetListAsync(PagedAndSortedResultRequestDto input) { - await CheckGetListPolicyAsync(); + //Set a default sorting, if not provided + if (input.Sorting.IsNullOrWhiteSpace()) + { + input.Sorting = nameof(Book.Name); + } + + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); //Prepare a query to join books and authors - var query = from book in Repository + var query = from book in queryable join author in _authorRepository on book.AuthorId equals author.Id - orderby input.Sorting + orderby input.Sorting //TODO: Can not sort like that! select new {book, author}; + //Paging query = query .Skip(input.SkipCount) .Take(input.MaxResultCount); @@ -437,7 +445,7 @@ Let's see the changes we've done: * Injected `IAuthorRepository` to query from the authors. * Overrode the `GetAsync` method of the base `CrudAppService`, which returns a single `BookDto` object with the given `id`. * Used a simple LINQ expression to join books and authors and query them together for the given book id. - * Used `AsyncExecuter.FirstOrDefaultAsync(...)` to execute the query and get a result. `AsyncExecuter` was previously used in the `AuthorAppService`. Check the [repository documentation](../Repositories.md) to understand why we've used it. + * Used `AsyncExecuter.FirstOrDefaultAsync(...)` to execute the query and get a result. It is a way to use asynchronous LINQ extensions without depending on the database provider API. Check the [repository documentation](../Repositories.md) to understand why we've used it. * Throws an `EntityNotFoundException` which results an `HTTP 404` (not found) result if requested book was not present in the database. * Finally, created a `BookDto` object using the `ObjectMapper`, then assigning the `AuthorName` manually. * Overrode the `GetListAsync` method of the base `CrudAppService`, which returns a list of books. The logic is similar to the previous method, so you can easily understand the code. @@ -487,8 +495,6 @@ namespace Acme.BookStore.Books public async override Task GetAsync(Guid id) { - await CheckGetPolicyAsync(); - var book = await Repository.GetAsync(id); var bookDto = ObjectMapper.Map(book); @@ -501,17 +507,18 @@ namespace Acme.BookStore.Books public async override Task> GetListAsync(PagedAndSortedResultRequestDto input) { - await CheckGetListPolicyAsync(); - //Set a default sorting, if not provided if (input.Sorting.IsNullOrWhiteSpace()) { input.Sorting = nameof(Book.Name); } + + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); //Get the books var books = await AsyncExecuter.ToListAsync( - Repository + queryable .OrderBy(input.Sorting) .Skip(input.SkipCount) .Take(input.MaxResultCount) @@ -553,8 +560,10 @@ namespace Acme.BookStore.Books .Distinct() .ToArray(); + var queryable = await _authorRepository.GetQueryableAsync(); + var authors = await AsyncExecuter.ToListAsync( - _authorRepository.Where(a => authorIds.Contains(a.Id)) + queryable.Where(a => authorIds.Contains(a.Id)) ); return authors.ToDictionary(x => x.Id, x => x); diff --git a/docs/en/Tutorials/Part-7.md b/docs/en/Tutorials/Part-7.md index 97d28691ae..ec3ad9a8e0 100644 --- a/docs/en/Tutorials/Part-7.md +++ b/docs/en/Tutorials/Part-7.md @@ -127,7 +127,8 @@ namespace Acme.BookStore.Authors public async Task FindByNameAsync(string name) { - return await DbSet.FirstOrDefaultAsync(author => author.Name == name); + var dbSet = await GetDbSetAsync(); + return await dbSet.FirstOrDefaultAsync(author => author.Name == name); } public async Task> GetListAsync( @@ -136,7 +137,8 @@ namespace Acme.BookStore.Authors string sorting, string filter = null) { - return await DbSet + var dbSet = await GetDbSetAsync(); + return await dbSet .WhereIf( !filter.IsNullOrWhiteSpace(), author => author.Name.Contains(filter) @@ -186,8 +188,8 @@ namespace Acme.BookStore.Authors public async Task FindByNameAsync(string name) { - return await GetMongoQueryable() - .FirstOrDefaultAsync(author => author.Name == name); + var queryable = await GetMongoQueryableAsync(); + return await queryable.FirstOrDefaultAsync(author => author.Name == name); } public async Task> GetListAsync( @@ -196,7 +198,8 @@ namespace Acme.BookStore.Authors string sorting, string filter = null) { - return await GetMongoQueryable() + var queryable = await GetMongoQueryableAsync(); + return await queryable .WhereIf>( !filter.IsNullOrWhiteSpace(), author => author.Name.Contains(filter) diff --git a/docs/en/Tutorials/Part-8.md b/docs/en/Tutorials/Part-8.md index b7c805c17e..6ab14c714c 100644 --- a/docs/en/Tutorials/Part-8.md +++ b/docs/en/Tutorials/Part-8.md @@ -172,6 +172,7 @@ using System.Threading.Tasks; using Acme.BookStore.Permissions; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Repositories; namespace Acme.BookStore.Authors { @@ -230,12 +231,10 @@ public async Task> GetListAsync(GetAuthorListDto input input.Filter ); - var totalCount = await AsyncExecuter.CountAsync( - _authorRepository.WhereIf( - !input.Filter.IsNullOrWhiteSpace(), - author => author.Name.Contains(input.Filter) - ) - ); + var totalCount = input.Filter == null + ? await _authorRepository.CountAsync() + : await _authorRepository.CountAsync( + author => author.Name.Contains(input.Filter)); return new PagedResultDto( totalCount, @@ -246,7 +245,7 @@ public async Task> GetListAsync(GetAuthorListDto input * Default sorting is "by author name" which is done in the beginning of the method in case of it wasn't sent by the client. * Used the `IAuthorRepository.GetListAsync` to get a paged, sorted and filtered list of authors from the database. We had implemented it in the previous part of this tutorial. Again, it actually was not needed to create such a method since we could directly query over the repository, but wanted to demonstrate how to create custom repository methods. -* Directly queried from the `AuthorRepository` while getting the count of the authors. We preferred to use the `AsyncExecuter` service which allows us to perform async queries without depending on the EF Core. However, you could depend on the EF Core package and directly use the `_authorRepository.WhereIf(...).ToListAsync()` method. See the [repository document](../Repositories.md) to read the alternative approaches and the discussion. +* Directly queried from the `AuthorRepository` while getting the count of the authors. If a filter is sent, then we are using it to filter entities while getting the count. * Finally, returning a paged result by mapping the list of `Author`s to a list of `AuthorDto`s. ### CreateAsync diff --git a/docs/en/UI/Angular/Authorization.md b/docs/en/UI/Angular/Authorization.md new file mode 100644 index 0000000000..75d6107341 --- /dev/null +++ b/docs/en/UI/Angular/Authorization.md @@ -0,0 +1,28 @@ +# Authorization in Angular UI + +OAuth is preconfigured in Angular application templates. So, when you start a project using the CLI (or Suite, for that matter), authorization already works. You can find **OAuth configuration** in the _environment.ts_ files. + +```js +import { Config } from '@abp/ng.core'; + +const baseUrl = 'http://localhost:4200'; + +export const environment = { + // other options removed for sake of brevity + + oAuthConfig: { + issuer: 'https://localhost:44305', + redirectUri: baseUrl, + clientId: 'MyProjectName_App', + responseType: 'code', + scope: 'offline_access MyProjectName', + }, + + // other options removed for sake of brevity +} as Config.Environment; + +``` + +This configuration results in an [OAuth authorization code flow with PKCE](https://tools.ietf.org/html/rfc7636) and we are using [angular-oauth2-oidc library](https://github.com/manfredsteyer/angular-oauth2-oidc#logging-in) for managing OAuth in the Angular client. + +According to this flow, the user is redirected to an external login page which is built with MVC. So, if you need **to customize the login page**, please follow [this community article](https://community.abp.io/articles/how-to-customize-the-login-page-for-mvc-razor-page-applications-9a40f3cd). diff --git a/docs/en/UI/Angular/Ellipsis-Directive.md b/docs/en/UI/Angular/Ellipsis-Directive.md new file mode 100644 index 0000000000..c462331574 --- /dev/null +++ b/docs/en/UI/Angular/Ellipsis-Directive.md @@ -0,0 +1,83 @@ +# Ellipsis + +Text inside an HTML element can be truncated easily with an ellipsis by using CSS. To make this even easier, you can use the `EllipsisDirective` which has been exposed by the `@abp/ng.theme.shared` package. + + +## Getting Started + +In order to use the `EllipsisDirective` in an HTML template, the **`ThemeSharedModule`** should be imported into your module like this: + +```js +// ... +import { ThemeSharedModule } from '@abp/ng.theme.shared'; + +@NgModule({ + //... + imports: [..., ThemeSharedModule], +}) +export class MyFeatureModule {} +``` + +or **if you would not like to import** the `ThemeSharedModule`, you can import the **`EllipsisModule`** as shown below: + + +```js +// ... +import { EllipsisModule } from '@abp/ng.theme.shared'; + +@NgModule({ + //... + imports: [..., EllipsisModule], +}) +export class MyFeatureModule {} +``` + +## Usage + +The `EllipsisDirective` is very easy to use. The directive's selector is **`abpEllipsis`**. By adding the `abpEllipsis` attribute to an HTML element, you can activate the `EllipsisDirective` for the HTML element. + +See an example usage: + +```html +

+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Laboriosam commodi quae aspernatur, + corporis velit et suscipit id consequuntur amet minima expedita cum reiciendis dolorum + cupiditate? Voluptas eaque voluptatum odio deleniti quo vel illum nemo accusamus nulla ratione + impedit dolorum expedita necessitatibus fugiat ullam beatae, optio eum cupiditate ducimus + architecto. +

+``` + +The `abpEllipsis` attribute has been added to the `

` element that containing very long text inside to activate the `EllipsisDirective`. + +See the result: + +![Ellipsis directive result](./images/ellipsis-directive-result1.jpg) + +The long text has been truncated by using the directive. + +The UI before using the directive looks like this: + +![Before using the EllipsisDirective](./images/ellipsis-directive-before.jpg) + +### Specifying Max Width of an HTML Element + +An HTML element max width can be specified as shown below: + +```html +

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque, optio! +
+ +
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque, optio! +
+ +
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque, optio! +
+``` + +See the result: + +![Ellipsis directive result 2](./images/ellipsis-directive-result2.jpg) \ No newline at end of file diff --git a/docs/en/UI/Angular/Modal.md b/docs/en/UI/Angular/Modal.md new file mode 100644 index 0000000000..f1583d4813 --- /dev/null +++ b/docs/en/UI/Angular/Modal.md @@ -0,0 +1,248 @@ +# Modal + +`ModalComponent` is a pre-built component exposed by `@abp/ng.theme.shared` package to show modals. The component uses the [`ng-bootstrap`](https://ng-bootstrap.github.io/)'s modal service inside to render a modal. + +The `abp-modal` provides some additional benefits: + + - It is **flexible**. You can pass header, body, footer templates easily by adding the templates to the `abp-modal` content. It can also be implemented quickly. + - Provides several inputs be able to customize the modal and several outputs be able to listen to some events. + - Automatically detects the close button which has a `#abpClose` template variable and closes the modal when pressed this button. + - Automatically detects the `abp-button` and triggers its loading spinner when the `busy` input value of the modal component is true. + - Automatically checks if the form inside the modal **has changed, but not saved**. It warns the user by displaying a [confirmation popup](Confirmation-Service) in this case when a user tries to close the modal or refresh/close the tab of the browser. + + +> Note: A modal can also be rendered by using the `ng-bootstrap` modal. For further information, see [Modal doc](https://ng-bootstrap.github.io/#/components/modal) on the `ng-bootstrap` documentation. + +## Getting Started + +In order to use the `abp-modal` in an HTML template, the **`ThemeSharedModule`** should be imported into your module like this: + +```js +// ... +import { ThemeSharedModule } from '@abp/ng.theme.shared'; + +@NgModule({ + //... + imports: [..., ThemeSharedModule], +}) +export class MyFeatureModule {} +``` + +## Usage + +You can add the `abp-modal` to your component very quickly. See an example: + +```html + + + + + + +

Modal Title

+
+ + +

Modal content

+
+ + + + +
+``` + +```js +// sample.component.ts + +@Component(/* component metadata */) +export class SampleComponent { + isModelOpen = false +} +``` + +![Example modal result](./images/modal-result-1.jpg) + + +See an example form inside a modal: + +```html + + + + +

Book

+
+ + +
+
+ * + +
+ +
+ * + +
+ +
+ * + +
+ +
+ * + +
+ +
+ * + +
+
+
+ + + + + + +
+``` + +```ts +// book.component.ts + +import { Component } from '@angular/core'; +import { FormBuilder, Validators } from '@angular/forms'; + +@Component(/* component metadata */) +export class BookComponent { + form = this.fb.group({ + author: [null, [Validators.required]], + name: [null, [Validators.required]], + price: [null, [Validators.required, Validators.min(0)]], + type: [null, [Validators.required]], + publishDate: [null, [Validators.required]], + }); + + inProgress: boolean; + + isModalOpen: boolean; + + constructor(private fb: FormBuilder, private service: BookService) {} + + save() { + if (this.form.invalid) return; + + this.inProgress = true; + + this.service.save(this.form.value).subscribe(() => { + this.inProgress = false; + }); + } +} +``` + +The modal with form looks like this: + +![Form example result](./images/modal-result-2.jpg) + +## API + +### Inputs + +#### visible + +```js +@Input() visible: boolean +``` + +**`visible`** is a boolean input that determines whether the modal is open. It is also can be used two-way binding. + +#### busy + +```js +@Input() busy: boolean +``` + +**`busy`** is a boolean input that determines whether the busy status of the modal is true. When `busy` is true, the modal cannot be closed and the `abp-button` loading spinner is triggered. + + +#### options + +```js +@Input() options: NgbModalOptions +``` + +**`options`** is an input typed [NgbModalOptions](https://ng-bootstrap.github.io/#/components/modal/api#NgbModalOptions). It is configuration for the `ng-bootstrap` modal. + +#### suppressUnsavedChangesWarning + +```js +@Input() suppressUnsavedChangesWarning: boolean +``` + +**`suppressUnsavedChangesWarning`** is a boolean input that determines whether the confirmation popup triggering active or not. It can also be set globally as shown below: + +```ts +//app.module.ts + +// app.module.ts + +import { SUPPRESS_UNSAVED_CHANGES_WARNING } from '@abp/ng.theme.shared'; + +// ... + +@NgModule({ + // ... + providers: [{provide: SUPPRESS_UNSAVED_CHANGES_WARNING, useValue: true}] +}) +export class AppModule {} +``` + +Note: The `suppressUnsavedChangesWarning` input of `abp-modal` value overrides the `SUPPRESS_UNSAVED_CHANGES_WARNING` injection token value. + +### Outputs + +#### visibleChange + +```js +@Output() readonly visibleChange = new EventEmitter(); +``` + +**`visibleChange`** is an event emitted when the modal visibility has changed. The event payload is a boolean. + +#### appear + +```js + @Output() readonly appear = new EventEmitter(); +``` + +**`appear`** is an event emitted when the modal has opened. + +#### disappear + +```js + @Output() readonly disappear = new EventEmitter(); +``` + +**`disappear`** is an event emitted when the modal has closed. diff --git a/docs/en/UI/Angular/Multi-Tenancy.md b/docs/en/UI/Angular/Multi-Tenancy.md index e7e284bb0d..7622db6de0 100644 --- a/docs/en/UI/Angular/Multi-Tenancy.md +++ b/docs/en/UI/Angular/Multi-Tenancy.md @@ -1,4 +1,4 @@ -# Multi Tenancy in Angular UI +# Multi-Tenancy in Angular UI ABP Angular UI supports the multi-tenancy. The following features related to multi-tenancy are available in the startup templates. @@ -8,7 +8,7 @@ ABP Angular UI supports the multi-tenancy. The following features related to mul On the page above, you can; -- See the all tenants. +- See all tenants. - Create a new tenant. - Edit an existing tenant. - Delete a tenant. @@ -17,9 +17,11 @@ On the page above, you can;

Tenant Switching Component

-You can switch between existing tenants by using the tenant switching component in the child pages of the `AccountLayoutComponent` (like Login page). Angular UI sends the selected tenant id to the backend as `__tenant` header on each request. +You can switch between existing tenants by using the tenant switching box in the child pages of the MVC Account Public Module (like Login page). Angular UI gets selected tenant from `application-configuration` response and sends the tenant id to the backend as `__tenant` header on each request. -## Domain Tenant Resolver +## Domain/Subdomain Tenant Resolver + +> **Note:** If you are going to implement the steps below, you should also implement the domain/subdomain tenant resolver feature for the backend. See the [Domain/Subdomain Tenant Resolver section in Multi-Tenancy document](../../Multi-Tenancy#domain-subdomain-tenant-resolver) to learn the backend implementation. Angular UI can get the tenant name from the app running URL. You can determine the current tenant by subdomain (like mytenant1.mydomain.com) or by the whole domain (like mytenant.com). To do this, you need to set the `application.baseUrl` property in the environment: diff --git a/docs/en/UI/Angular/Page-Alerts.md b/docs/en/UI/Angular/Page-Alerts.md new file mode 100644 index 0000000000..a27cee4abf --- /dev/null +++ b/docs/en/UI/Angular/Page-Alerts.md @@ -0,0 +1,64 @@ +# Page Alerts + +A page alert is useful for displaying an important message to the user. The ABP Framework provides an easy way to show the following alert to the user. + +![angular-page-alert-example](./images/page-alert-warning-example.png) + +You can simply import `PageAlertService` from `@abp/ng.theme.shared` and utilize it as follows: + +```js +import { PageAlertService } from '@abp/ng.theme.shared'; + +@Component({ + // ... +}) +export class MyComponent { + constructor(private service: PageAlertService) {} + + showWarning() { + this.service.show({ + type: 'warning', + message: + 'We will have a service interruption between 02:00 AM and 04:00 AM at October 23, 2023!', + title: 'Service Interruption', + }); + } +} +``` + +## `SHOW` + +The method `show` accepts a single object that is type of `PageAlert` + +```js +export interface PageAlert { + type: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark'; + message: string; + title?: string; + dismissible?: boolean; + messageLocalizationParams?: string[]; + titleLocalizationParams?: string[]; +} +``` + +* `type` (Required): Defines what type of alert will be shown +* `message` (Required): The message who will be shown, also works with localization as well. +* `title` (Optional): The title of the message. If it is not provided, the title will be hidden. +* `dismissible` (Optional): Default is `true`. If enabled, a button on the top right corner will be shown to the users so that they can dismiss the message. +* `messageLocalizationParams` and `titleLocalizationParams` (Optional): If the message and/or the title is a key for localization service and contains some parameters, these fields could be used to pass those parameters. + +### An example with Localization + +```typescript +this.service.show({ + type: 'danger', + message: 'AbpAccount::PagerInfo{0}{1}{2}', + messageLocalizationParams: ['10', '20', '30'], + title: 'AbpAccount::EntityNotFoundErrorMessage', + titleLocalizationParams: ['Test', 'id123'], +}); +``` + +![angular-page-alert-with-params-example](./images/page-alert-with-params-example.png) + + diff --git a/docs/en/UI/Angular/Router-Events.md b/docs/en/UI/Angular/Router-Events.md new file mode 100644 index 0000000000..011d405b22 --- /dev/null +++ b/docs/en/UI/Angular/Router-Events.md @@ -0,0 +1,146 @@ +# Router Events Simplified + +`RouterEvents` is a utility service to provide an easy implementation for one of the most frequent needs in Angular templates: `TrackByFunction`. Please see [this page in Angular docs](https://angular.io/guide/template-syntax#ngfor-with-trackby) for its purpose. + + + + +## Benefit + +You can use router events directly and filter them as seen below: + +```js +import { + NavigationEnd, + NavigationError, + NavigationCancel, + Router, +} from '@angular/router'; +import { filter } from 'rxjs/operators'; + +@Injectable() +class SomeService { + navigationFinish$ = this.router.events.pipe( + filter( + event => + event instanceof NavigationEnd || + event instanceof NavigationError || + event instanceof NavigationCancel, + ), + ); + /* Observable */ + + constructor(private router: Router) {} +} +``` + +However, `RouterEvents` makes filtering router events easier. + +```js +import { RouterEvents } from '@abp/ng.core'; + +@Injectable() +class SomeService { + navigationFinish$ = this.routerEvents.getNavigationEvents('End', 'Error', 'Cancel'); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + +`RouterEvents` also delivers improved type-safety. In the example above, `navigationFinish$` has inferred type of `Observable` whereas it would have `Observable` when router events are filtered directly. + + + + +## Usage + +You do not have to provide `RouterEvents` at the module or component level, because it is already **provided in root**. You can inject and start using it immediately in your components. + + +### How to Get Specific Navigation Events + +You can use `getNavigationEvents` to get a stream of navigation events matching given event keys. + +```js +import { RouterEvents } from '@abp/ng.core'; +import { merge } from 'rxjs'; +import { mapTo } from 'rxjs/operators'; + +@Injectable() +class SomeService { + navigationStart$ = this.routerEvents.getNavigationEvents('Start'); + /* Observable */ + + navigationFinish$ = this.routerEvents.getNavigationEvents('End', 'Error', 'Cancel'); + /* Observable */ + + loading$ = merge( + this.navigationStart$.pipe(mapTo(true)), + this.navigationFinish$.pipe(mapTo(false)), + ); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + + +### How to Get All Navigation Events + +You can use `getAllNavigationEvents` to get a stream of all navigation events without passing any keys. + +```js +import { RouterEvents, NavigationStart } from '@abp/ng.core'; +import { map } from 'rxjs/operators'; + +@Injectable() +class SomeService { + navigationEvent$ = this.routerEvents.getAllNavigationEvents(); + /* Observable */ + + loading$ = this.navigationEvent$.pipe( + map(event => event instanceof NavigationStart), + ); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + + +### How to Get Specific Router Events + +You can use `getEvents` to get a stream of router events matching given event constructors. + +```js +import { RouterEvents } from '@abp/ng.core'; +import { ActivationEnd, ChildActivationEnd } from '@angular/router'; + +@Injectable() +class SomeService { + moduleActivation$ = this.routerEvents.getEvents(ActivationEnd, ChildActivationEnd); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + + +### How to Get All Router Events + +You can use `getEvents` to get a stream of all router events without passing any event constructors. This is nothing different from accessing `events` property of `Router` and is added to the service just for convenience. + +```js +import { RouterEvents } from '@abp/ng.core'; +import { ActivationEnd, ChildActivationEnd } from '@angular/router'; + +@Injectable() +class SomeService { + routerEvent$ = this.routerEvents.getAllEvents(); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + diff --git a/docs/en/UI/Angular/Testing.md b/docs/en/UI/Angular/Testing.md index 7b93d48585..bf6d3e1b26 100644 --- a/docs/en/UI/Angular/Testing.md +++ b/docs/en/UI/Angular/Testing.md @@ -10,7 +10,7 @@ In Angular, unit tests use [Karma](https://karma-runner.github.io/) and [Jasmine An over-simplified spec file looks like this: -```ts +```js import { CoreTestingModule } from "@abp/ng.core/testing"; import { ThemeBasicTestingModule } from "@abp/ng.theme.basic/testing"; import { ThemeSharedTestingModule } from "@abp/ng.theme.shared/testing"; @@ -59,7 +59,7 @@ Although you can test your code with Angular TestBed, you may find [Angular Test The simple example above can be written with Angular Testing Library as follows: -```ts +```js import { CoreTestingModule } from "@abp/ng.core/testing"; import { ThemeBasicTestingModule } from "@abp/ng.theme.basic/testing"; import { ThemeSharedTestingModule } from "@abp/ng.theme.shared/testing"; @@ -95,7 +95,7 @@ describe("MyComponent", () => { Very similar, as you can see. The real difference kicks in when we use queries and fire events. -```ts +```js // other imports import { getByLabelText, screen } from "@testing-library/angular"; import userEvent from "@testing-library/user-event"; @@ -131,7 +131,7 @@ One thing to remember is that Karma runs tests in real browser instances. That m We have prepared a simple function with which you can clear any leftover DOM elements after each test. -```ts +```js // other imports import { clearPage } from "@abp/ng.core/testing"; @@ -159,7 +159,7 @@ Some components, modals, in particular, work off-detection-cycle. In other words For this purpose, we have prepared a `wait` function. -```ts +```js // other imports import { wait } from "@abp/ng.core/testing"; @@ -187,7 +187,7 @@ The `wait` function takes a second parameter, i.e. timeout (default: `0`). Try n Here is an example test suite. It doesn't cover all, but gives quite a good idea about what the testing experience will be like. -```ts +```js import { clearPage, CoreTestingModule, wait } from "@abp/ng.core/testing"; import { ThemeBasicTestingModule } from "@abp/ng.theme.basic/testing"; import { ThemeSharedTestingModule } from "@abp/ng.theme.shared/testing"; @@ -374,3 +374,7 @@ Finally, don't forget to run your CI tests with the following command: ```sh npm test -- --prod ``` + +## See Also + +* [ABP Community Video - Unit Testing with the Angular UI](https://community.abp.io/articles/unit-testing-with-the-angular-ui-p4l550q3) diff --git a/docs/en/UI/Angular/images/ellipsis-directive-before.jpg b/docs/en/UI/Angular/images/ellipsis-directive-before.jpg new file mode 100644 index 0000000000..dc534d9a97 Binary files /dev/null and b/docs/en/UI/Angular/images/ellipsis-directive-before.jpg differ diff --git a/docs/en/UI/Angular/images/ellipsis-directive-result1.jpg b/docs/en/UI/Angular/images/ellipsis-directive-result1.jpg new file mode 100644 index 0000000000..fe693f4c8c Binary files /dev/null and b/docs/en/UI/Angular/images/ellipsis-directive-result1.jpg differ diff --git a/docs/en/UI/Angular/images/ellipsis-directive-result2.jpg b/docs/en/UI/Angular/images/ellipsis-directive-result2.jpg new file mode 100644 index 0000000000..3a416bbc05 Binary files /dev/null and b/docs/en/UI/Angular/images/ellipsis-directive-result2.jpg differ diff --git a/docs/en/UI/Angular/images/modal-result-1.jpg b/docs/en/UI/Angular/images/modal-result-1.jpg new file mode 100644 index 0000000000..89dbbc0cb1 Binary files /dev/null and b/docs/en/UI/Angular/images/modal-result-1.jpg differ diff --git a/docs/en/UI/Angular/images/modal-result-2.jpg b/docs/en/UI/Angular/images/modal-result-2.jpg new file mode 100644 index 0000000000..e17f2631ab Binary files /dev/null and b/docs/en/UI/Angular/images/modal-result-2.jpg differ diff --git a/docs/en/UI/Angular/images/page-alert-warning-example.png b/docs/en/UI/Angular/images/page-alert-warning-example.png new file mode 100644 index 0000000000..253a811a22 Binary files /dev/null and b/docs/en/UI/Angular/images/page-alert-warning-example.png differ diff --git a/docs/en/UI/Angular/images/page-alert-with-params-example.png b/docs/en/UI/Angular/images/page-alert-with-params-example.png new file mode 100644 index 0000000000..8fc5236de3 Binary files /dev/null and b/docs/en/UI/Angular/images/page-alert-with-params-example.png differ diff --git a/docs/en/UI/AspNetCore/Bundling-Minification.md b/docs/en/UI/AspNetCore/Bundling-Minification.md index 9d88a37135..aeaea6c2e6 100644 --- a/docs/en/UI/AspNetCore/Bundling-Minification.md +++ b/docs/en/UI/AspNetCore/Bundling-Minification.md @@ -165,7 +165,27 @@ public class MyWebExtensionModule : AbpModule } ```` -> It's not possible to configure unnamed bundle tag helpers by code, because their name are not known at the development time. It's suggested to always use a name for a bundle tag helper. +You can also use the `ConfigureAll` method to configure all existing bundles: + +````C# +[DependsOn(typeof(MyWebModule))] +public class MyWebExtensionModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options + .ScriptBundles + .ConfigureAll(bundle => { + bundle.AddFiles( + "/scripts/my-extension-script.js" + ); + }); + }); + } +} +```` ## Bundle Contributors diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 250fed91f0..7fd7762ad4 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -681,6 +681,10 @@ { "text": "Page Alerts", "path": "UI/Blazor/Page-Alerts.md" + }, + { + "text": "Page Progress", + "path": "UI/Blazor/Page-Progress.md" } ] }, @@ -754,6 +758,10 @@ "text": "Config State Service", "path": "UI/Angular/Config-State-Service.md" }, + { + "text": "Authorization", + "path": "UI/Angular/Authorization.md" + }, { "text": "HTTP Requests", "path": "UI/Angular/HTTP-Requests.md" @@ -799,6 +807,10 @@ "text": "Easy *ngFor trackBy", "path": "UI/Angular/Track-By-Service.md" }, + { + "text": "Router Events", + "path": "UI/Angular/Router-Events.md" + }, { "text": "Inserting Scripts & Styles to DOM", "path": "UI/Angular/Dom-Insertion-Service.md" @@ -811,6 +823,10 @@ "text": "Projecting Angular Content", "path": "UI/Angular/Content-Projection-Service.md" }, + { + "text": "Modal", + "path": "UI/Angular/Modal.md" + }, { "text": "Confirmation Popup", "path": "UI/Angular/Confirmation-Service.md" @@ -818,6 +834,14 @@ { "text": "Toast Overlay", "path": "UI/Angular/Toaster-Service.md" + }, + { + "text": "Page Alerts", + "path": "UI/Angular/Page-Alerts.md" + }, + { + "text": "Ellipsis", + "path": "UI/Angular/Ellipsis-Directive.md" } ] }, @@ -1044,10 +1068,6 @@ { "text": "CLI", "path": "CLI.md" - }, - { - "text": "API Documentation", - "path": "{ApiDocumentationUrl}" } ] }, diff --git a/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md b/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md index b8abe99cdc..1e9ae77f36 100644 --- a/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md +++ b/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md @@ -243,7 +243,7 @@ ObjectExtensionManager.Instance 这是定义实体属性的另一种方法( 有关 `ObjectExtensionManager` 更多信息,请参阅[文档](Object-Extensions.md)). 这次我们设置了 `CheckPairDefinitionOnMapping` 为false,在将实体映射到DTO时会跳过定义检查. -如果你不喜欢这种方法,但想简单的向多个对象(DTO)添加单个属, `AddOrUpdateProperty` 可以使用类型数组添加额外的属性: +如果你不喜欢这种方法,但想简单的向多个对象(DTO)添加单个属性, `AddOrUpdateProperty` 可以使用类型数组添加额外的属性: ````csharp ObjectExtensionManager.Instance diff --git a/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md b/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md index db434ab365..81755fbf0d 100644 --- a/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md +++ b/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md @@ -1767,7 +1767,7 @@ public async Task ChangeTitleAsync(Issue issue, string title) 如前所述,领域驱动设计中的*业务逻辑*分为两部分(各层):领域逻辑和应用逻辑 -![domain-driven-design-domain-vs-application-logic](../../../abpframework.abp/docs/en/images/domain-driven-design-domain-vs-application-logic.png) +![domain-driven-design-domain-vs-application-logic](images/domain-driven-design-domain-vs-application-logic.png) 领域逻辑是系统的*核心领域规则*组成,而应用逻辑则满足特定的*用例*. @@ -1783,7 +1783,7 @@ public async Task ChangeTitleAsync(Issue issue, string title) * 一个**后台管理系统**,UI使用Angular,通过REST API请求数据.内部员工使用这个系统来维护数据(例如,编辑商品说明). * 一个**移动端应用程序**,它比公开的网站UI上更加简洁.它通过REST API或其它技术(例如,TCP sockets)请求数据. -![domain-driven-design-multiple-applications](../../../abpframework.abp/docs/en/images/domain-driven-design-multiple-applications.png) +![domain-driven-design-multiple-applications](images/domain-driven-design-multiple-applications.png) 每个应用程序都有不同的**需求**,不同的**用例**(应用服务方法),不同的DTO,不同的**验证**和**授权**规则等. diff --git a/docs/zh-Hans/Entity-Framework-Core-Other-DBMS.md b/docs/zh-Hans/Entity-Framework-Core-Other-DBMS.md index fb8ad15787..56a37396ea 100644 --- a/docs/zh-Hans/Entity-Framework-Core-Other-DBMS.md +++ b/docs/zh-Hans/Entity-Framework-Core-Other-DBMS.md @@ -62,22 +62,25 @@ MySQL连接字符串与SQL Server连接字符串不同. 所以检查你的解决 通常需要更改 `.DbMigrator` 和 `.Web` 项目里面的 `appsettings.json` ,但它取决于你的解决方案结构. -## 更改迁移DbContext +## 更改迁移DbContext Factory -MySQL DBMS与SQL Server有一些细微的差异. 某些模块数据库映射配置(尤其是字段长度)会导致MySQL出现问题. 例如某些[IdentityServer模块](Modules/IdentityServer.md)表就存在这样的问题,它提供了一个选项可以根据你的DBMS配置字段. +启动模板包含***YourProjectName*MigrationsDbContextFactory**类,这是EF Core控制台命令所必须的类(比如[Add-Migration](https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/#generating--running-migrations)和[Update-Database](https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/#generating--running-migrations)),在切换到MySql数据库时,我们同时也需要修改`DbContextOptionsBuilder` -启动模板包含*YourProjectName*MigrationsDbContext,它负责维护和迁移数据库架构. 此DbContext基本上调用依赖模块的扩展方法来配置其数据库表. +在 *YourProjectName*MigrationsDbContextFactory 类中找到以下代码: -打开 *YourProjectName*MigrationsDbContext 更改 `builder.ConfigureIdentityServer();` 行,如下所示: +````csharp +var builder = new DbContextOptionsBuilder() + .UseSqlServer(configuration.GetConnectionString("Default")); +```` + +将其替换为: ````csharp -builder.ConfigureIdentityServer(options => -{ - options.DatabaseProvider = EfCoreDatabaseProvider.MySql; -}); +var builder = new DbContextOptionsBuilder() + .UseMySql(configuration.GetConnectionString("Default")); ```` -然后 `ConfigureIdentityServer()` 方法会将字段长度设置为超过MySQL的限制. 如果在创建或执行数据库迁移时遇到任何问题请参考相关的模块文档. +如果在创建或执行数据库迁移时遇到任何问题,请参考相关模块文档 ## 重新生成迁移 @@ -105,5 +108,6 @@ builder.ConfigureIdentityServer(options => options.DatabaseProvider = EfCoreDatabaseProvider.MySql; }); ``` +v2.9+版本无需手动设置 ([版本历史](https://github.com/abpframework/abp/blob/dev/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerModelBuilderConfigurationOptions.cs)) -相关讨论: https://github.com/abpframework/abp/issues/1920 \ No newline at end of file +相关讨论: https://github.com/abpframework/abp/issues/1920 diff --git a/docs/zh-Hans/MongoDB.md b/docs/zh-Hans/MongoDB.md index 2ceeb1e00c..af63642a41 100644 --- a/docs/zh-Hans/MongoDB.md +++ b/docs/zh-Hans/MongoDB.md @@ -211,7 +211,7 @@ public async override Task DeleteAsync( #### 访问MongoDB API -大多数情况下,你想要将MongoDB API隐藏在仓储后面(这是仓储的主要目的).如果你想在仓储之上访问MongoDB API,你可以使用`GetDatabase()`或`GetCollection()`方法.例如: +大多数情况下,你想要将MongoDB API隐藏在仓储后面(这是仓储的主要目的).如果你想在仓储之上访问MongoDB API,你可以使用`GetDatabaseAsync()`, `GetAggregateAsync()` 或`GetCollectionAsync()`方法.例如: ```csharp public class BookService @@ -223,10 +223,11 @@ public class BookService _bookRepository = bookRepository; } - public void Foo() + public async Task FooAsync() { - IMongoDatabase database = _bookRepository.GetDatabase(); - IMongoCollection books = _bookRepository.GetCollection(); + IMongoDatabase database = await _bookRepository.GetDatabaseAsync(); + IMongoCollection books = await _bookRepository.GetCollectionAsync(); + IAggregateFluent bookAggregate = await _bookRepository.GetAggregateAsync(); } } ``` diff --git a/docs/zh-Hans/UI/AspNetCore/Bundling-Minification.md b/docs/zh-Hans/UI/AspNetCore/Bundling-Minification.md index 6a229714c1..dd688f256c 100644 --- a/docs/zh-Hans/UI/AspNetCore/Bundling-Minification.md +++ b/docs/zh-Hans/UI/AspNetCore/Bundling-Minification.md @@ -167,7 +167,27 @@ public class MyWebExtensionModule : AbpModule } ```` -> 无法通过代码配置未命名的bundle tag helpers, 因为它们的名称在开发时是未知的. 建议始终使用bundle tag helper的名称. +你也可以使用 `ConfigureAll` 方法配置所有现有的捆绑包: + +````C# +[DependsOn(typeof(MyWebModule))] +public class MyWebExtensionModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options + .ScriptBundles + .ConfigureAll(bundle => { + bundle.AddFiles( + "/scripts/my-extension-script.js" + ); + }); + }); + } +} +```` ### Bundle 贡献者 diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs index 7fa2038020..255e0ac89b 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs @@ -25,7 +25,12 @@ namespace Volo.Abp.AspNetCore.MultiTenancy protected override Task GetTenantIdOrNameFromHttpContextOrNullAsync(ITenantResolveContext context, HttpContext httpContext) { - var hostName = httpContext.Request.Host.Host.RemovePreFix(ProtocolPrefixes); + if (!httpContext.Request.Host.HasValue) + { + return Task.FromResult(null); + } + + var hostName = httpContext.Request.Host.Value.RemovePreFix(ProtocolPrefixes); var extractResult = FormattedStringValueExtracter.Extract(hostName, _domainFormat, ignoreCase: true); context.Handled = true; diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs index 0aeb97e89d..eaf5c753fd 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs @@ -1,7 +1,14 @@ -using System.Threading.Tasks; +using System; +using System.Globalization; +using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.RequestLocalization; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; +using Volo.Abp.Localization; using Volo.Abp.MultiTenancy; +using Volo.Abp.Settings; namespace Volo.Abp.AspNetCore.MultiTenancy { @@ -21,10 +28,71 @@ namespace Volo.Abp.AspNetCore.MultiTenancy public async Task InvokeAsync(HttpContext context, RequestDelegate next) { var tenant = await _tenantConfigurationProvider.GetAsync(saveResolveResult: true); - using (_currentTenant.Change(tenant?.Id, tenant?.Name)) + if (tenant?.Id != _currentTenant.Id) + { + using (_currentTenant.Change(tenant?.Id, tenant?.Name)) + { + var requestCulture = await TryGetRequestCultureAsync(context); + if (requestCulture != null) + { + CultureInfo.CurrentCulture = requestCulture.Culture; + CultureInfo.CurrentUICulture = requestCulture.UICulture; + AbpRequestCultureCookieHelper.SetCultureCookie( + context, + requestCulture + ); + } + + await next(context); + } + } + else { await next(context); } } + + private async Task TryGetRequestCultureAsync(HttpContext httpContext) + { + var requestCultureFeature = httpContext.Features.Get(); + + /* If requestCultureFeature == null, that means the RequestLocalizationMiddleware was not used + * and we don't want to set the culture. */ + if (requestCultureFeature == null) + { + return null; + } + + /* If requestCultureFeature.Provider is not null, that means RequestLocalizationMiddleware + * already picked a language, so we don't need to set the default. */ + if (requestCultureFeature.Provider != null) + { + return null; + } + + var settingProvider = httpContext.RequestServices.GetRequiredService(); + var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); + if (defaultLanguage.IsNullOrWhiteSpace()) + { + return null; + } + + string culture; + string uiCulture; + + if (defaultLanguage.Contains(';')) + { + var splitted = defaultLanguage.Split(';'); + culture = splitted[0]; + uiCulture = splitted[1]; + } + else + { + culture = defaultLanguage; + uiCulture = defaultLanguage; + } + + return new RequestCulture(culture, uiCulture); + } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs index 4b4a0e6301..ae013c4343 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs @@ -7,7 +7,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Client { public static string CreateCacheKey(ICurrentUser currentUser) { - return $"ApplicationConfiguration_{currentUser.Id?.ToString("N") ?? "Anonymous"}_{CultureInfo.CurrentUICulture.Name}"; + var userKey = currentUser.Id?.ToString("N") ?? "Anonymous"; + return $"ApplicationConfiguration_{userKey}_{CultureInfo.CurrentUICulture.Name}"; } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs index afc4ec6a4a..acb2ae9fac 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs @@ -9,11 +9,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling { private readonly ConcurrentDictionary _bundles; private readonly ConcurrentDictionary>> _lazyBundleConfigurationActions; + private readonly List> _lazyAllBundleConfigurationActions; public BundleConfigurationCollection() { _bundles = new ConcurrentDictionary(); _lazyBundleConfigurationActions = new ConcurrentDictionary>>(); + _lazyAllBundleConfigurationActions = new List>(); } /// @@ -90,6 +92,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling } } + lock (_lazyAllBundleConfigurationActions) + { + _lazyAllBundleConfigurationActions.ForEach(c => c.Invoke(bundle)); + } + + return bundle; } @@ -123,6 +131,29 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling return this; } + /// + /// Configures all bundles. + /// This method also works for lazy bundles (those are created using razor tag helpers). + /// + /// Configure action + /// Returns this object for chained calls. + public BundleConfigurationCollection ConfigureAll([NotNull] Action configureAction) + { + Check.NotNull(configureAction, nameof(configureAction)); + + foreach (var bundle in _bundles) + { + configureAction.Invoke(bundle.Value); + } + + lock (_lazyAllBundleConfigurationActions) + { + _lazyAllBundleConfigurationActions.Add(configureAction); + } + + return this; + } + /// /// Gets a bundle. /// @@ -140,4 +171,4 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling return bundle; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index a4d32550f8..75d080feda 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -39,7 +39,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f var _$modal = null; var _$form = null; - var _modalId = 'Modal_' + (Math.floor((Math.random() * 1000000))) + new Date().getTime(); + var _modalId = 'Abp_Modal_' + (Math.floor((Math.random() * 1000000))) + new Date().getTime(); var _modalObject = null; var _publicApi = null; @@ -56,7 +56,12 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f function _createContainer() { _removeContainer(); _$modalContainer = $('
'); - $('body').prepend(_$modalContainer); + var existsModals = $('[id^="Abp_Modal_"]'); + if (existsModals.length) { + existsModals.last().after(_$modalContainer) + } else { + $('body').prepend(_$modalContainer); + } return _$modalContainer; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js index b0c4873b59..1808f267eb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js @@ -30,7 +30,7 @@ var htmlEncode = function (html) { return $('
').text(html).html(); } - + var _createDropdownItem = function (record, fieldItem, tableInstance) { var $li = $('
  • '); var $a = $(''); @@ -90,15 +90,15 @@ } $button.append(htmlEncode(firstItem.text)); } - + if (firstItem.enabled && !firstItem.enabled({ record: record, table: tableInstance })) { $button.addClass('disabled'); } - + if (firstItem.action) { $button.click(function (e) { e.preventDefault(); - + if (!$(this).hasClass('disabled')) { if (firstItem.confirmMessage) { abp.message.confirm(firstItem.confirmMessage({ record: record, table: tableInstance })) @@ -217,7 +217,7 @@ var renderRowActions = function (tableInstance, nRow, aData, iDisplayIndex, iDisplayIndexFull) { var columns; - + if (tableInstance.aoColumns) { columns = tableInstance.aoColumns; } else { @@ -463,7 +463,7 @@ datatables.defaultConfigurations.scrollX = true; - datatables.defaultConfigurations.responsive = true; + datatables.defaultConfigurations.responsive = true; datatables.defaultConfigurations.language = function () { return { @@ -484,6 +484,6 @@ }; }; - datatables.defaultConfigurations.dom = '<"dataTable_filters"f>rt<"row dataTable_footer"<"col-auto"l><"col-auto"i><"col"p>>'; + datatables.defaultConfigurations.dom = '<"dataTable_filters"f>rt<"row dataTable_footer"<"col-auto"l><"col-auto mr-auto"i><"col-auto"p>>'; })(jQuery); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs index 449747d0cc..a2d02bb3fe 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs @@ -27,6 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs index 52f1d251cb..85822414cf 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs @@ -25,6 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs index 8cbba0fc46..873c532ba3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Auditing; -using Volo.Abp.AspNetCore.Mvc.Content; +using Volo.Abp.AspNetCore.Mvc.ContentFormatters; using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.ExceptionHandling; using Volo.Abp.AspNetCore.Mvc.Features; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs index 2ac02b8ac5..215f31b855 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs @@ -10,6 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected Type ObjectMapperContext { get; set; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs index 5cd1333f34..135b506e69 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs @@ -25,17 +25,20 @@ namespace Volo.Abp.AspNetCore.Mvc { public ILogger Logger { get; set; } + private readonly AspNetCoreApiDescriptionModelProviderOptions _options; private readonly IApiDescriptionGroupCollectionProvider _descriptionProvider; - private readonly AbpAspNetCoreMvcOptions _options; + private readonly AbpAspNetCoreMvcOptions _abpAspNetCoreMvcOptions; private readonly AbpApiDescriptionModelOptions _modelOptions; public AspNetCoreApiDescriptionModelProvider( + IOptions options, IApiDescriptionGroupCollectionProvider descriptionProvider, - IOptions options, + IOptions abpAspNetCoreMvcOptions, IOptions modelOptions) { - _descriptionProvider = descriptionProvider; _options = options.Value; + _descriptionProvider = descriptionProvider; + _abpAspNetCoreMvcOptions = abpAspNetCoreMvcOptions.Value; _modelOptions = modelOptions.Value; Logger = NullLogger.Instance; @@ -82,14 +85,14 @@ namespace Volo.Abp.AspNetCore.Mvc var controllerModel = moduleModel.GetOrAddController( controllerType.FullName, - CalculateControllerName(controllerType, setting), + _options.ControllerNameGenerator(controllerType, setting), controllerType, _modelOptions.IgnoredInterfaces ); var method = apiDescription.ActionDescriptor.GetMethodInfo(); - var uniqueMethodName = GetUniqueActionName(method); + var uniqueMethodName = _options.ActionNameGenerator(method); if (controllerModel.Actions.ContainsKey(uniqueMethodName)) { Logger.LogWarning( @@ -119,44 +122,6 @@ namespace Volo.Abp.AspNetCore.Mvc AddParameterDescriptionsToModel(actionModel, method, apiDescription); } - private static string CalculateControllerName(Type controllerType, ConventionalControllerSetting setting) - { - var controllerName = controllerType.Name.RemovePostFix("Controller") - .RemovePostFix(ApplicationService.CommonPostfixes); - - if (setting?.UrlControllerNameNormalizer != null) - { - controllerName = - setting.UrlControllerNameNormalizer( - new UrlControllerNameNormalizerContext(setting.RootPath, controllerName)); - } - - return controllerName; - } - - private static string GetUniqueActionName(MethodInfo method) - { - var methodNameBuilder = new StringBuilder(method.Name); - - var parameters = method.GetParameters(); - if (parameters.Any()) - { - methodNameBuilder.Append("By"); - - for (var i = 0; i < parameters.Length; i++) - { - if (i > 0) - { - methodNameBuilder.Append("And"); - } - - methodNameBuilder.Append(parameters[i].Name.ToPascalCase()); - } - } - - return methodNameBuilder.ToString(); - } - private static List GetSupportedVersions(Type controllerType, MethodInfo method, ConventionalControllerSetting setting) { @@ -377,7 +342,7 @@ namespace Volo.Abp.AspNetCore.Mvc [CanBeNull] private ConventionalControllerSetting FindSetting(Type controllerType) { - foreach (var controllerSetting in _options.ConventionalControllers.ConventionalControllerSettings) + foreach (var controllerSetting in _abpAspNetCoreMvcOptions.ConventionalControllers.ConventionalControllerSettings) { if (controllerSetting.ControllerTypes.Contains(controllerType)) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs new file mode 100644 index 0000000000..4cd607e07a --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs @@ -0,0 +1,57 @@ +using System; +using System.Linq; +using System.Reflection; +using System.Text; +using Volo.Abp.Application.Services; +using Volo.Abp.AspNetCore.Mvc.Conventions; + +namespace Volo.Abp.AspNetCore.Mvc +{ + public class AspNetCoreApiDescriptionModelProviderOptions + { + public Func ControllerNameGenerator { get; set; } + + public Func ActionNameGenerator { get; set; } + + public AspNetCoreApiDescriptionModelProviderOptions() + { + ControllerNameGenerator = (controllerType, setting) => + { + var controllerName = controllerType.Name.RemovePostFix("Controller") + .RemovePostFix(ApplicationService.CommonPostfixes); + + if (setting?.UrlControllerNameNormalizer != null) + { + controllerName = + setting.UrlControllerNameNormalizer( + new UrlControllerNameNormalizerContext(setting.RootPath, controllerName)); + } + + return controllerName; + }; + + ActionNameGenerator = (method) => + { + var methodNameBuilder = new StringBuilder(method.Name); + + var parameters = method.GetParameters(); + if (parameters.Any()) + { + methodNameBuilder.Append("By"); + + for (var i = 0; i < parameters.Length; i++) + { + if (i > 0) + { + methodNameBuilder.Append("And"); + } + + methodNameBuilder.Append(parameters[i].Name.ToPascalCase()); + } + } + + return methodNameBuilder.ToString(); + }; + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs deleted file mode 100644 index aaaa849f4f..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.IO; -using Microsoft.AspNetCore.Http; -using Volo.Abp.Content; - -namespace Volo.Abp.AspNetCore.Mvc.Content -{ - internal class InternalRemoteStreamContent : IRemoteStreamContent - { - private readonly HttpContext _httpContext; - - public InternalRemoteStreamContent(HttpContext httpContext) - { - _httpContext = httpContext; - } - - public string ContentType => _httpContext.Request.ContentType; - - public long? ContentLength => _httpContext.Request.ContentLength; - - public Stream GetStream() - { - return _httpContext.Request.Body; - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentInputFormatter.cs similarity index 70% rename from framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs rename to framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentInputFormatter.cs index a4f5668b7d..ba07e28f77 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentInputFormatter.cs @@ -1,10 +1,10 @@ using System; using System.Threading.Tasks; -using Microsoft.Net.Http.Headers; using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.Net.Http.Headers; using Volo.Abp.Content; -namespace Volo.Abp.AspNetCore.Mvc.Content +namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters { public class RemoteStreamContentInputFormatter : InputFormatter { @@ -20,9 +20,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Content public override Task ReadRequestBodyAsync(InputFormatterContext context) { - return InputFormatterResult.SuccessAsync( - new InternalRemoteStreamContent(context.HttpContext) - ); + return InputFormatterResult.SuccessAsync(new RemoteStreamContent(context.HttpContext.Request.Body) + { + ContentType = context.HttpContext.Request.ContentType + }); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs similarity index 65% rename from framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs rename to framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs index 706e514254..685822a4b6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Net.Http.Headers; using Volo.Abp.Content; -namespace Volo.Abp.AspNetCore.Mvc.Content +namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters { public class RemoteStreamContentOutputFormatter : OutputFormatter { @@ -21,9 +21,16 @@ namespace Volo.Abp.AspNetCore.Mvc.Content public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context) { var remoteStream = (IRemoteStreamContent)context.Object; - using (var stream = remoteStream.GetStream()) + + if (remoteStream != null) { - await stream.CopyToAsync(context.HttpContext.Response.Body); + context.HttpContext.Response.ContentType = remoteStream.ContentType; + + using (var stream = remoteStream.GetStream()) + { + stream.Position = 0; + await stream.CopyToAsync(context.HttpContext.Response.Body); + } } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs index 06b9c9a620..6b73aa26da 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; using System; +using Microsoft.AspNetCore.RequestLocalization; using Volo.Abp.Localization; namespace Volo.Abp.AspNetCore.Mvc.Localization @@ -20,12 +20,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization throw new AbpException("Unknown language: " + culture + ". It must be a valid culture!"); } - string cookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture, uiCulture)); - - Response.Cookies.Append(CookieRequestCultureProvider.DefaultCookieName, cookieValue, new CookieOptions - { - Expires = Clock.Now.AddYears(2) - }); + AbpRequestCultureCookieHelper.SetCultureCookie( + HttpContext, + new RequestCulture(culture, uiCulture) + ); if (!string.IsNullOrWhiteSpace(returnUrl)) { diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs index a9d9316f41..616cbd3706 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs @@ -17,6 +17,7 @@ namespace Volo.Abp.AspNetCore.SignalR { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetService(); diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs new file mode 100644 index 0000000000..0f27925496 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs @@ -0,0 +1,23 @@ +using System; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Localization; + +namespace Microsoft.AspNetCore.RequestLocalization +{ + public static class AbpRequestCultureCookieHelper + { + public static void SetCultureCookie( + HttpContext httpContext, + RequestCulture requestCulture) + { + httpContext.Response.Cookies.Append( + CookieRequestCultureProvider.DefaultCookieName, + CookieRequestCultureProvider.MakeCookieValue(requestCulture), + new CookieOptions + { + Expires = DateTime.Now.AddYears(2) + } + ); + } + } +} diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/nl.json b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/nl.json new file mode 100644 index 0000000000..6be7515c01 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Localization/nl.json @@ -0,0 +1,10 @@ +{ + "culture": "nl", + "texts": { + "Volo.Authorization:010001": "Autorisatie mislukt! De benodigde policy is niet aan u verleend.", + "Volo.Authorization:010002": "Autorisatie mislukt! De benodigde policy: '{PolicyName}' is niet aan u verleend.", + "Volo.Authorization:010003": "Autorisatie mislukt! De benodigde policy is niet aan de opgegeven resource: '{ResourceName}' verleend.", + "Volo.Authorization:010004": "Autorisatie mislukt! De benodigde requirement is niet aan de opgegeven resource: '{ResourceName}' verleend.", + "Volo.Authorization:010005": "Autorisatie mislukt! De benodigde requirements zijn niet aan de opgegeven resource: '{ResourceName}' verleend." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobQuartzOptions.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobQuartzOptions.cs index e9ecb41c57..1f9836d57d 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobQuartzOptions.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/AbpBackgroundJobQuartzOptions.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.BackgroundJobs.Quartz public int RetryCount { get; set; } public int RetryIntervalMillisecond { get; set; } - + [NotNull] public Func RetryStrategy @@ -19,28 +19,28 @@ namespace Volo.Abp.BackgroundJobs.Quartz set => _retryStrategy = Check.NotNull(value, nameof(value)); } private Func _retryStrategy; - + public AbpBackgroundJobQuartzOptions() { RetryCount = 3; RetryIntervalMillisecond = 3000; _retryStrategy = DefaultRetryStrategy; } - + private async Task DefaultRetryStrategy(int retryIndex, IJobExecutionContext executionContext, JobExecutionException exception) { exception.RefireImmediately = true; - - var retryCount = executionContext.JobDetail.JobDataMap.GetIntValue(QuartzBackgroundJobManager.JobDataPrefix+ nameof(RetryCount)); + + var retryCount = executionContext.JobDetail.JobDataMap.GetString(QuartzBackgroundJobManager.JobDataPrefix+ nameof(RetryCount)).To(); if (retryIndex > retryCount) { exception.RefireImmediately = false; exception.UnscheduleAllTriggers = true; return; } - - var retryInterval = executionContext.JobDetail.JobDataMap.GetIntValue(QuartzBackgroundJobManager.JobDataPrefix+ nameof(RetryIntervalMillisecond)); + + var retryInterval = executionContext.JobDetail.JobDataMap.GetString(QuartzBackgroundJobManager.JobDataPrefix+ nameof(RetryIntervalMillisecond)).To(); await Task.Delay(retryInterval); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs index 83b74297a5..42e89ffb93 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzBackgroundJobManager.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Options; using Quartz; using Volo.Abp.DependencyInjection; +using Volo.Abp.Json; namespace Volo.Abp.BackgroundJobs.Quartz { @@ -16,9 +17,12 @@ namespace Volo.Abp.BackgroundJobs.Quartz protected AbpBackgroundJobQuartzOptions Options { get; } - public QuartzBackgroundJobManager(IScheduler scheduler, IOptions options) + protected IJsonSerializer JsonSerializer { get; } + + public QuartzBackgroundJobManager(IScheduler scheduler, IOptions options, IJsonSerializer jsonSerializer) { Scheduler = scheduler; + JsonSerializer = jsonSerializer; Options = options.Value; } @@ -33,10 +37,10 @@ namespace Volo.Abp.BackgroundJobs.Quartz { var jobDataMap = new JobDataMap { - {nameof(TArgs), args}, - {JobDataPrefix+ nameof(Options.RetryCount), retryCount}, - {JobDataPrefix+ nameof(Options.RetryIntervalMillisecond), retryIntervalMillisecond}, - {JobDataPrefix+ RetryIndex, 0} + {nameof(TArgs), JsonSerializer.Serialize(args)}, + {JobDataPrefix+ nameof(Options.RetryCount), retryCount.ToString()}, + {JobDataPrefix+ nameof(Options.RetryIntervalMillisecond), retryIntervalMillisecond.ToString()}, + {JobDataPrefix+ RetryIndex, "0"} }; var jobDetail = JobBuilder.Create>().RequestRecovery().SetJobData(jobDataMap).Build(); diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs index b6759b256e..79776d0726 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo/Abp/BackgroundJobs/Quartz/QuartzJobExecutionAdapter.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Quartz; +using Volo.Abp.Json; namespace Volo.Abp.BackgroundJobs.Quartz { @@ -16,15 +17,18 @@ namespace Volo.Abp.BackgroundJobs.Quartz protected AbpBackgroundJobQuartzOptions BackgroundJobQuartzOptions { get; } protected IServiceScopeFactory ServiceScopeFactory { get; } protected IBackgroundJobExecuter JobExecuter { get; } + protected IJsonSerializer JsonSerializer { get; } public QuartzJobExecutionAdapter( IOptions options, IOptions backgroundJobQuartzOptions, IBackgroundJobExecuter jobExecuter, - IServiceScopeFactory serviceScopeFactory) + IServiceScopeFactory serviceScopeFactory, + IJsonSerializer jsonSerializer) { JobExecuter = jobExecuter; ServiceScopeFactory = serviceScopeFactory; + JsonSerializer = jsonSerializer; Options = options.Value; BackgroundJobQuartzOptions = backgroundJobQuartzOptions.Value; Logger = NullLogger>.Instance; @@ -34,7 +38,7 @@ namespace Volo.Abp.BackgroundJobs.Quartz { using (var scope = ServiceScopeFactory.CreateScope()) { - var args = (TArgs) context.JobDetail.JobDataMap.Get(nameof(TArgs)); + var args = JsonSerializer.Deserialize(context.JobDetail.JobDataMap.GetString(nameof(TArgs))); var jobType = Options.GetJob(typeof(TArgs)).JobType; var jobContext = new JobExecutionContext(scope.ServiceProvider, jobType, args); try @@ -44,16 +48,16 @@ namespace Volo.Abp.BackgroundJobs.Quartz catch (Exception exception) { var jobExecutionException = new JobExecutionException(exception); - - var retryIndex = context.JobDetail.JobDataMap.GetIntValue(QuartzBackgroundJobManager.JobDataPrefix+ QuartzBackgroundJobManager.RetryIndex); + + var retryIndex = context.JobDetail.JobDataMap.GetString(QuartzBackgroundJobManager.JobDataPrefix+ QuartzBackgroundJobManager.RetryIndex).To(); retryIndex++; - context.JobDetail.JobDataMap.Put(QuartzBackgroundJobManager.JobDataPrefix+ QuartzBackgroundJobManager.RetryIndex, retryIndex); - + context.JobDetail.JobDataMap.Put(QuartzBackgroundJobManager.JobDataPrefix+ QuartzBackgroundJobManager.RetryIndex, retryIndex.ToString()); + await BackgroundJobQuartzOptions.RetryStrategy.Invoke(retryIndex, context, jobExecutionException); - + throw jobExecutionException; } } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index 3550213041..e2be84b080 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -280,7 +280,7 @@ namespace Volo.Abp.BlazoriseUI await GetEntitiesAsync(); - StateHasChanged(); + await InvokeAsync(StateHasChanged); } protected virtual async Task OnDataGridReadAsync(DataGridReadDataEventArgs e) @@ -293,7 +293,7 @@ namespace Volo.Abp.BlazoriseUI await GetEntitiesAsync(); - StateHasChanged(); + await InvokeAsync(StateHasChanged); } protected virtual async Task OpenCreateModalAsync() @@ -306,7 +306,7 @@ namespace Volo.Abp.BlazoriseUI // Mapper will not notify Blazor that binded values are changed // so we need to notify it manually by calling StateHasChanged - await InvokeAsync(() => StateHasChanged()); + await InvokeAsync(StateHasChanged); CreateModal.Show(); } @@ -328,7 +328,7 @@ namespace Volo.Abp.BlazoriseUI EditingEntityId = entity.Id; EditingEntity = MapToEditingEntity(entityDto); - await InvokeAsync(() => StateHasChanged()); + await InvokeAsync(StateHasChanged); EditModal.Show(); } @@ -373,11 +373,8 @@ namespace Volo.Abp.BlazoriseUI await CheckCreatePolicyAsync(); var createInput = MapToCreateInput(NewEntity); await AppService.CreateAsync(createInput); - await GetEntitiesAsync(); await OnCreatedEntityAsync(); - - CreateModal.Hide(); } } @@ -386,9 +383,11 @@ namespace Volo.Abp.BlazoriseUI return Task.CompletedTask; } - protected virtual Task OnCreatedEntityAsync() + protected virtual async Task OnCreatedEntityAsync() { - return Task.CompletedTask; + await GetEntitiesAsync(); + + CreateModal.Hide(); } protected virtual async Task UpdateEntityAsync() @@ -400,11 +399,8 @@ namespace Volo.Abp.BlazoriseUI await CheckUpdatePolicyAsync(); var updateInput = MapToUpdateInput(EditingEntity); await AppService.UpdateAsync(EditingEntityId, updateInput); - await GetEntitiesAsync(); await OnUpdatedEntityAsync(); - - EditModal.Hide(); } } @@ -413,9 +409,11 @@ namespace Volo.Abp.BlazoriseUI return Task.CompletedTask; } - protected virtual Task OnUpdatedEntityAsync() + protected virtual async Task OnUpdatedEntityAsync() { - return Task.CompletedTask; + await GetEntitiesAsync(); + + EditModal.Hide(); } protected virtual async Task DeleteEntityAsync(TListViewModel entity) diff --git a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj index de793e078f..3f41412a9e 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj +++ b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj @@ -12,9 +12,9 @@ - - - + + + diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs index 9125a0c8ab..f3cb291f56 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Cli.Auth { var configuration = new IdentityClientConfiguration( CliUrls.AccountAbpIo, - "role email abpio abpio_www abpio_commercial offline_access", + "role email abpio abpio_www abpio_commercial offline_access", "abp-cli", "1q2w3e*", OidcConstants.GrantTypes.Password, @@ -43,6 +43,7 @@ namespace Volo.Abp.Cli.Auth public Task LogoutAsync() { FileHelper.DeleteIfExists(CliPaths.AccessToken); + FileHelper.DeleteIfExists(CliPaths.Lic); return Task.CompletedTask; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliPaths.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliPaths.cs index 2b422446ca..068911ac8c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliPaths.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliPaths.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Text; namespace Volo.Abp.Cli { @@ -10,7 +11,8 @@ namespace Volo.Abp.Cli public static string Root => Path.Combine(AbpRootPath, "cli"); public static string AccessToken => Path.Combine(AbpRootPath, "cli", "access-token.bin"); public static string Build => Path.Combine(AbpRootPath, "build"); - + public static string Lic => Path.Combine(Path.GetTempPath(), Encoding.ASCII.GetString(new byte[] { 65, 98, 112, 76, 105, 99, 101, 110, 115, 101, 46, 98, 105, 110 })); + private static readonly string AbpRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".abp"); } -} +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigrator.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigrator.cs index 0a79b7760a..982ef77065 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigrator.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigrator.cs @@ -26,12 +26,16 @@ namespace Volo.Abp.Cli.Commands throw new Exception("DbMigrator is not found!"); } - var output = CmdHelper.RunCmdAndGetOutput("cd \"" + commandLineArgs.Target + "\" && dotnet ef migrations add Initial -s " + dbMigratorProjectPath); + var output = CmdHelper.RunCmdAndGetOutput($"cd \"{commandLineArgs.Target}\" && dotnet ef migrations add Initial -s \"{dbMigratorProjectPath}\""); if (output.Contains("Done.") && output.Contains("To undo this action") && output.Contains("ef migrations remove")) // Migration added successfully { CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(dbMigratorProjectPath) + "\" && dotnet run"); } + else + { + throw new Exception("Migrations failed: " + output); + } } private string GetDbMigratorProjectPath(string dbMigrationsFolderPath) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 55247c71bb..c82c434916 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -12,11 +12,13 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Cli.Args; using Volo.Abp.Cli.Auth; +using Volo.Abp.Cli.Commands.Services; using Volo.Abp.Cli.Http; using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Templates.App; using Volo.Abp.Cli.ProjectBuilding.Templates.Console; +using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; using Volo.Abp.Cli.ProjectModification; using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; @@ -31,14 +33,17 @@ namespace Volo.Abp.Cli.Commands protected TemplateProjectBuilder TemplateProjectBuilder { get; } public ITemplateInfoProvider TemplateInfoProvider { get; } + public ConnectionStringProvider ConnectionStringProvider { get; } public NewCommand(TemplateProjectBuilder templateProjectBuilder , ITemplateInfoProvider templateInfoProvider, - EfCoreMigrationManager efCoreMigrationManager) + EfCoreMigrationManager efCoreMigrationManager, + ConnectionStringProvider connectionStringProvider) { _efCoreMigrationManager = efCoreMigrationManager; TemplateProjectBuilder = templateProjectBuilder; TemplateInfoProvider = templateInfoProvider; + ConnectionStringProvider = connectionStringProvider; Logger = NullLogger.Instance; } @@ -164,7 +169,7 @@ namespace Volo.Abp.Cli.Commands databaseManagementSystem != DatabaseManagementSystem.NotSpecified && databaseManagementSystem != DatabaseManagementSystem.SQLServer) { - connectionString = GetNewConnectionStringByDbms(databaseManagementSystem, outputFolder); + connectionString = ConnectionStringProvider.GetByDbms(databaseManagementSystem, outputFolder); } commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); @@ -226,8 +231,6 @@ namespace Volo.Abp.Cli.Commands } } - DeleteMigrationsIfNeeded(databaseProvider, databaseManagementSystem, outputFolder); - Logger.LogInformation($"'{projectName}' has been successfully created to '{outputFolder}'"); @@ -236,41 +239,10 @@ namespace Volo.Abp.Cli.Commands var isCommercial = template == AppProTemplate.TemplateName; OpenThanksPage(uiFramework, databaseProvider, isTiered || commandLineArgs.Options.ContainsKey("separate-identity-server"), isCommercial); } - } - - private string GetNewConnectionStringByDbms(DatabaseManagementSystem databaseManagementSystem, string outputFolder) - { - switch (databaseManagementSystem) - { - case DatabaseManagementSystem.MySQL: - return "Server=localhost;Port=3306;Database=MyProjectName;Uid=root;Pwd=myPassword;"; - case DatabaseManagementSystem.PostgreSQL: - return "User ID=root;Password=myPassword;Host=localhost;Port=5432;Database=MyProjectName;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;"; - //case DatabaseManagementSystem.Oracle: - case DatabaseManagementSystem.OracleDevart: - return "Data Source=MyProjectName;Integrated Security=yes;"; - case DatabaseManagementSystem.SQLite: - return $"Data Source={Path.Combine(outputFolder,"database\\MyProjectName.db")};Version=3;"; - default: - return null; - } - } - - private void DeleteMigrationsIfNeeded(DatabaseProvider databaseProvider, DatabaseManagementSystem databaseManagementSystem, string outputFolder) - { - if (databaseManagementSystem == DatabaseManagementSystem.NotSpecified || databaseManagementSystem == DatabaseManagementSystem.SQLServer) - { - return; - } - - if (databaseProvider != DatabaseProvider.NotSpecified && databaseProvider != DatabaseProvider.EntityFrameworkCore) + else if (MicroserviceTemplateBase.IsMicroserviceTemplate(template)) { - return; + OpenMicroserviceDocumentPage(); } - - Logger.LogInformation($"Deleting migrations..."); - - _efCoreMigrationManager.RemoveAllMigrations(outputFolder); } private void OpenThanksPage(UiFramework uiFramework, DatabaseProvider databaseProvider, bool tiered, bool commercial) @@ -282,19 +254,14 @@ namespace Volo.Abp.Cli.Commands var tieredYesNo = tiered ? "yes" : "no"; var url = $"https://{urlPrefix}.abp.io/project-created-success?ui={uiFramework:g}&db={databaseProvider:g}&tiered={tieredYesNo}"; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - url = url.Replace("&", "^&"); - Process.Start(new ProcessStartInfo("cmd", $"/c start {url}") { CreateNoWindow = true }); - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - Process.Start("xdg-open", url); - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - Process.Start("open", url); - } + CmdHelper.OpenWebPage(url); + } + + private void OpenMicroserviceDocumentPage() + { + var url = "https://docs.abp.io/en/commercial/latest/startup-templates/microservice/index"; + + CmdHelper.OpenWebPage(url); } private bool GetCreateSolutionFolderPreference(CommandLineArgs commandLineArgs) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/ConnectionStringProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/ConnectionStringProvider.cs new file mode 100644 index 0000000000..b0da7f9db0 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/ConnectionStringProvider.cs @@ -0,0 +1,30 @@ +using System.IO; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.Commands.Services +{ + public class ConnectionStringProvider : ITransientDependency + { + public string GetByDbms(DatabaseManagementSystem databaseManagementSystem, string outputFolder = "") + { + switch (databaseManagementSystem) + { + case DatabaseManagementSystem.NotSpecified: + case DatabaseManagementSystem.SQLServer: + return "Server=localhost;Database=MyProjectName;Trusted_Connection=True"; + case DatabaseManagementSystem.MySQL: + return "Server=localhost;Port=3306;Database=MyProjectName;Uid=root;Pwd=myPassword;"; + case DatabaseManagementSystem.PostgreSQL: + return "Host=localhost;Port=5432;Database=MyProjectName;User ID=root;Password=myPassword;Pooling=true;MinimumPoolSize=0;MaximumPoolSize=100;Connection Lifetime=0;"; + //case DatabaseManagementSystem.Oracle: + case DatabaseManagementSystem.OracleDevart: + return "Data Source=MyProjectName;Integrated Security=yes;"; + case DatabaseManagementSystem.SQLite: + return $"Data Source={Path.Combine(outputFolder , "MyProjectName.db")};".Replace("\\", "\\\\"); + default: + return null; + } + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs index fadd830c93..260fbb745f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs @@ -21,5 +21,7 @@ public bool AngularUi { get; set; } public bool MvcUi { get; set; } + + public bool BlazorUi { get; set; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs index e793c77011..80fb6db058 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContextExtensions.cs @@ -16,5 +16,10 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building return file; } + + public static FileEntry FindFile(this ProjectBuildContext context, string filePath) + { + return context.Files.FirstOrDefault(f => f.Name == filePath); + } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs index 7b48c780f1..942dd91067 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs @@ -7,8 +7,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps public class RemoveProjectFromSolutionStep : ProjectBuildPipelineStep { private readonly string _projectName; - private readonly string _solutionFilePath; - private readonly string _projectFolderPath; + private string _solutionFilePath; + private string _projectFolderPath; private string ProjectNameWithQuotes => $"\"{_projectName}\""; @@ -18,12 +18,19 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps string projectFolderPath = null) { _projectName = projectName; - _solutionFilePath = solutionFilePath ?? "/aspnet-core/MyCompanyName.MyProjectName.sln"; - _projectFolderPath = projectFolderPath ?? ("/aspnet-core/src/" + projectName); + _solutionFilePath = solutionFilePath; + _projectFolderPath = projectFolderPath; } public override void Execute(ProjectBuildContext context) { + SetSolutionAndProjectPathsIfNull(context); + + if (_solutionFilePath == null || _projectFolderPath == null) + { + return; + } + new RemoveFolderStep(_projectFolderPath).Execute(context); var solutionFile = context.GetFile(_solutionFilePath); solutionFile.NormalizeLineEndings(); @@ -75,5 +82,20 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps return null; } + + private void SetSolutionAndProjectPathsIfNull(ProjectBuildContext context) + { + + if (_solutionFilePath == null) + { + _solutionFilePath = context.FindFile("/aspnet-core/MyCompanyName.MyProjectName.sln")?.Name ?? + context.FindFile("/MyCompanyName.MyProjectName.sln")?.Name; + } + if (_projectFolderPath == null) + { + _projectFolderPath = context.FindFile("/aspnet-core/src/" + _projectName.EnsureEndsWith('/'))?.Name ?? + context.FindFile("/src/" + _projectName.EnsureEndsWith('/'))?.Name; + } + } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs index 94056cbf5a..1299f5b15d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; using Volo.Abp.Cli.ProjectBuilding.Files; namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps @@ -12,6 +13,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.Host.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameHttpApiHostModule.cs"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + + var appSettingsFiles = context.Files.Where(f => f.Name.EndsWith("appSettings.json", StringComparison.InvariantCultureIgnoreCase)).ToList(); + foreach (var appSettings in appSettingsFiles) + { + appSettings.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs index abdb9e45f5..611d4d5266 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs @@ -54,10 +54,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps if (_companyName != null) { RenameHelper.RenameAll(_entries, _companyNamePlaceHolder, _companyName); + RenameHelper.RenameAll(_entries, _companyNamePlaceHolder.ToCamelCase(), _companyName.ToCamelCase()); } else { RenameHelper.RenameAll(_entries, _companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder); + RenameHelper.RenameAll(_entries, _companyNamePlaceHolder.ToCamelCase() + "." + _projectNamePlaceHolder.ToCamelCase(), _projectNamePlaceHolder.ToCamelCase()); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs index 8942103873..8f17b90702 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { foreach (var file in context.Files) { - if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".csproj") || file.Name.EndsWith(".cshtml")) + if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".csproj") || file.Name.EndsWith(".cshtml") || file.Name.EndsWith(".json")) { file.RemoveTemplateCode(); file.RemoveTemplateCodeMarkers(); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs index 31c8f216b4..8b7cfeb440 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs @@ -1,5 +1,6 @@ using Volo.Abp.Cli.ProjectBuilding.Building.Steps; using Volo.Abp.Cli.ProjectBuilding.Templates.App; +using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule; namespace Volo.Abp.Cli.ProjectBuilding.Building @@ -16,15 +17,10 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building pipeline.Steps.Add(new ProjectReferenceReplaceStep()); pipeline.Steps.Add(new TemplateCodeDeleteStep()); - - if (context.BuildArgs.ConnectionString != null) - { - pipeline.Steps.Add(new ConnectionStringChangeStep()); - } - pipeline.Steps.Add(new SolutionRenameStep()); if (context.Template.Name == AppProTemplate.TemplateName || + context.Template.Name == MicroserviceProTemplate.TemplateName || context.Template.Name == ModuleProTemplate.TemplateName) { pipeline.Steps.Add(new LicenseCodeReplaceStep()); // todo: move to custom steps? @@ -37,7 +33,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building } if ((context.BuildArgs.UiFramework == UiFramework.Mvc || context.BuildArgs.UiFramework == UiFramework.Blazor) - && context.BuildArgs.MobileApp == MobileApp.None) + && context.BuildArgs.MobileApp == MobileApp.None && context.Template.Name != MicroserviceProTemplate.TemplateName) { pipeline.Steps.Add(new RemoveRootFolderStep()); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs index 2aefcfd1a9..b9308dd707 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs @@ -8,6 +8,7 @@ using Volo.Abp.Cli.Http; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Templates.App; using Volo.Abp.Cli.ProjectBuilding.Templates.Console; +using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule; using Volo.Abp.Cli.ProjectBuilding.Templates.Wpf; using Volo.Abp.DependencyInjection; @@ -49,6 +50,8 @@ namespace Volo.Abp.Cli.ProjectBuilding return new AppTemplate(); case AppProTemplate.TemplateName: return new AppProTemplate(); + case MicroserviceProTemplate.TemplateName: + return new MicroserviceProTemplate(); case ModuleTemplate.TemplateName: return new ModuleTemplate(); case ModuleProTemplate.TemplateName: diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs index 27cfa0468b..2a596b73a7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using NuGet.Versioning; using Volo.Abp.Cli.Commands; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Building.Steps; @@ -25,13 +26,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App SwitchDatabaseProvider(context, steps); DeleteUnrelatedProjects(context, steps); + RemoveMigrations(context, steps); ConfigurePublicWebSite(context, steps); RemoveUnnecessaryPorts(context, steps); RandomizeSslPorts(context, steps); RandomizeStringEncryption(context, steps); UpdateNuGetConfig(context, steps); + ChangeConnectionString(context, steps); CleanupFolderHierarchy(context, steps); - RemoveMigrations(context, steps); return steps; } @@ -138,12 +140,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App steps.Add(new ChangePublicAuthPortStep()); } - if (context.BuildArgs.DatabaseProvider != DatabaseProvider.NotSpecified || context.BuildArgs.DatabaseProvider != DatabaseProvider.EntityFrameworkCore) + if (context.BuildArgs.DatabaseProvider != DatabaseProvider.NotSpecified && context.BuildArgs.DatabaseProvider != DatabaseProvider.EntityFrameworkCore) { steps.Add(new RemoveEfCoreDependencyFromPublicStep()); } - if (context.BuildArgs.ExtraProperties.ContainsKey("without-cms-kit")) + // We disabled cms-kit for v4.2 release. + if (true || context.BuildArgs.ExtraProperties.ContainsKey("without-cms-kit")) { steps.Add(new RemoveCmsKitStep()); } @@ -277,12 +280,25 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App private static void RemoveMigrations(ProjectBuildContext context, List steps) { - steps.Add(new RemoveFolderStep("/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations")); + if (string.IsNullOrWhiteSpace(context.BuildArgs.Version) || + SemanticVersion.Parse(context.BuildArgs.Version) > new SemanticVersion(4,1,99)) + { + steps.Add(new RemoveFolderStep("/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations")); + } + } + + private static void ChangeConnectionString(ProjectBuildContext context, List steps) + { + if (context.BuildArgs.ConnectionString != null) + { + steps.Add(new ConnectionStringChangeStep()); + } } private static void CleanupFolderHierarchy(ProjectBuildContext context, List steps) { - if (context.BuildArgs.UiFramework == UiFramework.Mvc && context.BuildArgs.MobileApp == MobileApp.None) + if ((context.BuildArgs.UiFramework == UiFramework.Mvc || context.BuildArgs.UiFramework == UiFramework.Blazor) && + context.BuildArgs.MobileApp == MobileApp.None) { steps.Add(new MoveFolderStep("/aspnet-core/", "/")); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceProTemplate.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceProTemplate.cs new file mode 100644 index 0000000000..aef7ffec3b --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceProTemplate.cs @@ -0,0 +1,16 @@ +namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice +{ + public class MicroserviceProTemplate : MicroserviceTemplateBase + { + /// + /// "microservice-pro". + /// + public const string TemplateName = "microservice-pro"; + + public MicroserviceProTemplate() + : base(TemplateName) + { + DocumentUrl = null; // todo: set this + } + } +} 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 new file mode 100644 index 0000000000..52ff3c9c91 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using JetBrains.Annotations; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.Cli.ProjectBuilding.Building.Steps; + +namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice +{ + public abstract class MicroserviceTemplateBase : TemplateInfo + { + protected MicroserviceTemplateBase([NotNull] string name) + : base(name) + { + } + + public static bool IsMicroserviceTemplate(string templateName) + { + return templateName == MicroserviceProTemplate.TemplateName; + } + + public override IEnumerable GetCustomSteps(ProjectBuildContext context) + { + var steps = new List(); + + DeleteUnrelatedProjects(context, steps); + RandomizeStringEncryption(context, steps); + UpdateNuGetConfig(context, steps); + + return steps; + } + + private static void DeleteUnrelatedProjects(ProjectBuildContext context, List steps) + { + switch (context.BuildArgs.UiFramework) + { + case UiFramework.None: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor")); + steps.Add(new RemoveFolderStep("/angular")); + break; + + case UiFramework.Angular: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor")); + break; + + case UiFramework.Blazor: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web")); + steps.Add(new RemoveFolderStep("/angular")); + break; + + case UiFramework.Mvc: + case UiFramework.NotSpecified: + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor")); + steps.Add(new RemoveFolderStep("/angular")); + break; + } + } + + private static void RandomizeStringEncryption(ProjectBuildContext context, List steps) + { + steps.Add(new RandomizeStringEncryptionStep()); + } + + private static void UpdateNuGetConfig(ProjectBuildContext context, List steps) + { + steps.Add(new UpdateNuGetConfigStep("/NuGet.Config")); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs index 5e8db9a346..e26e4a6d25 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs @@ -19,6 +19,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Module DeleteUnrelatedProjects(context, steps); RandomizeSslPorts(context, steps); UpdateNuGetConfig(context, steps); + ChangeConnectionString(context, steps); CleanupFolderHierarchy(context, steps); return steps; @@ -75,9 +76,18 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Module private static void UpdateNuGetConfig(ProjectBuildContext context, List steps) { + steps.Add(new UpdateNuGetConfigStep("/aspnet-core/NuGet.Config")); steps.Add(new UpdateNuGetConfigStep("/NuGet.Config")); } + private static void ChangeConnectionString(ProjectBuildContext context, List steps) + { + if (context.BuildArgs.ConnectionString != null) + { + steps.Add(new ConnectionStringChangeStep()); + } + } + private void CleanupFolderHierarchy(ProjectBuildContext context, List steps) { steps.Add(new MoveFolderStep("/aspnet-core/", "/")); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs index 6c89656b47..e4e5f0bb2e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs @@ -39,7 +39,7 @@ namespace Volo.Abp.Cli.ProjectModification } catch (Exception e) { - Logger.LogError("Unable to add angular source code: " + e.Message); + Logger.LogError("Unable to add angular source code: " + e.Message + Environment.NewLine + e.StackTrace); } } @@ -127,6 +127,11 @@ namespace Volo.Abp.Cli.ProjectModification subFolderName = $"/{subFolderName}"; } + if (compilerOptions["paths"][$"{projectPackageName}{subFolderName}"] != null) + { + continue; + } + ((JObject) compilerOptions["paths"]).Add( new JProperty($"{projectPackageName}{subFolderName}", new JArray(new object[] {publicApi}) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs index b26ca1be90..b15ffaa274 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs @@ -27,28 +27,6 @@ namespace Volo.Abp.Cli.ProjectModification GetStartupProjectOption(startupProject)); } - public void RemoveAllMigrations(string solutionFolder) - { - if (Directory.Exists(Path.Combine(solutionFolder, "aspnet-core"))) - { - solutionFolder = Path.Combine(solutionFolder, "aspnet-core"); - } - - var srcFolder = Path.Combine(solutionFolder, "src"); - - var migrationsFolder = Directory.GetDirectories(srcFolder) - .FirstOrDefault(d => d.EndsWith(".EntityFrameworkCore.DbMigrations")); - - if (migrationsFolder != null) - { - Directory.Delete(Path.Combine(migrationsFolder, "Migrations"), true); - } - else - { - Logger.LogWarning("No migration found to delete."); - } - } - protected virtual string ParseModuleName(string fullModuleName) { var words = fullModuleName?.Split('.'); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index d8571843fe..8fc800c146 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -345,11 +345,20 @@ namespace Volo.Abp.Cli.ProjectModification protected virtual List GetPackageVersionList(JProperty package) { - var versionListAsJson = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} versions"); + var output = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} versions --json"); + + var versionListAsJson = ExtractVersions(output); + return JsonConvert.DeserializeObject(versionListAsJson) .OrderByDescending(SemanticVersion.Parse, new VersionComparer()).ToList(); } + protected virtual string ExtractVersions(string output) + { + var arrayStart = output.IndexOf('['); + return output.Substring(arrayStart, output.IndexOf(']') - arrayStart + 1); + } + protected virtual bool SpecifiedVersionExists(string version, JProperty package) { var versionList = GetPackageVersionList(package); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 8cfbe5cb94..90f4ff5d8f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -115,7 +115,7 @@ namespace Volo.Abp.Cli.ProjectModification await NugetPackageToLocalReferenceConverter.Convert(module, solutionFile); } - await AddAngularSourceCode(modulesFolderInSolution, solutionFile); + await AddAngularSourceCode(modulesFolderInSolution, solutionFile, module.Name, newTemplate || newProTemplate); } else { @@ -277,7 +277,7 @@ namespace Volo.Abp.Cli.ProjectModification } } - private async Task AddAngularSourceCode(string modulesFolderInSolution, string solutionFilePath) + private async Task AddAngularSourceCode(string modulesFolderInSolution, string solutionFilePath, string moduleName, bool newTemplate) { var angularPath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(solutionFilePath)), "angular"); @@ -287,6 +287,11 @@ namespace Volo.Abp.Cli.ProjectModification return; } + if (newTemplate) + { + MoveAngularFolderInNewTemplate(modulesFolderInSolution, moduleName); + } + await AngularModuleSourceCodeAdder.AddAsync(solutionFilePath, angularPath); } @@ -304,6 +309,30 @@ namespace Volo.Abp.Cli.ProjectModification } } + private static void MoveAngularFolderInNewTemplate(string modulesFolderInSolution, string moduleName) + { + var moduleAngularFolder = Path.Combine(modulesFolderInSolution, moduleName, "angular"); + + if (!Directory.Exists(moduleAngularFolder)) + { + return; + } + + var files = Directory.GetFiles(moduleAngularFolder); + var folders = Directory.GetDirectories(moduleAngularFolder); + + Directory.CreateDirectory(Path.Combine(moduleAngularFolder, moduleName)); + + foreach (var file in files) + { + File.Move(file, Path.Combine(moduleAngularFolder, moduleName, Path.GetFileName(file))); + } + foreach (var folder in folders) + { + Directory.Move(folder, Path.Combine(moduleAngularFolder, moduleName, Path.GetFileName(folder))); + } + } + private async Task DownloadSourceCodesToSolutionFolder(ModuleWithMastersInfo module, string modulesFolderInSolution, string version = null, bool newTemplate = false, bool newProTemplate = false) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs index 07052a8f48..07b470225a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.IO; using System.Runtime.InteropServices; namespace Volo.Abp.Cli.Utils @@ -7,6 +8,23 @@ namespace Volo.Abp.Cli.Utils { public static int SuccessfulExitCode = 0; + public static void OpenWebPage(string url) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + url = url.Replace("&", "^&"); + Process.Start(new ProcessStartInfo("cmd", $"/c start {url}") { CreateNoWindow = true }); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + Process.Start("xdg-open", url); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + Process.Start("open", url); + } + } + public static void Run(string file, string arguments) { var procStartInfo = new ProcessStartInfo(file, arguments); @@ -47,7 +65,7 @@ namespace Volo.Abp.Cli.Utils { process.StartInfo = new ProcessStartInfo(CmdHelper.GetFileName()) { - Arguments = CmdHelper.GetArguments(command), + Arguments = GetArguments(command), UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, @@ -86,14 +104,28 @@ namespace Volo.Abp.Cli.Utils public static string GetFileName() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + //Windows + return "cmd.exe"; + } + + //Linux or OSX + if (File.Exists("/bin/bash")) { - //TODO: Test this. it should work for both operation systems. return "/bin/bash"; } - //Windows default. - return "cmd.exe"; + if (File.Exists("/bin/sh")) + { + return "/bin/sh"; //some Linux distributions like Alpine doesn't have bash + } + + throw new AbpException($"Cannot determine shell command for this OS! " + + $"Running on OS: {System.Runtime.InteropServices.RuntimeInformation.OSDescription} | " + + $"OS Architecture: {System.Runtime.InteropServices.RuntimeInformation.OSArchitecture} | " + + $"Framework: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription} | " + + $"Process Architecture{System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture}"); } } } diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs index 232afb4280..4ac41663e4 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs @@ -35,6 +35,7 @@ namespace Volo.Abp.Application.Services { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } public static string[] CommonPostfixes { get; set; } = { "AppService", "ApplicationService", "Service" }; @@ -51,7 +52,7 @@ namespace Volo.Abp.Application.Services ? provider.GetRequiredService() : (IObjectMapper) provider.GetRequiredService(typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext))); - public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); + protected IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs index 5e81e2270d..2f8dd28afc 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; using System.Reflection; using JetBrains.Annotations; @@ -15,6 +13,17 @@ namespace Volo.Abp.Domain.Entities ///
  • public static class EntityHelper { + public static bool IsMultiTenant() + where TEntity : IEntity + { + return IsMultiTenant(typeof(TEntity)); + } + + public static bool IsMultiTenant(Type type) + { + return typeof(IMultiTenant).IsAssignableFrom(type); + } + public static bool EntityEquals(IEntity entity1, IEntity entity2) { if (entity1 == null || entity2 == null) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs index 3bda51bd2e..f1136c4ea2 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs @@ -20,8 +20,10 @@ namespace Volo.Abp.Domain.Repositories { /// /// Get a single entity by the given . - /// It returns null if no entity with the given . + /// + /// It returns null if there is no entity with the given . /// It throws if there are multiple entities with the given . + /// /// /// A condition to find the entity /// Set true to include all children of this entity @@ -34,8 +36,10 @@ namespace Volo.Abp.Domain.Repositories /// /// Get a single entity by the given . + /// /// It throws if there is no entity with the given . /// It throws if there are multiple entities with the given . + /// /// /// A condition to filter entities /// Set true to include all children of this entity @@ -47,10 +51,11 @@ namespace Volo.Abp.Domain.Repositories ); /// - /// Deletes many entities by function. - /// Notice that: All entities fits to given predicate are retrieved and deleted. - /// This may cause major performance problems if there are too many entities with - /// given predicate. + /// Deletes many entities by the given . + /// + /// Please note: This may cause major performance problems if there are too many entities returned for a + /// given predicate and the database provider doesn't have a way to efficiently delete many entities. + /// /// /// A condition to filter entities /// @@ -69,4 +74,4 @@ namespace Volo.Abp.Domain.Repositories where TEntity : class, IEntity { } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs index 751b938f1d..39938b081a 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs @@ -13,11 +13,12 @@ namespace Volo.Abp.Domain.Services { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); - public IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); + protected IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/nl.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/nl.json index 923671e885..3130094f62 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/nl.json +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/nl.json @@ -1,23 +1,25 @@ { "culture": "nl", "texts": { - "DisplayName:Abp.Mailing.DefaultFromAddress": "Standard vanaf adres", - "DisplayName:Abp.Mailing.DefaultFromDisplayName": "Standaard vanaf weergave naam", + "DisplayName:Abp.Mailing.DefaultFromAddress": "Standaard vanaf adres", + "DisplayName:Abp.Mailing.DefaultFromDisplayName": "Standaard vanaf weergavenaam", "DisplayName:Abp.Mailing.Smtp.Host": "Host", "DisplayName:Abp.Mailing.Smtp.Port": "Poort", - "DisplayName:Abp.Mailing.Smtp.UserName": "Gebruiker naam", - "DisplayName:Abp.Mailing.Smtp.Password": "wachtwoord", + "DisplayName:Abp.Mailing.Smtp.UserName": "Gebruikersnaam", + "DisplayName:Abp.Mailing.Smtp.Password": "Wachtwoord", "DisplayName:Abp.Mailing.Smtp.Domain": "Domein", "DisplayName:Abp.Mailing.Smtp.EnableSsl": "SSL toestaan", "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "Gebruik standaard inloggegevens", - "Description:Abp.Mailing.DefaultFromAddress": "Standard vanaf adres", - "Description:Abp.Mailing.DefaultFromDisplayName": "Standaard vanaf weergave naam", + "Description:Abp.Mailing.DefaultFromAddress": "Standaard vanaf adres", + "Description:Abp.Mailing.DefaultFromDisplayName": "Standaard vanaf weergavenaam", "Description:Abp.Mailing.Smtp.Host": "De naam of het IP-adres van de host die wordt gebruikt voor SMTP-transacties.", "Description:Abp.Mailing.Smtp.Port": "De poort die wordt gebruikt voor SMTP-transacties.", "Description:Abp.Mailing.Smtp.UserName": "Gebruikersnaam gekoppeld aan de inloggegevens.", "Description:Abp.Mailing.Smtp.Password": "Het wachtwoord voor de gebruikersnaam die bij de inloggegevens hoort.", "Description:Abp.Mailing.Smtp.Domain": "Het domein of de computernaam die de inloggegevens verifieert.", "Description:Abp.Mailing.Smtp.EnableSsl": "Of de SmtpClient Secure Sockets Layer (SSL) gebruikt om de verbinding te versleutelen.", - "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Of de standaard inloggegevens worden verzonden met verzoeken." + "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Of de standaard inloggegevens worden verzonden met verzoeken.", + "TextTemplate:StandardEmailTemplates.Layout": "Standaard sjabloon voor e-mail lay-out", + "TextTemplate:StandardEmailTemplates.Message": "Eenvoudig berichtsjabloon voor e-mails" } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj index 8616838cc0..e8c90ccf13 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj @@ -19,7 +19,7 @@ - +
    diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/EntityFrameworkCore/AbpModelBuilderExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/EntityFrameworkCore/AbpModelBuilderExtensions.cs index 7148cb69bd..1ccfee1506 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/EntityFrameworkCore/AbpModelBuilderExtensions.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/EntityFrameworkCore/AbpModelBuilderExtensions.cs @@ -1,10 +1,72 @@ using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Microsoft.EntityFrameworkCore { public static class AbpModelBuilderExtensions { private const string ModelDatabaseProviderAnnotationKey = "_Abp_DatabaseProvider"; + private const string ModelMultiTenancySideAnnotationKey = "_Abp_MultiTenancySide"; + + #region MultiTenancySide + + public static void SetMultiTenancySide( + this ModelBuilder modelBuilder, + MultiTenancySides side) + { + modelBuilder.Model.SetAnnotation(ModelMultiTenancySideAnnotationKey, side); + } + + public static MultiTenancySides GetMultiTenancySide(this ModelBuilder modelBuilder) + { + var value = modelBuilder.Model[ModelMultiTenancySideAnnotationKey]; + if (value == null) + { + return MultiTenancySides.Both; + } + + return (MultiTenancySides) value; + } + + /// + /// Returns true if this is a database schema that is used by the host + /// but can also be shared with the tenants. + /// + public static bool IsHostDatabase(this ModelBuilder modelBuilder) + { + return modelBuilder.GetMultiTenancySide().HasFlag(MultiTenancySides.Host); + } + + /// + /// Returns true if this is a database schema that is used by the tenants + /// but can also be shared with the host. + /// + public static bool IsTenantDatabase(this ModelBuilder modelBuilder) + { + return modelBuilder.GetMultiTenancySide().HasFlag(MultiTenancySides.Tenant); + } + + /// + /// Returns true if this is a database schema that is only used by the host + /// and should not contain tenant-only tables. + /// + public static bool IsHostOnlyDatabase(this ModelBuilder modelBuilder) + { + return modelBuilder.GetMultiTenancySide() == MultiTenancySides.Host; + } + + /// + /// Returns true if this is a database schema that is only used by tenants. + /// and should not contain host-only tables. + /// + public static bool IsTenantOnlyDatabase(this ModelBuilder modelBuilder) + { + return modelBuilder.GetMultiTenancySide() == MultiTenancySides.Tenant; + } + + #endregion + + #region DatabaseProvider public static void SetDatabaseProvider( this ModelBuilder modelBuilder, @@ -61,7 +123,7 @@ namespace Microsoft.EntityFrameworkCore { modelBuilder.SetDatabaseProvider(EfCoreDatabaseProvider.InMemory); } - + public static bool IsUsingInMemory( this ModelBuilder modelBuilder) { @@ -73,7 +135,7 @@ namespace Microsoft.EntityFrameworkCore { modelBuilder.SetDatabaseProvider(EfCoreDatabaseProvider.Cosmos); } - + public static bool IsUsingCosmos( this ModelBuilder modelBuilder) { @@ -85,11 +147,13 @@ namespace Microsoft.EntityFrameworkCore { modelBuilder.SetDatabaseProvider(EfCoreDatabaseProvider.Firebird); } - + public static bool IsUsingFirebird( this ModelBuilder modelBuilder) { return modelBuilder.GetDatabaseProvider() == EfCoreDatabaseProvider.Firebird; } + + #endregion } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index e2a9871a22..d673ff2c28 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -13,6 +13,7 @@ using Volo.Abp.Domain.Entities; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.DependencyInjection; using Volo.Abp.Guids; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore { @@ -21,18 +22,42 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore where TEntity : class, IEntity { [Obsolete("Use GetDbContextAsync() method.")] - protected virtual TDbContext DbContext => _dbContextProvider.GetDbContext(); + protected virtual TDbContext DbContext => GetDbContext(); [Obsolete("Use GetDbContextAsync() method.")] - DbContext IEfCoreRepository.DbContext => DbContext.As(); + DbContext IEfCoreRepository.DbContext => GetDbContext() as DbContext; async Task IEfCoreRepository.GetDbContextAsync() { return await GetDbContextAsync() as DbContext; } + [Obsolete("Use GetDbContextAsync() method.")] + private TDbContext GetDbContext() + { + // Multi-tenancy unaware entities should always use the host connection string + if (!EntityHelper.IsMultiTenant()) + { + using (CurrentTenant.Change(null)) + { + return _dbContextProvider.GetDbContext(); + } + } + + return _dbContextProvider.GetDbContext(); + } + protected virtual Task GetDbContextAsync() { + // Multi-tenancy unaware entities should always use the host connection string + if (!EntityHelper.IsMultiTenant()) + { + using (CurrentTenant.Change(null)) + { + return _dbContextProvider.GetDbContextAsync(); + } + } + return _dbContextProvider.GetDbContextAsync(); } @@ -264,10 +289,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore .Where(predicate) .ToListAsync(GetCancellationToken(cancellationToken)); - foreach (var entity in entities) - { - dbSet.Remove(entity); - } + await DeleteManyAsync(entities, autoSave, cancellationToken); if (autoSave) { @@ -409,7 +431,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public virtual async Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) { return includeDetails - ? await (await WithDetailsAsync()).FirstOrDefaultAsync(e => e.Id.Equals(id), GetCancellationToken(cancellationToken)) + ? await (await WithDetailsAsync()).OrderBy(e => e.Id).FirstOrDefaultAsync(e => e.Id.Equals(id), GetCancellationToken(cancellationToken)) : await (await GetDbSetAsync()).FindAsync(new object[] {id}, GetCancellationToken(cancellationToken)); } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/DbContextOptionsFactory.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/DbContextOptionsFactory.cs index 0147de12fb..c0603ec6f1 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/DbContextOptionsFactory.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/DbContextOptionsFactory.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.Data; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.EntityFrameworkCore.DependencyInjection { @@ -86,16 +87,34 @@ namespace Volo.Abp.EntityFrameworkCore.DependencyInjection } var connectionStringName = ConnectionStringNameAttribute.GetConnStringName(); - - //Use DefaultConnectionStringResolver.Resolve when we remove IConnectionStringResolver.Resolve -#pragma warning disable 618 - var connectionString = serviceProvider.GetRequiredService().Resolve(connectionStringName); -#pragma warning restore 618 + var connectionString = ResolveConnectionString(serviceProvider, connectionStringName); return new DbContextCreationContext( connectionStringName, connectionString ); } + + private static string ResolveConnectionString( + IServiceProvider serviceProvider, + string connectionStringName) + { + // Use DefaultConnectionStringResolver.Resolve when we remove IConnectionStringResolver.Resolve +#pragma warning disable 618 + var connectionStringResolver = serviceProvider.GetRequiredService(); + var currentTenant = serviceProvider.GetRequiredService(); + + // Multi-tenancy unaware contexts should always use the host connection string + if (typeof(TDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false)) + { + using (currentTenant.Change(null)) + { + return connectionStringResolver.Resolve(connectionStringName); + } + } + + return connectionStringResolver.Resolve(connectionStringName); +#pragma warning restore 618 + } } } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/EfCoreTransactionApi.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/EfCoreTransactionApi.cs index 99622dda96..ce9afacef1 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/EfCoreTransactionApi.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/EfCoreTransactionApi.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Threading; namespace Volo.Abp.Uow.EntityFrameworkCore { @@ -14,22 +15,22 @@ namespace Volo.Abp.Uow.EntityFrameworkCore public IEfCoreDbContext StarterDbContext { get; } public List AttendedDbContexts { get; } - public EfCoreTransactionApi(IDbContextTransaction dbContextTransaction, IEfCoreDbContext starterDbContext) + protected ICancellationTokenProvider CancellationTokenProvider { get; } + + public EfCoreTransactionApi( + IDbContextTransaction dbContextTransaction, + IEfCoreDbContext starterDbContext, + ICancellationTokenProvider cancellationTokenProvider) { DbContextTransaction = dbContextTransaction; StarterDbContext = starterDbContext; + CancellationTokenProvider = cancellationTokenProvider; AttendedDbContexts = new List(); } - public Task CommitAsync() - { - Commit(); - return Task.CompletedTask; - } - - protected void Commit() + public async Task CommitAsync() { - DbContextTransaction.Commit(); + await DbContextTransaction.CommitAsync(CancellationTokenProvider.Token); foreach (var dbContext in AttendedDbContexts) { @@ -38,7 +39,7 @@ namespace Volo.Abp.Uow.EntityFrameworkCore continue; //Relational databases use the shared transaction } - dbContext.Database.CommitTransaction(); + await dbContext.Database.CommitTransactionAsync(CancellationTokenProvider.Token); } } @@ -47,15 +48,19 @@ namespace Volo.Abp.Uow.EntityFrameworkCore DbContextTransaction.Dispose(); } - public void Rollback() + public async Task RollbackAsync(CancellationToken cancellationToken) { - DbContextTransaction.Rollback(); - } + await DbContextTransaction.RollbackAsync(CancellationTokenProvider.FallbackToProvider(cancellationToken)); - public Task RollbackAsync(CancellationToken cancellationToken) - { - DbContextTransaction.Rollback(); - return Task.CompletedTask; + foreach (var dbContext in AttendedDbContexts) + { + if (dbContext.As().HasRelationalTransactionManager()) + { + continue; //Relational databases use the shared transaction + } + + await dbContext.Database.RollbackTransactionAsync(CancellationTokenProvider.FallbackToProvider(cancellationToken)); + } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs index 364a29fb07..89cc69fb74 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Uow/EntityFrameworkCore/UnitOfWorkDbContextProvider.cs @@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.DependencyInjection; +using Volo.Abp.MultiTenancy; using Volo.Abp.Threading; namespace Volo.Abp.Uow.EntityFrameworkCore @@ -23,15 +24,18 @@ namespace Volo.Abp.Uow.EntityFrameworkCore private readonly IUnitOfWorkManager _unitOfWorkManager; private readonly IConnectionStringResolver _connectionStringResolver; private readonly ICancellationTokenProvider _cancellationTokenProvider; + private readonly ICurrentTenant _currentTenant; public UnitOfWorkDbContextProvider( IUnitOfWorkManager unitOfWorkManager, IConnectionStringResolver connectionStringResolver, - ICancellationTokenProvider cancellationTokenProvider) + ICancellationTokenProvider cancellationTokenProvider, + ICurrentTenant currentTenant) { _unitOfWorkManager = unitOfWorkManager; _connectionStringResolver = connectionStringResolver; _cancellationTokenProvider = cancellationTokenProvider; + _currentTenant = currentTenant; Logger = NullLogger>.Instance; } @@ -39,7 +43,8 @@ namespace Volo.Abp.Uow.EntityFrameworkCore [Obsolete("Use GetDbContextAsync method.")] public TDbContext GetDbContext() { - if (!UnitOfWork.DisableObsoleteDbContextCreationWarning.Value) + if (UnitOfWork.EnableObsoleteDbContextCreationWarning && + !UnitOfWorkManager.DisableObsoleteDbContextCreationWarning.Value) { Logger.LogWarning( "UnitOfWorkDbContextProvider.GetDbContext is deprecated. Use GetDbContextAsync instead! " + @@ -56,7 +61,7 @@ namespace Volo.Abp.Uow.EntityFrameworkCore } var connectionStringName = ConnectionStringNameAttribute.GetConnStringName(); - var connectionString = _connectionStringResolver.Resolve(connectionStringName); + var connectionString = ResolveConnectionString(connectionStringName); var dbContextKey = $"{typeof(TDbContext).FullName}_{connectionString}"; @@ -78,7 +83,7 @@ namespace Volo.Abp.Uow.EntityFrameworkCore } var connectionStringName = ConnectionStringNameAttribute.GetConnStringName(); - var connectionString = await _connectionStringResolver.ResolveAsync(connectionStringName); + var connectionString = await ResolveConnectionStringAsync(connectionStringName); var dbContextKey = $"{typeof(TDbContext).FullName}_{connectionString}"; @@ -167,7 +172,8 @@ namespace Volo.Abp.Uow.EntityFrameworkCore transactionApiKey, new EfCoreTransactionApi( dbtransaction, - dbContext + dbContext, + _cancellationTokenProvider ) ); @@ -185,7 +191,10 @@ namespace Volo.Abp.Uow.EntityFrameworkCore } else { - dbContext.Database.BeginTransaction(); //TODO: Why not using the new created transaction? + /* No need to store the returning IDbContextTransaction for non-relational databases + * since EfCoreTransactionApi will handle the commit/rollback over the DbContext instance. + */ + dbContext.Database.BeginTransaction(); } activeTransaction.AttendedDbContexts.Add(dbContext); @@ -211,7 +220,8 @@ namespace Volo.Abp.Uow.EntityFrameworkCore transactionApiKey, new EfCoreTransactionApi( dbTransaction, - dbContext + dbContext, + _cancellationTokenProvider ) ); @@ -229,7 +239,10 @@ namespace Volo.Abp.Uow.EntityFrameworkCore } else { - await dbContext.Database.BeginTransactionAsync(GetCancellationToken()); //TODO: Why not using the new created transaction? + /* No need to store the returning IDbContextTransaction for non-relational databases + * since EfCoreTransactionApi will handle the commit/rollback over the DbContext instance. + */ + await dbContext.Database.BeginTransactionAsync(GetCancellationToken()); } activeTransaction.AttendedDbContexts.Add(dbContext); @@ -238,6 +251,35 @@ namespace Volo.Abp.Uow.EntityFrameworkCore } } + private async Task ResolveConnectionStringAsync(string connectionStringName) + { + // Multi-tenancy unaware contexts should always use the host connection string + if (typeof(TDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false)) + { + using (_currentTenant.Change(null)) + { + return await _connectionStringResolver.ResolveAsync(connectionStringName); + } + } + + return await _connectionStringResolver.ResolveAsync(connectionStringName); + } + + [Obsolete("Use ResolveConnectionStringAsync method.")] + private string ResolveConnectionString(string connectionStringName) + { + // Multi-tenancy unaware contexts should always use the host connection string + if (typeof(TDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false)) + { + using (_currentTenant.Change(null)) + { + return _connectionStringResolver.Resolve(connectionStringName); + } + } + + return _connectionStringResolver.Resolve(connectionStringName); + } + protected virtual CancellationToken GetCancellationToken(CancellationToken preferredValue = default) { return _cancellationTokenProvider.FallbackToProvider(preferredValue); diff --git a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs index eb8c4eb804..6c0c8ef193 100644 --- a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs +++ b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs @@ -141,7 +141,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling { foreach (var key in exception.Data.Keys) { - localizedValue = localizedValue.Replace("{" + key + "}", exception.Data[key].ToString()); + localizedValue = localizedValue.Replace("{" + key + "}", exception.Data[key]?.ToString()); } } diff --git a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/nl.json b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/nl.json index f96c1f9a9c..f9e28a142e 100644 --- a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/nl.json +++ b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/nl.json @@ -4,7 +4,7 @@ "InternalServerErrorMessage": "Er is een interne fout opgetreden tijdens uw verzoek!", "ValidationErrorMessage": "Uw verzoek is niet geldig!", "ValidationNarrativeErrorMessageTitle": "Tijdens de validatie zijn de volgende fouten gedetecteerd.", - "DefaultErrorMessage": "er is een fout opgetreden!", + "DefaultErrorMessage": "Er is een fout opgetreden!", "DefaultErrorMessageDetail": "Foutdetails niet verzonden door server.", "DefaultErrorMessage401": "U bent niet geverifieerd!", "DefaultErrorMessage401Detail": "U moet inloggen om deze bewerking uit te voeren.", @@ -18,6 +18,8 @@ "401Message": "Ongeautoriseerd", "403Message": "Verboden", "404Message": "Pagina niet gevonden", - "500Message": "Interne Server Fout" + "500Message": "Interne Server Fout", + "403MessageDetail": "U bent niet bevoegd om deze handeling uit te voeren!", + "404MessageDetail": "Sorry, op dit adres is niks gevonden." } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/Localization/nl.json b/framework/src/Volo.Abp.Features/Volo/Abp/Features/Localization/nl.json new file mode 100644 index 0000000000..0c43d02c08 --- /dev/null +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/Localization/nl.json @@ -0,0 +1,8 @@ +{ + "culture": "nl", + "texts": { + "Volo.Feature:010001": "Functie '{FeatureName}' is niet ingeschakeld", + "Volo.Feature:010002": "Vereiste functies zijn niet ingeschakeld. Al deze functies moeten zijn ingeschakeld: {FeatureNames}", + "Volo.Feature:010003": "Vereiste functies zijn niet ingeschakeld. Ten minste een van deze functies moet zijn ingeschakeld: {FeatureNames}" + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Content/ReferencedRemoteStreamContent.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Content/ReferencedRemoteStreamContent.cs deleted file mode 100644 index b99cec8a51..0000000000 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Content/ReferencedRemoteStreamContent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.IO; -using Volo.Abp.Content; - -namespace Volo.Abp.Http.Client.Content -{ - internal class ReferencedRemoteStreamContent : RemoteStreamContent - { - private readonly object[] _references; - - public ReferencedRemoteStreamContent(Stream stream, params object[] references) - : base(stream) - { - this._references = references; - } - } -} diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index 9142118b97..7e90bd4fe7 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -1,24 +1,38 @@ using System; +using System.Globalization; using System.Linq; using System.Net.Http; +using System.Net.Http.Headers; using System.Reflection; using System.Text.Json; using System.Threading.Tasks; +using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Modeling; +using Volo.Abp.MultiTenancy; using Volo.Abp.Threading; +using Volo.Abp.Tracing; namespace Volo.Abp.Http.Client.DynamicProxying { public class ApiDescriptionFinder : IApiDescriptionFinder, ITransientDependency { public ICancellationTokenProvider CancellationTokenProvider { get; set; } - protected IApiDescriptionCache Cache { get; } - - public ApiDescriptionFinder(IApiDescriptionCache cache) + protected AbpCorrelationIdOptions AbpCorrelationIdOptions { get; } + protected ICorrelationIdProvider CorrelationIdProvider { get; } + protected ICurrentTenant CurrentTenant { get; } + + public ApiDescriptionFinder( + IApiDescriptionCache cache, + IOptions abpCorrelationIdOptions, + ICorrelationIdProvider correlationIdProvider, + ICurrentTenant currentTenant) { Cache = cache; + AbpCorrelationIdOptions = abpCorrelationIdOptions.Value; + CorrelationIdProvider = correlationIdProvider; + CurrentTenant = currentTenant; CancellationTokenProvider = NullCancellationTokenProvider.Instance; } @@ -71,10 +85,19 @@ namespace Volo.Abp.Http.Client.DynamicProxying return await Cache.GetAsync(baseUrl, () => GetApiDescriptionFromServerAsync(client, baseUrl)); } - protected virtual async Task GetApiDescriptionFromServerAsync(HttpClient client, string baseUrl) + protected virtual async Task GetApiDescriptionFromServerAsync( + HttpClient client, + string baseUrl) { - var response = await client.GetAsync( - baseUrl.EnsureEndsWith('/') + "api/abp/api-definition", + var requestMessage = new HttpRequestMessage( + HttpMethod.Get, + baseUrl.EnsureEndsWith('/') + "api/abp/api-definition" + ); + + AddHeaders(requestMessage); + + var response = await client.SendAsync( + requestMessage, CancellationTokenProvider.Token ); @@ -93,6 +116,30 @@ namespace Volo.Abp.Http.Client.DynamicProxying return (ApplicationApiDescriptionModel)result; } + protected virtual void AddHeaders(HttpRequestMessage requestMessage) + { + //CorrelationId + requestMessage.Headers.Add(AbpCorrelationIdOptions.HttpHeaderName, CorrelationIdProvider.Get()); + + //TenantId + if (CurrentTenant.Id.HasValue) + { + //TODO: Use AbpAspNetCoreMultiTenancyOptions to get the key + requestMessage.Headers.Add(TenantResolverConsts.DefaultTenantKey, CurrentTenant.Id.Value.ToString()); + } + + //Culture + //TODO: Is that the way we want? Couldn't send the culture (not ui culture) + var currentCulture = CultureInfo.CurrentUICulture.Name ?? CultureInfo.CurrentCulture.Name; + if (!currentCulture.IsNullOrEmpty()) + { + requestMessage.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(currentCulture)); + } + + //X-Requested-With + requestMessage.Headers.Add("X-Requested-With", "XMLHttpRequest"); + } + protected virtual bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter) { return NormalizeTypeName(actionParameter.TypeAsString) == diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs index 7eb4e5ad78..136c9e42ef 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs @@ -14,7 +14,6 @@ using Volo.Abp.Content; using Volo.Abp.DependencyInjection; using Volo.Abp.DynamicProxy; using Volo.Abp.Http.Client.Authentication; -using Volo.Abp.Http.Client.Content; using Volo.Abp.Http.Modeling; using Volo.Abp.Http.ProxyScripting.Generators; using Volo.Abp.Json; @@ -112,7 +111,10 @@ namespace Volo.Abp.Http.Client.DynamicProxying /* returning a class that holds a reference to response * content just to be sure that GC does not dispose of * it before we finish doing our work with the stream */ - return (T)((object)new ReferencedRemoteStreamContent(await responseContent.ReadAsStreamAsync(), responseContent)); + return (T)(object)new RemoteStreamContent(await responseContent.ReadAsStreamAsync()) + { + ContentType = responseContent.Headers.ContentType?.ToString() + }; } var stringContent = await responseContent.ReadAsStringAsync(); @@ -136,7 +138,13 @@ namespace Volo.Abp.Http.Client.DynamicProxying var client = HttpClientFactory.Create(clientConfig.RemoteServiceName); - var action = await ApiDescriptionFinder.FindActionAsync(client, remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method); + var action = await ApiDescriptionFinder.FindActionAsync( + client, + remoteServiceConfig.BaseUrl, + typeof(TService), + invocation.Method + ); + var apiVersion = GetApiVersionInfo(action); var url = remoteServiceConfig.BaseUrl.EnsureEndsWith('/') + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion); @@ -156,9 +164,11 @@ namespace Volo.Abp.Http.Client.DynamicProxying ) ); - var response = await client.SendAsync(requestMessage, + var response = await client.SendAsync( + requestMessage, HttpCompletionOption.ResponseHeadersRead /*this will buffer only the headers, the content will be used as a stream*/, - GetCancellationToken()); + GetCancellationToken() + ); if (!response.IsSuccessStatusCode) { @@ -196,7 +206,11 @@ namespace Volo.Abp.Http.Client.DynamicProxying return action.SupportedVersions.Last(); //TODO: Ensure to get the latest version! } - protected virtual void AddHeaders(IAbpMethodInvocation invocation, ActionApiDescriptionModel action, HttpRequestMessage requestMessage, ApiVersionInfo apiVersion) + protected virtual void AddHeaders( + IAbpMethodInvocation invocation, + ActionApiDescriptionModel action, + HttpRequestMessage requestMessage, + ApiVersionInfo apiVersion) { //API Version if (!apiVersion.Version.IsNullOrEmpty()) diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/UrlBuilder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/UrlBuilder.cs index e4b82b21e1..5bee246bd0 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/UrlBuilder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/UrlBuilder.cs @@ -8,7 +8,6 @@ using JetBrains.Annotations; using Volo.Abp.Http.Modeling; using Volo.Abp.Http.ProxyScripting.Generators; using Volo.Abp.Localization; -using Volo.Abp.Reflection; namespace Volo.Abp.Http.Client.DynamicProxying { @@ -82,9 +81,10 @@ namespace Volo.Abp.Http.Client.DynamicProxying continue; } - AddQueryStringParameter(urlBuilder, isFirstParam, queryStringParameter.Name, value); - - isFirstParam = false; + if (AddQueryStringParameter(urlBuilder, isFirstParam, queryStringParameter.Name, value)) + { + isFirstParam = false; + } } if (apiVersion.ShouldSendInQueryString()) @@ -93,28 +93,37 @@ namespace Volo.Abp.Http.Client.DynamicProxying } } - private static void AddQueryStringParameter( + private static bool AddQueryStringParameter( StringBuilder urlBuilder, bool isFirstParam, string name, [NotNull] object value) { - urlBuilder.Append(isFirstParam ? "?" : "&"); - if (value.GetType().IsArray || (value.GetType().IsGenericType && value is IEnumerable)) { var index = 0; foreach (var item in (IEnumerable) value) { + if (index == 0) + { + urlBuilder.Append(isFirstParam ? "?" : "&"); + } urlBuilder.Append(name + $"[{index++}]=" + System.Net.WebUtility.UrlEncode(ConvertValueToString(item)) + "&"); } - //remove & at the end of the urlBuilder. - urlBuilder.Remove(urlBuilder.Length - 1, 1); - } - else - { - urlBuilder.Append(name + "=" + System.Net.WebUtility.UrlEncode(ConvertValueToString(value))); + + if (index > 0) + { + //remove & at the end of the urlBuilder. + urlBuilder.Remove(urlBuilder.Length - 1, 1); + return true; + } + + return false; } + + urlBuilder.Append(isFirstParam ? "?" : "&"); + urlBuilder.Append(name + "=" + System.Net.WebUtility.UrlEncode(ConvertValueToString(value))); + return true; } private static string ConvertValueToString([NotNull] object value) diff --git a/framework/src/Volo.Abp.Kafka/Volo/Abp/Kafka/KafkaMessageConsumer.cs b/framework/src/Volo.Abp.Kafka/Volo/Abp/Kafka/KafkaMessageConsumer.cs index 8ae81a2a26..bb7e2d66a3 100644 --- a/framework/src/Volo.Abp.Kafka/Volo/Abp/Kafka/KafkaMessageConsumer.cs +++ b/framework/src/Volo.Abp.Kafka/Volo/Abp/Kafka/KafkaMessageConsumer.cs @@ -86,7 +86,7 @@ namespace Volo.Abp.Kafka } catch (CreateTopicsException e) { - if (!e.Error.Reason.Contains($"Topic '{TopicName}' already exists")) + if(e.Results.First().Error.Code != ErrorCode.TopicAlreadyExists) { throw; } diff --git a/framework/src/Volo.Abp.Ldap/Volo/Abp/Ldap/Localization/nl.json b/framework/src/Volo.Abp.Ldap/Volo/Abp/Ldap/Localization/nl.json new file mode 100644 index 0000000000..ce321ab712 --- /dev/null +++ b/framework/src/Volo.Abp.Ldap/Volo/Abp/Ldap/Localization/nl.json @@ -0,0 +1,15 @@ +{ + "culture": "nl", + "texts": { + "DisplayName:Abp.Ldap.ServerHost": "Serverhost", + "Description:Abp.Ldap.ServerHost": "Serverhost", + "DisplayName:Abp.Ldap.ServerPort": "Server poort", + "Description:Abp.Ldap.ServerPort": "Server poort", + "DisplayName:Abp.Ldap.BaseDc": "Basisdomein component", + "Description:Abp.Ldap.BaseDc": "Basisdomein component", + "DisplayName:Abp.Ldap.UserName": "Gebruikersnaam", + "Description:Abp.Ldap.UserName": "Gebruikersnaam", + "DisplayName:Abp.Ldap.Password": "Wachtwoord", + "Description:Abp.Ldap.Password": "Wachtwoord" + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs index 8ab6753de3..fd8c5afd16 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs +++ b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs @@ -191,10 +191,7 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb { var entities = (await GetQueryableAsync()).Where(predicate).ToList(); - foreach (var entity in entities) - { - await DeleteAsync(entity, autoSave, cancellationToken); - } + await DeleteManyAsync(entities, autoSave, cancellationToken); } public override async Task InsertAsync( diff --git a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Uow/MemoryDb/UnitOfWorkMemoryDatabaseProvider.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Uow/MemoryDb/UnitOfWorkMemoryDatabaseProvider.cs index c2c5a1df71..9772bac8a0 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Uow/MemoryDb/UnitOfWorkMemoryDatabaseProvider.cs +++ b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Uow/MemoryDb/UnitOfWorkMemoryDatabaseProvider.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.Domain.Repositories.MemoryDb; using Volo.Abp.MemoryDb; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.Uow.MemoryDb { @@ -14,17 +15,20 @@ namespace Volo.Abp.Uow.MemoryDb private readonly IUnitOfWorkManager _unitOfWorkManager; private readonly IConnectionStringResolver _connectionStringResolver; private readonly MemoryDatabaseManager _memoryDatabaseManager; + private readonly ICurrentTenant _currentTenant; public UnitOfWorkMemoryDatabaseProvider( IUnitOfWorkManager unitOfWorkManager, IConnectionStringResolver connectionStringResolver, TMemoryDbContext dbContext, - MemoryDatabaseManager memoryDatabaseManager) + MemoryDatabaseManager memoryDatabaseManager, + ICurrentTenant currentTenant) { _unitOfWorkManager = unitOfWorkManager; _connectionStringResolver = connectionStringResolver; DbContext = dbContext; _memoryDatabaseManager = memoryDatabaseManager; + _currentTenant = currentTenant; } public Task GetDbContextAsync() @@ -72,5 +76,34 @@ namespace Volo.Abp.Uow.MemoryDb return ((MemoryDbDatabaseApi)databaseApi).Database; } + + private async Task ResolveConnectionStringAsync() + { + // Multi-tenancy unaware contexts should always use the host connection string + if (typeof(TMemoryDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false)) + { + using (_currentTenant.Change(null)) + { + return await _connectionStringResolver.ResolveAsync(); + } + } + + return await _connectionStringResolver.ResolveAsync(); + } + + [Obsolete("Use ResolveConnectionStringAsync method.")] + private string ResolveConnectionString() + { + // Multi-tenancy unaware contexts should always use the host connection string + if (typeof(TMemoryDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false)) + { + using (_currentTenant.Change(null)) + { + return _connectionStringResolver.Resolve(); + } + } + + return _connectionStringResolver.Resolve(); + } } } diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs index fda7f291c7..cdb91aa4a7 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbBulkOperationProvider.cs @@ -3,9 +3,8 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Entities; -using Volo.Abp.Domain.Repositories.MongoDB; -namespace Volo.Abp.MongoDB.Volo.Abp.Domain.Repositories.MongoDB +namespace Volo.Abp.Domain.Repositories.MongoDB { public interface IMongoDbBulkOperationProvider { diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs index 960222679f..12e5987777 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs @@ -24,6 +24,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB IMongoQueryable GetMongoQueryable(); Task> GetMongoQueryableAsync(CancellationToken cancellationToken = default); + + Task> GetAggregateAsync(CancellationToken cancellationToken = default); } public interface IMongoDbRepository : IMongoDbRepository, IRepository diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index 537f6cdad3..e6030246aa 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -16,7 +16,7 @@ using Volo.Abp.EventBus.Distributed; using Volo.Abp.EventBus.Local; using Volo.Abp.Guids; using Volo.Abp.MongoDB; -using Volo.Abp.MongoDB.Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.Domain.Repositories.MongoDB { @@ -52,11 +52,37 @@ namespace Volo.Abp.Domain.Repositories.MongoDB } [Obsolete("Use GetDbContextAsync method.")] - protected virtual TMongoDbContext DbContext => DbContextProvider.GetDbContext(); + protected virtual TMongoDbContext DbContext => GetDbContext(); + + [Obsolete("Use GetDbContextAsync method.")] + private TMongoDbContext GetDbContext() + { + // Multi-tenancy unaware entities should always use the host connection string + if (!EntityHelper.IsMultiTenant()) + { + using (CurrentTenant.Change(null)) + { + return DbContextProvider.GetDbContext(); + } + } + + return DbContextProvider.GetDbContext(); + } protected Task GetDbContextAsync(CancellationToken cancellationToken = default) { - return DbContextProvider.GetDbContextAsync(GetCancellationToken(cancellationToken)); + cancellationToken = GetCancellationToken(cancellationToken); + + // Multi-tenancy unaware entities should always use the host connection string + if (!EntityHelper.IsMultiTenant()) + { + using (CurrentTenant.Change(null)) + { + return DbContextProvider.GetDbContextAsync(cancellationToken); + } + } + + return DbContextProvider.GetDbContextAsync(cancellationToken); } protected IMongoDbContextProvider DbContextProvider { get; } @@ -83,9 +109,11 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + await ApplyAbpConceptsForAddedEntityAsync(entity); - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (dbContext.SessionHandle != null) @@ -93,14 +121,14 @@ namespace Volo.Abp.Domain.Repositories.MongoDB await collection.InsertOneAsync( dbContext.SessionHandle, entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else { await collection.InsertOneAsync( entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } @@ -109,6 +137,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB public override async Task InsertManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + var entityArray = entities.ToArray(); foreach (var entity in entityArray) @@ -116,7 +146,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB await ApplyAbpConceptsForAddedEntityAsync(entity); } - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (BulkOperationProvider != null) @@ -145,6 +175,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + SetModificationAuditProperties(entity); if (entity is ISoftDelete softDeleteEntity && softDeleteEntity.IsDeleted) @@ -162,7 +194,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); ReplaceOneResult result; - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (dbContext.SessionHandle != null) @@ -171,7 +203,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB dbContext.SessionHandle, CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else @@ -179,7 +211,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB result = await collection.ReplaceOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } @@ -253,15 +285,18 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { - await ApplyAbpConceptsForDeletedEntityAsync(entity); - var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); + cancellationToken = GetCancellationToken(cancellationToken); - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); - if (entity is ISoftDelete softDeleteEntity && !IsHardDeleted(entity)) + var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); + + if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)) && !IsHardDeleted(entity)) { - softDeleteEntity.IsDeleted = true; + ((ISoftDelete)entity).IsDeleted = true; + await ApplyAbpConceptsForDeletedEntityAsync(entity); + ReplaceOneResult result; if (dbContext.SessionHandle != null) @@ -270,7 +305,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB dbContext.SessionHandle, CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else @@ -278,7 +313,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB result = await collection.ReplaceOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } @@ -289,6 +324,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB } else { + await ApplyAbpConceptsForDeletedEntityAsync(entity); + DeleteResult result; if (dbContext.SessionHandle != null) @@ -296,14 +333,14 @@ namespace Volo.Abp.Domain.Repositories.MongoDB result = await collection.DeleteOneAsync( dbContext.SessionHandle, CreateEntityFilter(entity, true, oldConcurrencyStamp), - cancellationToken: GetCancellationToken(cancellationToken) + cancellationToken: cancellationToken ); } else { result = await collection.DeleteOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), - GetCancellationToken(cancellationToken) + cancellationToken ); } @@ -315,71 +352,84 @@ namespace Volo.Abp.Domain.Repositories.MongoDB } public override async Task DeleteManyAsync( - IEnumerable entities, - bool autoSave = false, - CancellationToken cancellationToken = default) + IEnumerable entities, + bool autoSave = false, + CancellationToken cancellationToken = default) { - var entityArray = entities.ToArray(); + cancellationToken = GetCancellationToken(cancellationToken); - foreach (var entity in entityArray) + var softDeletedEntities = new Dictionary(); + var hardDeletedEntities = new List(); + + foreach (var entity in entities) { + if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)) && !IsHardDeleted(entity)) + { + ((ISoftDelete)entity).IsDeleted = true; + + softDeletedEntities.Add(entity, SetNewConcurrencyStamp(entity)); + } + else + { + hardDeletedEntities.Add(entity); + } + await ApplyAbpConceptsForDeletedEntityAsync(entity); - SetNewConcurrencyStamp(entity); } - var dbContext = await GetDbContextAsync(GetCancellationToken(cancellationToken)); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); if (BulkOperationProvider != null) { - await BulkOperationProvider.DeleteManyAsync(this, entityArray, dbContext.SessionHandle, autoSave, cancellationToken); + await BulkOperationProvider.DeleteManyAsync(this, entities, dbContext.SessionHandle, autoSave, cancellationToken); return; } - var entitiesCount = entityArray.Count(); - - if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity))) + if (softDeletedEntities.Count > 0) { - UpdateResult updateResult; + BulkWriteResult updateResult; + + var replaceRequests = new List>( + softDeletedEntities.Select(entity => new ReplaceOneModel( + CreateEntityFilter(entity.Key, true, entity.Value), entity.Key)) + ); + if (dbContext.SessionHandle != null) { - updateResult = await collection.UpdateManyAsync( - dbContext.SessionHandle, - CreateEntitiesFilter(entityArray), - Builders.Update.Set(x => ((ISoftDelete)x).IsDeleted, true) - ); + updateResult = await collection.BulkWriteAsync(dbContext.SessionHandle, replaceRequests, cancellationToken: cancellationToken); } else { - updateResult = await collection.UpdateManyAsync( - CreateEntitiesFilter(entityArray), - Builders.Update.Set(x => ((ISoftDelete)x).IsDeleted, true) - ); + updateResult = await collection.BulkWriteAsync(replaceRequests, cancellationToken: cancellationToken); } - if (updateResult.MatchedCount < entitiesCount) + if (updateResult.MatchedCount < softDeletedEntities.Count) { ThrowOptimisticConcurrencyException(); } } - else + + if (hardDeletedEntities.Count > 0) { DeleteResult deleteResult; + var hardDeletedEntitiesCount = hardDeletedEntities.Count; + if (dbContext.SessionHandle != null) { deleteResult = await collection.DeleteManyAsync( dbContext.SessionHandle, - CreateEntitiesFilter(entityArray) - ); + CreateEntitiesFilter(hardDeletedEntities), + cancellationToken: cancellationToken); } else { deleteResult = await collection.DeleteManyAsync( - CreateEntitiesFilter(entityArray) - ); + CreateEntitiesFilter(hardDeletedEntities), + cancellationToken: cancellationToken); } - if (deleteResult.DeletedCount < entitiesCount) + if (deleteResult.DeletedCount < hardDeletedEntitiesCount) { ThrowOptimisticConcurrencyException(); } @@ -425,10 +475,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB .Where(predicate) .ToListAsync(cancellationToken); - foreach (var entity in entities) - { - await DeleteAsync(entity, autoSave, cancellationToken); - } + await DeleteManyAsync(entities, autoSave, cancellationToken); } [Obsolete("Use GetQueryableAsync method.")] @@ -447,9 +494,11 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + return await (await GetMongoQueryableAsync(cancellationToken)) .Where(predicate) - .SingleOrDefaultAsync(GetCancellationToken(cancellationToken)); + .SingleOrDefaultAsync(cancellationToken); } [Obsolete("Use GetMongoQueryableAsync method.")] @@ -464,6 +513,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB public async Task> GetMongoQueryableAsync(CancellationToken cancellationToken = default) { + cancellationToken = GetCancellationToken(cancellationToken); + var dbContext = await GetDbContextAsync(cancellationToken); var collection = dbContext.Collection(); @@ -474,6 +525,19 @@ namespace Volo.Abp.Domain.Repositories.MongoDB ); } + public async Task> GetAggregateAsync(CancellationToken cancellationToken = default) + { + cancellationToken = GetCancellationToken(cancellationToken); + + var dbContext = await GetDbContextAsync(cancellationToken); + var collection = await GetCollectionAsync(cancellationToken); + + return ApplyDataFilters( + dbContext.SessionHandle != null + ? collection.Aggregate(dbContext.SessionHandle) + : collection.Aggregate()); + } + protected virtual bool IsHardDeleted(TEntity entity) { var hardDeletedEntities = UnitOfWorkManager?.Current?.Items.GetOrDefault(UnitOfWorkItemNames.HardDeletedEntities) as HashSet; @@ -622,6 +686,22 @@ namespace Volo.Abp.Domain.Repositories.MongoDB throw new AbpDbConcurrencyException("Database operation expected to affect 1 row but actually affected 0 row. Data may have been modified or deleted since entities were loaded. This exception has been thrown on optimistic concurrency check."); } + protected virtual IAggregateFluent ApplyDataFilters(IAggregateFluent aggregate) + { + if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)) && DataFilter.IsEnabled()) + { + aggregate = aggregate.Match(e => ((ISoftDelete)e).IsDeleted == false); + } + + if (typeof(IMultiTenant).IsAssignableFrom(typeof(TEntity)) && DataFilter.IsEnabled()) + { + var tenantId = CurrentTenant.Id; + aggregate = aggregate.Match(e => ((IMultiTenant)e).TenantId == tenantId); + } + + return aggregate; + } + [Obsolete("This method will be removed in future versions.")] public QueryableExecutionModel GetExecutionModel() { @@ -631,13 +711,13 @@ namespace Volo.Abp.Domain.Repositories.MongoDB [Obsolete("This method will be removed in future versions.")] public IAsyncCursor ToCursor(CancellationToken cancellationToken = new CancellationToken()) { - return GetMongoQueryable().ToCursor(cancellationToken); + return GetMongoQueryable().ToCursor(GetCancellationToken(cancellationToken)); } [Obsolete("This method will be removed in future versions.")] public Task> ToCursorAsync(CancellationToken cancellationToken = new CancellationToken()) { - return GetMongoQueryable().ToCursorAsync(cancellationToken); + return GetMongoQueryable().ToCursorAsync(GetCancellationToken(cancellationToken)); } } @@ -660,7 +740,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken); + var entity = await FindAsync(id, includeDetails, GetCancellationToken(cancellationToken)); if (entity == null) { diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs index ff367dc554..bcbdc00d9e 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; @@ -16,23 +17,23 @@ namespace Volo.Abp.Domain.Repositories return repository.ToMongoDbRepository().Database; } - public static Task GetDatabaseAsync(this IBasicRepository repository) + public static Task GetDatabaseAsync(this IBasicRepository repository, CancellationToken cancellationToken = default) where TEntity : class, IEntity { - return repository.ToMongoDbRepository().GetDatabaseAsync(); + return repository.ToMongoDbRepository().GetDatabaseAsync(cancellationToken); } - [Obsolete("Use GetCollection method.")] + [Obsolete("Use GetCollectionAsync method.")] public static IMongoCollection GetCollection(this IBasicRepository repository) where TEntity : class, IEntity { return repository.ToMongoDbRepository().Collection; } - public static Task> GetCollectionAsync(this IBasicRepository repository) + public static Task> GetCollectionAsync(this IBasicRepository repository, CancellationToken cancellationToken = default) where TEntity : class, IEntity { - return repository.ToMongoDbRepository().GetCollectionAsync(); + return repository.ToMongoDbRepository().GetCollectionAsync(cancellationToken); } [Obsolete("Use GetMongoQueryableAsync method.")] @@ -42,10 +43,16 @@ namespace Volo.Abp.Domain.Repositories return repository.ToMongoDbRepository().GetMongoQueryable(); } - public static Task> GetMongoQueryableAsync(this IBasicRepository repository) + public static Task> GetMongoQueryableAsync(this IBasicRepository repository, CancellationToken cancellationToken = default) where TEntity : class, IEntity { - return repository.ToMongoDbRepository().GetMongoQueryableAsync(); + return repository.ToMongoDbRepository().GetMongoQueryableAsync(cancellationToken); + } + + public static Task> GetAggregateAsync(this IBasicRepository repository, CancellationToken cancellationToken = default) + where TEntity : class, IEntity + { + return repository.ToMongoDbRepository().GetAggregateAsync(cancellationToken); } public static IMongoDbRepository ToMongoDbRepository(this IBasicRepository repository) diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/MongoDbTransactionApi.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/MongoDbTransactionApi.cs index 6c3ab76ee5..f376c2f804 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/MongoDbTransactionApi.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/MongoDbTransactionApi.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; +using Volo.Abp.Threading; namespace Volo.Abp.Uow.MongoDB { @@ -9,19 +9,19 @@ namespace Volo.Abp.Uow.MongoDB { public IClientSessionHandle SessionHandle { get; } - public MongoDbTransactionApi(IClientSessionHandle sessionHandle) + protected ICancellationTokenProvider CancellationTokenProvider { get; } + + public MongoDbTransactionApi( + IClientSessionHandle sessionHandle, + ICancellationTokenProvider cancellationTokenProvider) { SessionHandle = sessionHandle; + CancellationTokenProvider = cancellationTokenProvider; } public async Task CommitAsync() { - await SessionHandle.CommitTransactionAsync(); - } - - protected void Commit() - { - SessionHandle.CommitTransaction(); + await SessionHandle.CommitTransactionAsync(CancellationTokenProvider.Token); } public void Dispose() @@ -29,14 +29,11 @@ namespace Volo.Abp.Uow.MongoDB SessionHandle.Dispose(); } - public void Rollback() - { - SessionHandle.AbortTransaction(); - } - public async Task RollbackAsync(CancellationToken cancellationToken) { - await SessionHandle.AbortTransactionAsync(cancellationToken); + await SessionHandle.AbortTransactionAsync( + CancellationTokenProvider.FallbackToProvider(cancellationToken) + ); } } } diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs index 6db6aec6b5..684593fb7f 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Uow/MongoDB/UnitOfWorkMongoDbContextProvider.cs @@ -8,6 +8,7 @@ using MongoDB.Bson; using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; using Volo.Abp.Threading; namespace Volo.Abp.Uow.MongoDB @@ -20,15 +21,18 @@ namespace Volo.Abp.Uow.MongoDB private readonly IUnitOfWorkManager _unitOfWorkManager; private readonly IConnectionStringResolver _connectionStringResolver; private readonly ICancellationTokenProvider _cancellationTokenProvider; + private readonly ICurrentTenant _currentTenant; public UnitOfWorkMongoDbContextProvider( IUnitOfWorkManager unitOfWorkManager, IConnectionStringResolver connectionStringResolver, - ICancellationTokenProvider cancellationTokenProvider) + ICancellationTokenProvider cancellationTokenProvider, + ICurrentTenant currentTenant) { _unitOfWorkManager = unitOfWorkManager; _connectionStringResolver = connectionStringResolver; _cancellationTokenProvider = cancellationTokenProvider; + _currentTenant = currentTenant; Logger = NullLogger>.Instance; } @@ -36,7 +40,8 @@ namespace Volo.Abp.Uow.MongoDB [Obsolete("Use CreateDbContextAsync")] public TMongoDbContext GetDbContext() { - if (!UnitOfWork.DisableObsoleteDbContextCreationWarning.Value) + if (UnitOfWork.EnableObsoleteDbContextCreationWarning && + !UnitOfWorkManager.DisableObsoleteDbContextCreationWarning.Value) { Logger.LogWarning( "UnitOfWorkDbContextProvider.GetDbContext is deprecated. Use GetDbContextAsync instead! " + @@ -53,7 +58,7 @@ namespace Volo.Abp.Uow.MongoDB $"A {nameof(IMongoDatabase)} instance can only be created inside a unit of work!"); } - var connectionString = _connectionStringResolver.Resolve(); + var connectionString = ResolveConnectionString(); var dbContextKey = $"{typeof(TMongoDbContext).FullName}_{connectionString}"; var mongoUrl = new MongoUrl(connectionString); @@ -80,7 +85,7 @@ namespace Volo.Abp.Uow.MongoDB $"A {nameof(IMongoDatabase)} instance can only be created inside a unit of work!"); } - var connectionString = await _connectionStringResolver.ResolveAsync(); + var connectionString = await ResolveConnectionStringAsync(); var dbContextKey = $"{typeof(TMongoDbContext).FullName}_{connectionString}"; var mongoUrl = new MongoUrl(connectionString); @@ -177,7 +182,10 @@ namespace Volo.Abp.Uow.MongoDB unitOfWork.AddTransactionApi( transactionApiKey, - new MongoDbTransactionApi(session) + new MongoDbTransactionApi( + session, + _cancellationTokenProvider + ) ); dbContext.ToAbpMongoDbContext().InitializeDatabase(database, client, session); @@ -214,7 +222,10 @@ namespace Volo.Abp.Uow.MongoDB unitOfWork.AddTransactionApi( transactionApiKey, - new MongoDbTransactionApi(session) + new MongoDbTransactionApi( + session, + _cancellationTokenProvider + ) ); dbContext.ToAbpMongoDbContext().InitializeDatabase(database, client, session); @@ -227,6 +238,35 @@ namespace Volo.Abp.Uow.MongoDB return dbContext; } + private async Task ResolveConnectionStringAsync() + { + // Multi-tenancy unaware contexts should always use the host connection string + if (typeof(TMongoDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false)) + { + using (_currentTenant.Change(null)) + { + return await _connectionStringResolver.ResolveAsync(); + } + } + + return await _connectionStringResolver.ResolveAsync(); + } + + [Obsolete("Use ResolveConnectionStringAsync method.")] + private string ResolveConnectionString() + { + // Multi-tenancy unaware contexts should always use the host connection string + if (typeof(TMongoDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false)) + { + using (_currentTenant.Change(null)) + { + return _connectionStringResolver.Resolve(); + } + } + + return _connectionStringResolver.Resolve(); + } + protected virtual CancellationToken GetCancellationToken(CancellationToken preferredValue = default) { return _cancellationTokenProvider.FallbackToProvider(preferredValue); diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs index 0ba64417a3..e586e687c3 100644 --- a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs +++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfiguration.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.MultiTenancy public TenantConfiguration() { - + } public TenantConfiguration(Guid id, [NotNull] string name) @@ -28,4 +28,4 @@ namespace Volo.Abp.MultiTenancy ConnectionStrings = new ConnectionStrings(); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs index b1cdcb1097..cf517f0de4 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs @@ -1,13 +1,20 @@ -using System; +using System; +using System.Collections.Generic; using System.Text; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; +using Volo.Abp.Security.Claims; using Volo.Abp.Security.Encryption; namespace Volo.Abp.Security { public class AbpSecurityModule : AbpModule { + public override void PostConfigureServices(ServiceConfigurationContext context) + { + AutoAddClaimsPrincipalContributors(context.Services); + } + public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); @@ -41,5 +48,23 @@ namespace Volo.Abp.Security } }); } + + private static void AutoAddClaimsPrincipalContributors(IServiceCollection services) + { + var contributorTypes = new List(); + + services.OnRegistred(context => + { + if (typeof(IAbpClaimsPrincipalContributor).IsAssignableFrom(context.ImplementationType)) + { + contributorTypes.Add(context.ImplementationType); + } + }); + + services.Configure(options => + { + options.Contributors.AddIfNotContains(contributorTypes); + }); + } } } diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalContributorContext.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalContributorContext.cs new file mode 100644 index 0000000000..c0174e3391 --- /dev/null +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalContributorContext.cs @@ -0,0 +1,23 @@ +using System; +using System.Security.Claims; +using JetBrains.Annotations; + +namespace Volo.Abp.Security.Claims +{ + public class AbpClaimsPrincipalContributorContext + { + [NotNull] + public ClaimsPrincipal ClaimsPrincipal { get; } + + [NotNull] + public IServiceProvider ServiceProvider { get; } + + public AbpClaimsPrincipalContributorContext( + [NotNull] ClaimsPrincipal claimsIdentity, + [NotNull] IServiceProvider serviceProvider) + { + ClaimsPrincipal = claimsIdentity; + ServiceProvider = serviceProvider; + } + } +} diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs new file mode 100644 index 0000000000..b00b38ea8c --- /dev/null +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs @@ -0,0 +1,40 @@ +using System.Security.Claims; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Security.Claims +{ + public class AbpClaimsPrincipalFactory : IAbpClaimsPrincipalFactory, ITransientDependency + { + protected IServiceScopeFactory ServiceScopeFactory { get; } + protected AbpClaimsPrincipalFactoryOptions Options { get; } + + public AbpClaimsPrincipalFactory( + IServiceScopeFactory serviceScopeFactory, + IOptions abpClaimOptions) + { + ServiceScopeFactory = serviceScopeFactory; + Options = abpClaimOptions.Value; + } + + public virtual async Task CreateAsync() + { + using (var scope = ServiceScopeFactory.CreateScope()) + { + var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity()); + + var context = new AbpClaimsPrincipalContributorContext(claimsPrincipal, scope.ServiceProvider); + + foreach (var contributorType in Options.Contributors) + { + var contributor = (IAbpClaimsPrincipalContributor) scope.ServiceProvider.GetRequiredService(contributorType); + await contributor.ContributeAsync(context); + } + + return claimsPrincipal; + } + } + } +} diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs new file mode 100644 index 0000000000..8083a018ee --- /dev/null +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Collections; + +namespace Volo.Abp.Security.Claims +{ + public class AbpClaimsPrincipalFactoryOptions + { + public ITypeList Contributors { get; } + + public AbpClaimsPrincipalFactoryOptions() + { + Contributors = new TypeList(); + } + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/ClaimsIdentityExtensions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/ClaimsIdentityExtensions.cs similarity index 94% rename from modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/ClaimsIdentityExtensions.cs rename to framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/ClaimsIdentityExtensions.cs index 156f092f9e..bf8bb26784 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/ClaimsIdentityExtensions.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/ClaimsIdentityExtensions.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Security.Claims; -namespace Volo.Abp.Identity +namespace Volo.Abp.Security.Claims { public static class ClaimsIdentityExtensions { diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalContributor.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalContributor.cs new file mode 100644 index 0000000000..7b9f6db3f5 --- /dev/null +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalContributor.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; + +namespace Volo.Abp.Security.Claims +{ + public interface IAbpClaimsPrincipalContributor + { + Task ContributeAsync(AbpClaimsPrincipalContributorContext context); + } +} diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalFactory.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalFactory.cs new file mode 100644 index 0000000000..1de0afbcab --- /dev/null +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalFactory.cs @@ -0,0 +1,10 @@ +using System.Security.Claims; +using System.Threading.Tasks; + +namespace Volo.Abp.Security.Claims +{ + public interface IAbpClaimsPrincipalFactory + { + Task CreateAsync(); + } +} diff --git a/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/nl.json b/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/nl.json new file mode 100644 index 0000000000..ae4c8c72a0 --- /dev/null +++ b/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/nl.json @@ -0,0 +1,7 @@ +{ + "culture": "nl", + "texts": { + "DisplayName:Abp.Timing.Timezone": "Tijdzone", + "Description:Abp.Timing.Timezone": "Tijdzone van applicatie" + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json index 4f0906ee3e..52402db298 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json @@ -30,7 +30,7 @@ "PagerPrevious": "Anterior", "PagerFirst": "Primero", "PagerLast": "Último", - "PagerInfo": "Mostrando de la _START a la _END_ de _TOTAL_ entradas", + "PagerInfo": "Mostrando de la _START_ a la _END_ de _TOTAL_ entradas", "PagerInfo{0}{1}{2}": "Mostrando de la {0} a la {1} de {2} entradas", "PagerInfoEmpty": "Mostrando de la 0 a la 0 de 0 entradas", "PagerInfoFiltered": "(filtrado desde _MAX_ entradas totales)", diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json index c65715f8a5..69ad662be1 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/nl.json @@ -4,9 +4,10 @@ "Languages": "Talen", "AreYouSure": "Bent u zeker?", "Cancel": "Annuleren", + "Clear": "Wissen", "Yes": "Ja", "No": "Nee", - "Ok": "Ok", + "Ok": "Oké", "Close": "Sluiten", "Save": "Opslaan", "SavingWithThreeDot": "Opslaan...", @@ -34,6 +35,8 @@ "PagerInfoEmpty": "Toont 0 tot 0 van 0 vermeldingen", "PagerInfoFiltered": "(gefilterd uit in totaal _MAX_ vermeldingen)", "NoDataAvailableInDatatable": "Geen gegevens beschikbaar", + "Total": "totaal", + "Selected": "geselecteed", "PagerShowMenuEntries": "Toon _MENU_-vermeldingen", "DatatableActionDropdownDefaultText": "Acties", "ChangePassword": "Verander wachtwoord", @@ -41,6 +44,9 @@ "AreYouSureYouWantToCancelEditingWarningMessage": "U heeft nog niet-opgeslagen wijzigingen.", "GoHomePage": "Ga naar de homepage", "GoBack": "Ga terug", - "Search": "Zoeken" + "Search": "Zoeken", + "ItemWillBeDeletedMessageWithFormat": "{0} wordt verwijderd!", + "ItemWillBeDeletedMessage": "Dit item wordt verwijderd!", + "ManageYourAccount": "Beheer uw account" } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ISupportsRollback.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ISupportsRollback.cs index 4c211d652d..2286a386b8 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ISupportsRollback.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ISupportsRollback.cs @@ -5,8 +5,6 @@ namespace Volo.Abp.Uow { public interface ISupportsRollback { - void Rollback(); - Task RollbackAsync(CancellationToken cancellationToken); } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs index 2e4b40877f..878c03d629 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs @@ -11,8 +11,10 @@ namespace Volo.Abp.Uow { public class UnitOfWork : IUnitOfWork, ITransientDependency { - [Obsolete("This will be removed in next versions.")] - public static AsyncLocal DisableObsoleteDbContextCreationWarning { get; } = new AsyncLocal(); + /// + /// Default: false. + /// + public static bool EnableObsoleteDbContextCreationWarning { get; } = false; public const string UnitOfWorkReservationName = "_AbpActionUnitOfWork"; @@ -260,27 +262,6 @@ namespace Volo.Abp.Uow } } - protected virtual void RollbackAll() - { - foreach (var databaseApi in GetAllActiveDatabaseApis()) - { - try - { - (databaseApi as ISupportsRollback)?.Rollback(); - } - catch { } - } - - foreach (var transactionApi in GetAllActiveTransactionApis()) - { - try - { - (transactionApi as ISupportsRollback)?.Rollback(); - } - catch { } - } - } - protected virtual async Task RollbackAllAsync(CancellationToken cancellationToken) { foreach (var databaseApi in GetAllActiveDatabaseApis()) diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs index 3a3ef1fbd6..de0d8daa0a 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs @@ -1,10 +1,15 @@ -using Microsoft.Extensions.DependencyInjection; +using System; +using System.Threading; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; namespace Volo.Abp.Uow { public class UnitOfWorkManager : IUnitOfWorkManager, ISingletonDependency { + [Obsolete("This will be removed in next versions.")] + public static AsyncLocal DisableObsoleteDbContextCreationWarning { get; } = new AsyncLocal(); + public IUnitOfWork Current => GetCurrentUnitOfWork(); private readonly IServiceScopeFactory _serviceScopeFactory; diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHelper.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHelper.cs index d46281d2e9..9f6cec23e5 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHelper.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHelper.cs @@ -4,7 +4,9 @@ namespace Volo.Abp.Validation { public class ValidationHelper { - private const string EmailRegEx = @"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"; + // Taken from W3C as an alternative to the RFC5322 specification: https://html.spec.whatwg.org/#valid-e-mail-address + // The RFC5322 regex can be found here: https://emailregex.com/ + public static string EmailRegEx { get; set; } = @"^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"; public static bool IsValidEmailAddress(string email) { @@ -13,7 +15,6 @@ namespace Volo.Abp.Validation return false; } - /*RFC 2822 (simplified)*/ return Regex.IsMatch(email, EmailRegEx, RegexOptions.Compiled | RegexOptions.IgnoreCase); } } diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs index e2ac111f5d..7a7244aa69 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs @@ -38,7 +38,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy services.Configure(options => { - options.AddDomainTenantResolver("{0}.abp.io"); + options.AddDomainTenantResolver("{0}.abp.io:8080"); }); }); } @@ -46,14 +46,14 @@ namespace Volo.Abp.AspNetCore.MultiTenancy [Fact] public async Task Should_Use_Host_If_Tenant_Is_Not_Specified() { - var result = await GetResponseAsObjectAsync>("http://abp.io"); + var result = await GetResponseAsObjectAsync>("http://abp.io:8080"); result["TenantId"].ShouldBe(""); } [Fact] public async Task Should_Use_Domain_If_Specified() { - var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io:8080"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -62,8 +62,8 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add(_options.TenantKey, Guid.NewGuid().ToString()); - var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io:8080"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } } -} \ No newline at end of file +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController.cs new file mode 100644 index 0000000000..15491f9b21 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController.cs @@ -0,0 +1,36 @@ +using System.IO; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Shouldly; +using Volo.Abp.Content; + +namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters +{ + [Route("api/remote-stream-content-test")] + public class RemoteStreamContentTestController : AbpController + { + [HttpGet] + [Route("Download")] + public async Task DownloadAsync() + { + var memoryStream = new MemoryStream(); + await memoryStream.WriteAsync(Encoding.UTF8.GetBytes("DownloadAsync")); + + return new RemoteStreamContent(memoryStream) + { + ContentType = "application/rtf" + }; + } + + [HttpPost] + [Route("Upload")] + public async Task UploadAsync([FromBody]IRemoteStreamContent streamContent) + { + using (var reader = new StreamReader(streamContent.GetStream())) + { + return await reader.ReadToEndAsync() + ":" + streamContent.ContentType; + } + } + } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController_Tests.cs new file mode 100644 index 0000000000..3d49a5b3ff --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController_Tests.cs @@ -0,0 +1,37 @@ +using System.IO; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Shouldly; +using Xunit; + +namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters +{ + public class RemoteStreamContentTestController_Tests : AspNetCoreMvcTestBase + { + [Fact] + public async Task DownloadAsync() + { + var result = await GetResponseAsync("/api/remote-stream-content-test/download"); + result.Content.Headers.ContentType?.ToString().ShouldBe("application/rtf"); + (await result.Content.ReadAsStringAsync()).ShouldBe("DownloadAsync"); + } + + [Fact] + public async Task UploadAsync() + { + using (var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/api/remote-stream-content-test/upload")) + { + var memoryStream = new MemoryStream(); + await memoryStream.WriteAsync(Encoding.UTF8.GetBytes("UploadAsync")); + memoryStream.Position = 0; + requestMessage.Content = new StreamContent(memoryStream); + requestMessage.Content.Headers.Add("Content-Type", "application/rtf"); + + var response = await Client.SendAsync(requestMessage); + + (await response.Content.ReadAsStringAsync()).ShouldBe("UploadAsync:application/rtf"); + } + } + } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/package.json b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/package.json index 3942e04571..994844bec9 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/package.json +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/package.json @@ -3,7 +3,7 @@ "name": "asp.net", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.shared": "^4.1.0", + "@abp/aspnetcore.mvc.ui.theme.shared": "^4.2.0", "highlight.js": "^9.13.1" }, "devDependencies": {} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/yarn.lock b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/yarn.lock index f9bcc19334..a50932965e 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/yarn.lock +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/yarn.lock @@ -2,30 +2,30 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.shared@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.shared@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -36,145 +36,145 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/core@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0.tgz#6bdfa378d44cbf8f611d52dddf0915e5bbc188d5" - integrity sha512-HXkKCfh8+Yc9iVBsZy7eSoQbkBSdV1QTRAF8+cPgbEpU4x4WlUOy61xqb2pSLFzX9nSma83WhdDyQkzWDBTRZQ== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0.tgz#e5c8cb0c84435a0ca97be62c7b9204bbd05ae23d" - integrity sha512-VwIp7VD7zzkRMJw3yu7YOlWbIA/JbLYZeyEpNFMIDxAGYG936tVsmH+aQVTovHF/3+VsYf9Da1JjKymLVHkWRg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/package.json b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/package.json index 2e38fab9ad..cc12cde188 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/package.json +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/package.json @@ -3,8 +3,8 @@ "name": "asp.net", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0", - "@abp/prismjs": "^4.1.0" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.0", + "@abp/prismjs": "^4.2.0" }, "devDependencies": {} } \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/yarn.lock b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/yarn.lock index 3cf76fb1ce..c3d415ce3b 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/yarn.lock +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0.tgz#ef1b31feb678fdf4ce6fa76fb1e9d091ca97c9a4" - integrity sha512-eAD39TaMVnXsEOVyKcChIggpzJw3TzDua8x/APlHfxWBQOuCb7C/PWLWH9DIN14kl8JsVpgRrUSlKsvvY8CIRA== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.2.0.tgz#01d6aab8a31fd6ea828b753805f1ba9a9165975f" + integrity sha512-d+7YubPbuBRY8tjqBxS4I1gyxekjg8Z0X9QaDrf/SGQBoWpIdbG09AekNdddKNkimWcPg4UgUytahPuX9f17ZA== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -43,162 +43,162 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/clipboard@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/clipboard/-/clipboard-4.1.0.tgz#257d582a28e2311f4d433500aff3a529d5756d0a" - integrity sha512-BlJ3+eHXJcj0RJ5PdZ1I8ag0wylp4lW7ukzmXifzSYbT0on6o8pJuCvQM5rAyNqA5ucunjj9QiYXRRo44guKtQ== +"@abp/clipboard@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/clipboard/-/clipboard-4.2.0.tgz#860220df1d57ef64e864401d56cb5cf7068d5861" + integrity sha512-yBgMDhpqPEHp9N9//Ur1BEIOicFIoKBut75PMz9XPOttLyqCmqHYEPj/jgAkUzLd5O+fJM9TE3yGNM7YdRbRPg== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" clipboard "^2.0.6" -"@abp/core@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0.tgz#6bdfa378d44cbf8f611d52dddf0915e5bbc188d5" - integrity sha512-HXkKCfh8+Yc9iVBsZy7eSoQbkBSdV1QTRAF8+cPgbEpU4x4WlUOy61xqb2pSLFzX9nSma83WhdDyQkzWDBTRZQ== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/prismjs@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/prismjs/-/prismjs-4.1.0.tgz#fde3454460013490f566fc3b27fbc1031251b98b" - integrity sha512-jXE8oS8JyLgZS/oXrVS2CxtIH09WEHoUPM4HfndzxSPzxmg3G+E8kzMXbPrHGGx7AhHgmSxNVFGuR2+1YFpSPQ== +"@abp/prismjs@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/prismjs/-/prismjs-4.2.0.tgz#8cedfac538d225930c3654f0d94cad0102faa2f4" + integrity sha512-f4duxGD47p2TDMNiiBcvvjOG1hjhSbAoXyq306RrbP0CBUVTdjzzVhCPPnr5+nMoG55VlRBqh92zkax5kdgwQg== dependencies: - "@abp/clipboard" "~4.1.0" - "@abp/core" "~4.1.0" + "@abp/clipboard" "~4.2.0" + "@abp/core" "~4.2.0" prismjs "^1.20.0" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0.tgz#e5c8cb0c84435a0ca97be62c7b9204bbd05ae23d" - integrity sha512-VwIp7VD7zzkRMJw3yu7YOlWbIA/JbLYZeyEpNFMIDxAGYG936tVsmH+aQVTovHF/3+VsYf9Da1JjKymLVHkWRg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs index e53e3cabbf..c2fc5ea4b3 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs @@ -1,11 +1,14 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using NSubstitute.Extensions; using Shouldly; using Volo.Abp.Application.Dtos; +using Volo.Abp.Content; using Volo.Abp.Domain.Repositories; using Volo.Abp.Http.Client; using Volo.Abp.TestApp.Application; @@ -168,5 +171,31 @@ namespace Volo.Abp.Http.DynamicProxying result.Inner1.Value2.ShouldBe("value two"); result.Inner1.Inner2.Value3.ShouldBe("value three"); } + + [Fact] + public async Task DownloadAsync() + { + var result = await _peopleAppService.DownloadAsync(); + + result.ContentType.ShouldBe("application/rtf"); + using (var reader = new StreamReader(result.GetStream())) + { + var str = await reader.ReadToEndAsync(); + str.ShouldBe("DownloadAsync"); + } + } + + [Fact] + public async Task UploadAsync() + { + var memoryStream = new MemoryStream(); + await memoryStream.WriteAsync(Encoding.UTF8.GetBytes("UploadAsync")); + memoryStream.Position = 0; + var result = await _peopleAppService.UploadAsync(new RemoteStreamContent(memoryStream) + { + ContentType = "application/rtf" + }); + result.ShouldBe("UploadAsync:application/rtf"); + } } } diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs index da61333d4e..e18c2f8f4a 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestController.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -140,5 +141,13 @@ namespace Volo.Abp.Http.DynamicProxying [FromQuery] public DateTime FirstReleaseDate { get; set; } + + [FromQuery] + public List Colors { get; set; } + + public Car() + { + Colors = new List(); + } } } diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Localization/nl.json b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Localization/nl.json new file mode 100644 index 0000000000..dfef28046b --- /dev/null +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/Localization/nl.json @@ -0,0 +1,6 @@ +{ + "culture": "nl", + "texts": { + "Volo.Abp.Http.DynamicProxying:10001": "Business-uitzondering met data: {0}" + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs index a34cd19ebb..2344cb7c9b 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Content; using Volo.Abp.TestApp.Application.Dto; namespace Volo.Abp.TestApp.Application @@ -20,5 +21,9 @@ namespace Volo.Abp.TestApp.Application Task GetWithAuthorized(); Task GetWithComplexType(GetWithComplexTypeInput input); + + Task DownloadAsync(); + + Task UploadAsync(IRemoteStreamContent streamContent); } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs index cff72c7869..788304900d 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs @@ -1,12 +1,15 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.TestApp.Domain; using Volo.Abp.Domain.Repositories; using Volo.Abp.Application.Services; +using Volo.Abp.Content; using Volo.Abp.TestApp.Application.Dto; namespace Volo.Abp.TestApp.Application @@ -64,5 +67,24 @@ namespace Volo.Abp.TestApp.Application { return Task.FromResult(input); } + + public async Task DownloadAsync() + { + var memoryStream = new MemoryStream(); + await memoryStream.WriteAsync(Encoding.UTF8.GetBytes("DownloadAsync")); + + return new RemoteStreamContent(memoryStream) + { + ContentType = "application/rtf" + }; + } + + public async Task UploadAsync(IRemoteStreamContent streamContent) + { + using (var reader = new StreamReader(streamContent.GetStream())) + { + return await reader.ReadToEndAsync() + ":" + streamContent.ContentType; + } + } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs index 3d9b324da8..e31b64f6e4 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs @@ -1,7 +1,9 @@ using Shouldly; using System; +using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Data; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; using Volo.Abp.Modularity; using Volo.Abp.TestApp.Domain; @@ -119,5 +121,40 @@ namespace Volo.Abp.TestApp.Testing john.ShouldBeNull(); } } + + [Fact] + public async Task Should_HardDelete_WithDeleteMany() + { + var persons = await PersonRepository.GetListAsync(); + + await WithUnitOfWorkAsync(async () => + { + var hardDeleteEntities = (HashSet)UnitOfWorkManager.Current.Items.GetOrAdd( + UnitOfWorkItemNames.HardDeletedEntities, + () => new HashSet() + ); + hardDeleteEntities.UnionWith(persons); + await PersonRepository.DeleteManyAsync(persons); + }); + + var personsCount = await PersonRepository.GetCountAsync(); + + personsCount.ShouldBe(0); + } + + [Fact] + public async Task Should_HardDelete_WithDeleteMany_WithPredicate() + { + await WithUnitOfWorkAsync(async () => + { + await PersonRepository.HardDeleteAsync(x => x.Id == TestDataBuilder.UserDouglasId); + + await PersonRepository.DeleteManyAsync(new[] { TestDataBuilder.UserDouglasId }); + }); + + var douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + + douglas.ShouldBeNull(); + } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs index b8618fd6a3..4b313d2127 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs @@ -56,6 +56,23 @@ namespace Volo.Abp.TestApp.Testing douglas.DeletionTime.ShouldNotBeNull(); } } + + [Fact] + public async Task Should_Cancel_Deletion_For_Soft_Delete_Many_Entities_ById() + { + await PersonRepository.DeleteManyAsync(new []{ TestDataBuilder.UserDouglasId }); + + var douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + + using (DataFilter.Disable()) + { + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldNotBeNull(); + douglas.IsDeleted.ShouldBeTrue(); + douglas.DeletionTime.ShouldNotBeNull(); + } + } [Fact] public async Task Should_Handle_Deletion_On_Update_For_Soft_Delete_Entities() diff --git a/framework/test/Volo.Abp.TextTemplating.Tests/Volo/Abp/TextTemplating/Localization/nl.json b/framework/test/Volo.Abp.TextTemplating.Tests/Volo/Abp/TextTemplating/Localization/nl.json new file mode 100644 index 0000000000..c3c0818b03 --- /dev/null +++ b/framework/test/Volo.Abp.TextTemplating.Tests/Volo/Abp/TextTemplating/Localization/nl.json @@ -0,0 +1,7 @@ +{ + "culture": "nl", + "texts": { + "HelloText": "Hallo {0}", + "HowAreYou": "hoe is het met je?" + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs b/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs index de9067e2f7..cd602c07af 100644 --- a/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs +++ b/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs @@ -180,15 +180,19 @@ namespace Volo.Abp.Validation { //Valid ValidationHelper.IsValidEmailAddress("john.doe@domain.com").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("john-doe1@domain.co").ShouldBe(true); ValidationHelper.IsValidEmailAddress("ip@1.2.3.123").ShouldBe(true); ValidationHelper.IsValidEmailAddress("pharaoh@egyptian.museum").ShouldBe(true); ValidationHelper.IsValidEmailAddress("john.doe+regexbuddy@gmail.com").ShouldBe(true); ValidationHelper.IsValidEmailAddress("Mike.O'Dell@ireland.com").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("admin@localhost").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("j@h.c").ShouldBe(true); //Invalid - ValidationHelper.IsValidEmailAddress("1024x768@60Hz").ShouldBe(false); ValidationHelper.IsValidEmailAddress("not.a.valid.email").ShouldBe(false); ValidationHelper.IsValidEmailAddress("john@aol...com").ShouldBe(false); + ValidationHelper.IsValidEmailAddress("john@aol@domain.com").ShouldBe(false); + ValidationHelper.IsValidEmailAddress("jack@domain.").ShouldBe(false); } [DependsOn(typeof(AbpAutofacModule))] diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json index 755cd5674b..459d115398 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json @@ -60,6 +60,8 @@ "Volo.Account:InvalidEmailAddress": "Can not find the given email address: {0}", "PasswordReset": "Password reset", "PasswordResetInfoInEmail": "We received an account recovery request! If you initiated this request, click the following link to reset your password.", - "ResetMyPassword": "Reset my password" + "ResetMyPassword": "Reset my password", + "AccessDenied": "Access denied!", + "AccessDeniedMessage": "You do not have access to this resource." } } diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/nl.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/nl.json index 64a1a70124..efd751859e 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/nl.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/nl.json @@ -3,9 +3,9 @@ "texts": { "UserName": "Gebruikersnaam", "EmailAddress": "E-mailadres", - "UserNameOrEmailAddress": "Gebruikersnaam of e-mail adres", + "UserNameOrEmailAddress": "Gebruikersnaam of e-mailadres", "Password": "Wachtwoord", - "RememberMe": "Herinner me", + "RememberMe": "Onthoud me", "UseAnotherServiceToLogin": "Gebruik een andere dienst om in te loggen", "UserLockedOutMessage": "Het gebruikersaccount is geblokkeerd vanwege ongeldige inlogpogingen. Wacht even en probeer het opnieuw.", "InvalidUserNameOrPassword": "Ongeldige gebruikersnaam of wachtwoord!", @@ -29,17 +29,37 @@ "DisplayName:Name": "Naam", "DisplayName:Surname": "Achternaam", "DisplayName:Password": "Wachtwoord", - "DisplayName:EmailAddress": "E-mail adres", + "DisplayName:EmailAddress": "E-mailadres", "DisplayName:PhoneNumber": "Telefoonnummer", "PersonalSettings": "Persoonlijke instellingen", "PersonalSettingsSaved": "Persoonlijke instellingen opgeslagen", - "PasswordChanged": "wachtwoord veranderd", - "NewPasswordConfirmFailed": "Bevestig het nieuwe wachtwoord a.u.b..", + "PasswordChanged": "Wachtwoord veranderd", + "NewPasswordConfirmFailed": "Bevestig het nieuwe wachtwoord a.u.b.", "Manage": "Beheer", "ManageYourProfile": "Beheer uw profiel", "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Is zelfregistratie ingeschakeld", "Description:Abp.Account.IsSelfRegistrationEnabled": "Of een gebruiker het account zelf kan registreren.", "DisplayName:Abp.Account.EnableLocalLogin": "Verifieer met een lokaal account", - "Description:Abp.Account.EnableLocalLogin": "Geeft aan of de server gebruikers toestaat zich te verifiëren met een lokaal account." + "Description:Abp.Account.EnableLocalLogin": "Geeft aan of de server gebruikers toestaat zich te verifiëren met een lokaal account.", + "LoggedOutTitle": "Uitgelogd", + "LoggedOutText": "U bent uitgelogd en u wordt binnen enkele ogenblikken doorgestuurd.", + "ReturnToText": "Klik hier om doorgestuurd te worden naar {0}", + "OrLoginWith": "Of log in met:", + "ForgotPassword": "Wachtwoord vergeten?", + "SendPasswordResetLink_Information": "Er wordt een link voor het opnieuw instellen van uw wachtwoord naar uw e-mailadres gestuurd. Als u binnen een paar minuten geen e-mail ontvangt, probeer het dan opnieuw.", + "PasswordResetMailSentMessage": "Er is een link voor het opnieuw instellen van uw wachtwoord naar uw e-mailadres gestuurd. Als u deze e-mail niet binnen 15 minuten in uw inbox ziet, zoek hem dan in uw map met ongewenste e-mail. Als u de mail daar vindt, markeer hem dan als niet ongewenst.", + "ResetPassword": "Wachtwoord opnieuw instellen", + "ConfirmPassword": "Bevestig (herhaal) het wachtwoord", + "ResetPassword_Information": "Voer uw nieuwe wachtwoord in.", + "YourPasswordIsSuccessfullyReset": "Uw wachtwoord is succesvol opnieuw ingesteld.", + "GoToTheApplication": "Ga naar de applicatie", + "BackToLogin": "Terug naar Inloggen", + "ProfileTab:Password": "Wachtwoord wijzigen", + "ProfileTab:PersonalInfo": "Persoonlijke informatie", + "ReturnToApplication": "Ga terug naar de applicatie", + "Volo.Account:InvalidEmailAddress": "Kan het opgegeven e-mailadres '{0}' niet vinden", + "PasswordReset": "Wachtwoord opnieuw instellen", + "PasswordResetInfoInEmail": "We hebben een verzoek ontvangen om uw wachtwoord opnieuw in te stellen. Als u dit verzoek heeft ingediend, klikt u op de volgende link om een nieuw wachtwoord in te stellen.", + "ResetMyPassword": "Reset mijn wachtwoord" } -} +} \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json index d8cf5dd74f..a1c899357b 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json @@ -60,6 +60,8 @@ "Volo.Account:InvalidEmailAddress": "Email adresi bulunamadı: {0}", "PasswordReset": "Şifre Sıfırlama", "PasswordResetInfoInEmail": "Şifrenizi sıfırlamanız için bir talep aldık! Eğer bu talebi siz gerçekleştirmişseniz, şifrenizi sıfırlamak için bağlantıya tıklayın.", - "ResetMyPassword": "Şifremi sıfırla" + "ResetMyPassword": "Şifremi sıfırla", + "AccessDenied": "Erişim reddedildi!", + "AccessDeniedMessage": "Bu kaynağa erişiminiz yok." } } diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json index 53fe6135f2..26c6fc3337 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json @@ -60,6 +60,8 @@ "Volo.Account:InvalidEmailAddress": "找不到给定的电子邮件地址:{0}", "PasswordReset": "重设密码", "PasswordResetInfoInEmail": "我们收到了帐户恢复请求!如果你发起了此请求,请单击以下链接以重置密码.", - "ResetMyPassword": "重置我的密码" + "ResetMyPassword": "重置我的密码", + "AccessDenied": "拒绝访问!", + "AccessDeniedMessage": "你无权访问此资源." } } diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json index a67ea8d63f..8a57429344 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json @@ -58,6 +58,8 @@ "ReturnToApplication": "返回到應用程序", "PasswordReset": "重設密碼", "PasswordResetInfoInEmail": "我們收到了帳戶恢復請求!如果你發起了此請求,請單擊以下鏈接以重置密碼.", - "ResetMyPassword": "重置我的密碼" + "ResetMyPassword": "重置我的密碼", + "AccessDenied": "拒絕訪問!", + "AccessDeniedMessage": "您無權訪問此資源." } } diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs index 3d7381d2c3..4dab1f9761 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs @@ -103,9 +103,9 @@ namespace Volo.Abp.Account.Web.Pages.Account public override async Task OnPostAsync(string action) { + var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); if (action == "Cancel") { - var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); if (context == null) { return Redirect("~/"); @@ -142,7 +142,8 @@ namespace Volo.Abp.Account.Web.Pages.Account { Identity = IdentitySecurityLogIdentityConsts.Identity, Action = result.ToIdentitySecurityLogAction(), - UserName = LoginInput.UserNameOrEmailAddress + UserName = LoginInput.UserNameOrEmailAddress, + ClientId = context?.Client?.ClientId }); if (result.RequiresTwoFactor) diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs index 26ee0d4c34..94860e80c1 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs @@ -20,12 +20,6 @@ namespace Volo.Abp.Account.Web.Pages.Account public async override Task OnGetAsync() { - await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() - { - Identity = IdentitySecurityLogIdentityConsts.Identity, - Action = IdentitySecurityLogActionConsts.Logout - }); - await SignInManager.SignOutAsync(); var logoutId = Request.Query["logoutId"].ToString(); @@ -33,11 +27,14 @@ namespace Volo.Abp.Account.Web.Pages.Account if (!string.IsNullOrEmpty(logoutId)) { var logoutContext = await Interaction.GetLogoutContextAsync(logoutId); + + await SaveSecurityLogAsync(logoutContext?.ClientId); + await SignInManager.SignOutAsync(); HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); - LoggedOutModel vm = new LoggedOutModel() + var vm = new LoggedOutModel() { PostLogoutRedirectUri = logoutContext?.PostLogoutRedirectUri, ClientName = logoutContext?.ClientName, @@ -49,6 +46,8 @@ namespace Volo.Abp.Account.Web.Pages.Account return RedirectToPage("./LoggedOut", vm); } + await SaveSecurityLogAsync(); + if (ReturnUrl != null) { return LocalRedirect(ReturnUrl); @@ -58,5 +57,18 @@ namespace Volo.Abp.Account.Web.Pages.Account $"IdentityServerSupportedLogoutModel couldn't find postLogoutUri... Redirecting to:/Account/Login.."); return RedirectToPage("/Account/Login"); } + + protected virtual async Task SaveSecurityLogAsync(string clientId = null) + { + if (CurrentUser.IsAuthenticated) + { + await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() + { + Identity = IdentitySecurityLogIdentityConsts.Identity, + Action = IdentitySecurityLogActionConsts.Logout, + ClientId = clientId + }); + } + } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs index 303963d24f..4a806b9ae2 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs @@ -8,6 +8,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars; using Volo.Abp.AutoMapper; +using Volo.Abp.ExceptionHandling; using Volo.Abp.Identity.AspNetCore; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; @@ -19,7 +20,8 @@ namespace Volo.Abp.Account.Web typeof(AbpAccountHttpApiModule), typeof(AbpIdentityAspNetCoreModule), typeof(AbpAutoMapperModule), - typeof(AbpAspNetCoreMvcUiThemeSharedModule) + typeof(AbpAspNetCoreMvcUiThemeSharedModule), + typeof(AbpExceptionHandlingModule) )] public class AbpAccountWebModule : AbpModule { diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml new file mode 100644 index 0000000000..28608ff883 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml @@ -0,0 +1,15 @@ +@page +@model Volo.Abp.Account.Web.Pages.Account.AccessDeniedModel +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.Account.Localization +@inject IHtmlLocalizer L + +
    +
    +

    @L["AccessDenied"]

    +
    +

    @L["AccessDeniedMessage"]

    +
    ← @L["BackToLogin"] +
    +
    +
    diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml.cs new file mode 100644 index 0000000000..7ac9639d0b --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml.cs @@ -0,0 +1,24 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace Volo.Abp.Account.Web.Pages.Account +{ + public class AccessDeniedModel : AccountPageModel + { + [BindProperty(SupportsGet = true)] + public string ReturnUrl { get; set; } + + [BindProperty(SupportsGet = true)] + public string ReturnUrlHash { get; set; } + + public virtual Task OnGetAsync() + { + return Task.FromResult(Page()); + } + + public virtual Task OnPostAsync() + { + return Task.FromResult(Page()); + } + } +} diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs index 3e016c8bb5..c4461bd512 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs @@ -2,10 +2,11 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Volo.Abp.Account.Localization; +using Volo.Abp.AspNetCore.ExceptionHandling; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.ExceptionHandling; using Volo.Abp.Identity; using IdentityUser = Volo.Abp.Identity.IdentityUser; @@ -18,6 +19,7 @@ namespace Volo.Abp.Account.Web.Pages.Account public IdentityUserManager UserManager { get; set; } public IdentitySecurityLogManager IdentitySecurityLogManager { get; set; } public IOptions IdentityOptions { get; set; } + public IExceptionToErrorInfoConverter ExceptionToErrorInfoConverter { get; set; } protected AccountPageModel() { @@ -42,5 +44,15 @@ namespace Volo.Abp.Account.Web.Pages.Account throw new ApplicationException($"Current tenant is different than given tenant. CurrentTenant.Id: {CurrentTenant.Id}, given tenantId: {tenantId}"); } } + + protected virtual string GetLocalizeExceptionMessage(Exception exception) + { + if (exception is ILocalizeErrorMessage || exception is IHasErrorCode) + { + return ExceptionToErrorInfoConverter.Convert(exception, false).Message; + } + + return exception.Message; + } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ForgotPassword.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ForgotPassword.cshtml.cs index b66b53c913..1789a6ba2e 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ForgotPassword.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ForgotPassword.cshtml.cs @@ -43,7 +43,7 @@ namespace Volo.Abp.Account.Web.Pages.Account } catch (UserFriendlyException e) { - Alerts.Danger(e.Message); + Alerts.Danger(GetLocalizeExceptionMessage(e)); return Page(); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml index 056e69e895..57dec99889 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml @@ -56,7 +56,7 @@ @foreach (var provider in Model.VisibleExternalProviders) { - + } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs index 065573c137..eb6307e6b0 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs @@ -1,8 +1,6 @@ -using System; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Security.Claims; -using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -100,7 +98,7 @@ namespace Volo.Abp.Account.Web.Pages.Account } catch (BusinessException e) { - Alerts.Danger(e.Message); + Alerts.Danger(GetLocalizeExceptionMessage(e)); return Page(); } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs index 13370f5fbd..c961fe7e14 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs @@ -82,7 +82,7 @@ namespace Volo.Abp.Account.Web.Pages.Account { if (!string.IsNullOrWhiteSpace(e.Message)) { - Alerts.Warning(e.Message); + Alerts.Warning(GetLocalizeExceptionMessage(e)); return Page(); } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs index ad0e0d20c2..cd7e22b9a2 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogRepository.cs @@ -44,9 +44,10 @@ namespace Volo.Abp.AuditLogging Task> GetAverageExecutionDurationPerDayAsync( DateTime startDate, - DateTime endDate); + DateTime endDate, + CancellationToken cancellationToken = default); - Task GetEntityChange(Guid entityChangeId); + Task GetEntityChange(Guid entityChangeId, CancellationToken cancellationToken = default); Task> GetEntityChangeListAsync( string sorting = null, @@ -70,8 +71,8 @@ namespace Volo.Abp.AuditLogging string entityTypeFullName = null, CancellationToken cancellationToken = default); - Task GetEntityChangeWithUsernameAsync(Guid entityChangeId); + Task GetEntityChangeWithUsernameAsync(Guid entityChangeId, CancellationToken cancellationToken = default); - Task> GetEntityChangesWithUsernameAsync(string entityId, string entityTypeFullName); + Task> GetEntityChangesWithUsernameAsync(string entityId, string entityTypeFullName, CancellationToken cancellationToken = default); } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs index edb1f3f599..acd1912925 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs @@ -125,14 +125,17 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore .WhereIf(minExecutionDuration != null && minExecutionDuration.Value > 0, auditLog => auditLog.ExecutionDuration >= minExecutionDuration); } - public virtual async Task> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate) + public virtual async Task> GetAverageExecutionDurationPerDayAsync( + DateTime startDate, + DateTime endDate, + CancellationToken cancellationToken = default) { var result = await (await GetDbSetAsync()).AsNoTracking() .Where(a => a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate) .OrderBy(t => t.ExecutionTime) .GroupBy(t => new { t.ExecutionTime.Date }) .Select(g => new { Day = g.Min(t => t.ExecutionTime), avgExecutionTime = g.Average(t => t.ExecutionDuration) }) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return result.ToDictionary(element => element.Day.ClearTime(), element => element.avgExecutionTime); } @@ -148,14 +151,16 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore return (await GetQueryableAsync()).IncludeDetails(); } - public virtual async Task GetEntityChange(Guid entityChangeId) + public virtual async Task GetEntityChange( + Guid entityChangeId, + CancellationToken cancellationToken = default) { var entityChange = await (await GetDbContextAsync()).Set() .AsNoTracking() .IncludeDetails() .Where(x => x.Id == entityChangeId) .OrderBy(x => x.Id) - .FirstOrDefaultAsync(); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); if (entityChange == null) { @@ -201,10 +206,12 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore return totalCount; } - public virtual async Task GetEntityChangeWithUsernameAsync(Guid entityChangeId) + public virtual async Task GetEntityChangeWithUsernameAsync( + Guid entityChangeId, + CancellationToken cancellationToken = default) { var auditLog = await (await GetDbSetAsync()).AsNoTracking().IncludeDetails() - .Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId)).FirstAsync(); + .Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId)).FirstAsync(GetCancellationToken(cancellationToken)); return new EntityChangeWithUsername() { @@ -213,7 +220,10 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore }; } - public virtual async Task> GetEntityChangesWithUsernameAsync(string entityId, string entityTypeFullName) + public virtual async Task> GetEntityChangesWithUsernameAsync( + string entityId, + string entityTypeFullName, + CancellationToken cancellationToken = default) { var dbContext = await GetDbContextAsync(); @@ -225,7 +235,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore return await (from e in query join auditLog in dbContext.AuditLogs on e.AuditLogId equals auditLog.Id select new EntityChangeWithUsername {EntityChange = e, UserName = auditLog.UserName}) - .OrderByDescending(x => x.EntityChange.ChangeTime).ToListAsync(); + .OrderByDescending(x => x.EntityChange.ChangeTime).ToListAsync(GetCancellationToken(cancellationToken)); } protected virtual async Task> GetEntityChangeListQueryAsync( diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs index 788b6995bb..e0ce5990b7 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs @@ -52,7 +52,8 @@ namespace Volo.Abp.AuditLogging.MongoDB minDuration, hasException, httpStatusCode, - includeDetails + includeDetails, + cancellationToken ); return await query.OrderBy(sorting ?? "executionTime desc").As>() @@ -85,7 +86,8 @@ namespace Volo.Abp.AuditLogging.MongoDB maxDuration, minDuration, hasException, - httpStatusCode + httpStatusCode, + cancellationToken: cancellationToken ); var count = await query.As>() @@ -106,9 +108,10 @@ namespace Volo.Abp.AuditLogging.MongoDB int? minDuration = null, bool? hasException = null, HttpStatusCode? httpStatusCode = null, - bool includeDetails = false) + bool includeDetails = false, + CancellationToken cancellationToken = default) { - return (await GetMongoQueryableAsync()) + return (await GetMongoQueryableAsync(cancellationToken)) .WhereIf(startTime.HasValue, auditLog => auditLog.ExecutionTime >= startTime) .WhereIf(endTime.HasValue, auditLog => auditLog.ExecutionTime <= endTime) .WhereIf(hasException.HasValue && hasException.Value, auditLog => auditLog.Exceptions != null && auditLog.Exceptions != "") @@ -124,9 +127,12 @@ namespace Volo.Abp.AuditLogging.MongoDB } - public virtual async Task> GetAverageExecutionDurationPerDayAsync(DateTime startDate, DateTime endDate) + public virtual async Task> GetAverageExecutionDurationPerDayAsync( + DateTime startDate, + DateTime endDate, + CancellationToken cancellationToken = default) { - var result = await (await GetMongoQueryableAsync()) + var result = await (await GetMongoQueryableAsync(cancellationToken)) .Where(a => a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate) .OrderBy(t => t.ExecutionTime) .GroupBy(t => new @@ -136,17 +142,19 @@ namespace Volo.Abp.AuditLogging.MongoDB t.ExecutionTime.Day }) .Select(g => new { Day = g.Min(t => t.ExecutionTime), avgExecutionTime = g.Average(t => t.ExecutionDuration) }) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return result.ToDictionary(element => element.Day.ClearTime(), element => element.avgExecutionTime); } - public virtual async Task GetEntityChange(Guid entityChangeId) + public virtual async Task GetEntityChange( + Guid entityChangeId, + CancellationToken cancellationToken = default) { - var entityChange = (await (await GetMongoQueryableAsync()) + var entityChange = (await (await GetMongoQueryableAsync(cancellationToken)) .Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId)) .OrderBy(x => x.Id) - .FirstAsync()).EntityChanges.FirstOrDefault(x => x.Id == entityChangeId); + .FirstAsync(GetCancellationToken(cancellationToken))).EntityChanges.FirstOrDefault(x => x.Id == entityChangeId); if (entityChange == null) { @@ -169,7 +177,7 @@ namespace Volo.Abp.AuditLogging.MongoDB bool includeDetails = false, CancellationToken cancellationToken = default) { - var query = await GetEntityChangeListQueryAsync(auditLogId, startTime, endTime, changeType, entityId, entityTypeFullName); + var query = await GetEntityChangeListQueryAsync(auditLogId, startTime, endTime, changeType, entityId, entityTypeFullName, cancellationToken); return await query .OrderBy(sorting ?? "changeTime desc") @@ -187,18 +195,20 @@ namespace Volo.Abp.AuditLogging.MongoDB string entityTypeFullName = null, CancellationToken cancellationToken = default) { - var query = await GetEntityChangeListQueryAsync(auditLogId, startTime, endTime, changeType, entityId, entityTypeFullName); + var query = await GetEntityChangeListQueryAsync(auditLogId, startTime, endTime, changeType, entityId, entityTypeFullName, cancellationToken); var count = await query.As>().LongCountAsync(GetCancellationToken(cancellationToken)); return count; } - public virtual async Task GetEntityChangeWithUsernameAsync(Guid entityChangeId) + public virtual async Task GetEntityChangeWithUsernameAsync( + Guid entityChangeId, + CancellationToken cancellationToken = default) { - var auditLog = (await (await GetMongoQueryableAsync()) + var auditLog = await (await GetMongoQueryableAsync(cancellationToken)) .Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId)) - .FirstAsync()); + .FirstAsync(GetCancellationToken(cancellationToken)); return new EntityChangeWithUsername() { @@ -207,13 +217,16 @@ namespace Volo.Abp.AuditLogging.MongoDB }; } - public virtual async Task> GetEntityChangesWithUsernameAsync(string entityId, string entityTypeFullName) + public virtual async Task> GetEntityChangesWithUsernameAsync( + string entityId, + string entityTypeFullName, + CancellationToken cancellationToken = default) { - var auditLogs = await (await GetMongoQueryableAsync()) + var auditLogs = await (await GetMongoQueryableAsync(cancellationToken)) .Where(x => x.EntityChanges.Any(y => y.EntityId == entityId && y.EntityTypeFullName == entityTypeFullName)) .As>() .OrderByDescending(x => x.ExecutionTime) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); var entityChanges = auditLogs.SelectMany(x => x.EntityChanges).ToList(); @@ -229,9 +242,10 @@ namespace Volo.Abp.AuditLogging.MongoDB DateTime? endTime = null, EntityChangeType? changeType = null, string entityId = null, - string entityTypeFullName = null) + string entityTypeFullName = null, + CancellationToken cancellationToken = default) { - return (await GetMongoQueryableAsync()) + return (await GetMongoQueryableAsync(cancellationToken)) .SelectMany(x => x.EntityChanges) .WhereIf(auditLogId.HasValue, e => e.Id == auditLogId) .WhereIf(startTime.HasValue, e => e.ChangeTime >= startTime) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs index e12aeff70a..0fdf15de4b 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/IBackgroundJobRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -7,6 +8,6 @@ namespace Volo.Abp.BackgroundJobs { public interface IBackgroundJobRepository : IBasicRepository { - Task> GetWaitingListAsync(int maxResultCount); + Task> GetWaitingListAsync(int maxResultCount, CancellationToken cancellationToken = default); } -} \ No newline at end of file +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs index d879803677..e49fa3fe55 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs @@ -1,15 +1,17 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public class BackgroundJobsDbContext : AbpDbContext, IBackgroundJobsDbContext { public DbSet BackgroundJobs { get; set; } - public BackgroundJobsDbContext(DbContextOptions options) + public BackgroundJobsDbContext(DbContextOptions options) : base(options) { @@ -22,4 +24,4 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore builder.ConfigureBackgroundJobs(); } } -} \ No newline at end of file +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs index 0d16130fb5..0e36a661f6 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs @@ -12,13 +12,18 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); + if (builder.IsTenantOnlyDatabase()) + { + return; + } + var options = new BackgroundJobsModelBuilderConfigurationOptions( BackgroundJobsDbProperties.DbTablePrefix, BackgroundJobsDbProperties.DbSchema ); optionsAction?.Invoke(options); - + builder.Entity(b => { b.ToTable(options.TablePrefix + "BackgroundJobs", options.Schema); @@ -32,9 +37,9 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore b.Property(x => x.LastTryTime); b.Property(x => x.IsAbandoned).HasDefaultValue(false); b.Property(x => x.Priority).HasDefaultValue(BackgroundJobPriority.Normal); - + b.HasIndex(x => new { x.IsAbandoned, x.NextTryTime }); }); } } -} \ No newline at end of file +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs index 1971faf380..3ae5d2a409 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -21,9 +22,11 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore Clock = clock; } - public virtual async Task> GetWaitingListAsync(int maxResultCount) + public virtual async Task> GetWaitingListAsync( + int maxResultCount, + CancellationToken cancellationToken = default) { - return await (await GetWaitingListQueryAsync(maxResultCount)).ToListAsync(); + return await (await GetWaitingListQueryAsync(maxResultCount)).ToListAsync(GetCancellationToken(cancellationToken)); } protected virtual async Task> GetWaitingListQueryAsync(int maxResultCount) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs index cc70b6543a..46701b863e 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs @@ -1,12 +1,14 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public interface IBackgroundJobsDbContext : IEfCoreDbContext { DbSet BackgroundJobs { get; } } -} \ No newline at end of file +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs index 745903cae7..13a058bc33 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs @@ -1,9 +1,11 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.BackgroundJobs.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public class BackgroundJobsMongoDbContext : AbpMongoDbContext, IBackgroundJobsMongoDbContext { @@ -16,4 +18,4 @@ namespace Volo.Abp.BackgroundJobs.MongoDB modelBuilder.ConfigureBackgroundJobs(); } } -} \ No newline at end of file +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs index 8e2d11869d..254d22d63c 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs @@ -1,9 +1,11 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.BackgroundJobs.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public interface IBackgroundJobsMongoDbContext : IAbpMongoDbContext { diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs index 258c9310e2..56d0bfaff1 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; @@ -21,15 +22,17 @@ namespace Volo.Abp.BackgroundJobs.MongoDB Clock = clock; } - public virtual async Task> GetWaitingListAsync(int maxResultCount) + public virtual async Task> GetWaitingListAsync( + int maxResultCount, + CancellationToken cancellationToken = default) { - return await (await GetWaitingListQuery(maxResultCount)).ToListAsync(); + return await (await GetWaitingListQuery(maxResultCount)).ToListAsync(GetCancellationToken(cancellationToken)); } - protected virtual async Task> GetWaitingListQuery(int maxResultCount) + protected virtual async Task> GetWaitingListQuery(int maxResultCount, CancellationToken cancellationToken = default) { var now = Clock.Now; - return (await GetMongoQueryableAsync()) + return (await GetMongoQueryableAsync(cancellationToken)) .Where(t => !t.IsAbandoned && t.NextTryTime <= now) .OrderByDescending(t => t.Priority) .ThenBy(t => t.TryCount) diff --git a/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain.Shared/Volo/Abp/BlobStoring/Database/Localization/nl.json b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain.Shared/Volo/Abp/BlobStoring/Database/Localization/nl.json new file mode 100644 index 0000000000..0d295d59b3 --- /dev/null +++ b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain.Shared/Volo/Abp/BlobStoring/Database/Localization/nl.json @@ -0,0 +1,6 @@ +{ + "culture": "nl", + "texts": { + "ManageYourProfile": "Beheer uw profiel" + } +} \ No newline at end of file diff --git a/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/DatabaseBlobContainer.cs b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/DatabaseBlobContainer.cs index 4342d9092c..df912b84e5 100644 --- a/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/DatabaseBlobContainer.cs +++ b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/DatabaseBlobContainer.cs @@ -5,17 +5,17 @@ using Volo.Abp.MultiTenancy; namespace Volo.Abp.BlobStoring.Database { - public class DatabaseBlobContainer : AggregateRoot, IMultiTenant //TODO: Rename to BlobContainer + public class DatabaseBlobContainer : AggregateRoot, IMultiTenant { public virtual Guid? TenantId { get; protected set; } public virtual string Name { get; protected set; } - public DatabaseBlobContainer(Guid id, [NotNull] string name, Guid? tenantId = null) + public DatabaseBlobContainer(Guid id, [NotNull] string name, Guid? tenantId = null) : base(id) { Name = Check.NotNullOrWhiteSpace(name, nameof(name), DatabaseContainerConsts.MaxNameLength); TenantId = tenantId; } } -} \ No newline at end of file +} diff --git a/modules/blogging/app/Volo.BloggingTestApp/package.json b/modules/blogging/app/Volo.BloggingTestApp/package.json index dd8344d1bf..dd0661267d 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/package.json +++ b/modules/blogging/app/Volo.BloggingTestApp/package.json @@ -3,7 +3,7 @@ "name": "volo.blogtestapp", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0", - "@abp/blogging": "^4.1.0" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.0", + "@abp/blogging": "^4.2.0" } } \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp/yarn.lock b/modules/blogging/app/Volo.BloggingTestApp/yarn.lock index c950f9ce27..21cabeb03f 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/yarn.lock +++ b/modules/blogging/app/Volo.BloggingTestApp/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0.tgz#ef1b31feb678fdf4ce6fa76fb1e9d091ca97c9a4" - integrity sha512-eAD39TaMVnXsEOVyKcChIggpzJw3TzDua8x/APlHfxWBQOuCb7C/PWLWH9DIN14kl8JsVpgRrUSlKsvvY8CIRA== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.2.0.tgz#01d6aab8a31fd6ea828b753805f1ba9a9165975f" + integrity sha512-d+7YubPbuBRY8tjqBxS4I1gyxekjg8Z0X9QaDrf/SGQBoWpIdbG09AekNdddKNkimWcPg4UgUytahPuX9f17ZA== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -43,214 +43,214 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/blogging@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/blogging/-/blogging-4.1.0.tgz#28796d30cc9066fecb4f6c9393f74b9a18b6b652" - integrity sha512-AdnqmfJfA6AQ7qGUfrBK3XgJH4fVKp/zFgk1mtYO+oHnJ1oU9D707s49szFOVCIy5txfKdkxQ+hlJH3G8fg95g== +"@abp/blogging@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/blogging/-/blogging-4.2.0.tgz#5eaef63ea06f86cca8ca2727624cdc224566b473" + integrity sha512-rSJ0mSGInIDQcFUDGVVlWjXEF8T81BQ0u41vuURm3f06MBcK3TficQbl0Xnvx0Pc9Cbs4mFNd3UiZcsGp4MeMg== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - "@abp/owl.carousel" "~4.1.0" - "@abp/prismjs" "~4.1.0" - "@abp/tui-editor" "~4.1.0" + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + "@abp/owl.carousel" "~4.2.0" + "@abp/prismjs" "~4.2.0" + "@abp/tui-editor" "~4.2.0" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/clipboard@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/clipboard/-/clipboard-4.1.0.tgz#257d582a28e2311f4d433500aff3a529d5756d0a" - integrity sha512-BlJ3+eHXJcj0RJ5PdZ1I8ag0wylp4lW7ukzmXifzSYbT0on6o8pJuCvQM5rAyNqA5ucunjj9QiYXRRo44guKtQ== +"@abp/clipboard@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/clipboard/-/clipboard-4.2.0.tgz#860220df1d57ef64e864401d56cb5cf7068d5861" + integrity sha512-yBgMDhpqPEHp9N9//Ur1BEIOicFIoKBut75PMz9XPOttLyqCmqHYEPj/jgAkUzLd5O+fJM9TE3yGNM7YdRbRPg== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" clipboard "^2.0.6" -"@abp/codemirror@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/codemirror/-/codemirror-4.1.0.tgz#b1a094b51338f9902cb3e11679caf86af5ebae23" - integrity sha512-aibQkbvzxMdKwL+iPhNnrB3ovXmD4B/qoiv9EaB9xGAkOVwHwMgJDxC2HZdoH/r72wtaBPEySZaAzwuMzEBcBA== +"@abp/codemirror@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/codemirror/-/codemirror-4.2.0.tgz#4dac96e8bd908c0a77d1d2ca488cc08c30a123dc" + integrity sha512-urWA355XeP56NpPLDoByc7btjCSQY66jLe2G1/x/3zznChdFqEdWkql5nbLgsnfiPb0CaIntoWCKeqSnEz08kQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" codemirror "^5.54.0" -"@abp/core@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0.tgz#6bdfa378d44cbf8f611d52dddf0915e5bbc188d5" - integrity sha512-HXkKCfh8+Yc9iVBsZy7eSoQbkBSdV1QTRAF8+cPgbEpU4x4WlUOy61xqb2pSLFzX9nSma83WhdDyQkzWDBTRZQ== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/highlight.js@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/highlight.js/-/highlight.js-4.1.0.tgz#46cfa70982203db5b96a9a3ffd89d46b822da111" - integrity sha512-3DV7/7P3OP13upSADUQNHIu2Q/LovEo4ia7jJyqSsNv8pD6CXb/pmvRlhiQ7NXI7NIGqYe4a35uxR1T2AEyLRQ== +"@abp/highlight.js@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/highlight.js/-/highlight.js-4.2.0.tgz#92b1885fcfe4e94a4eaa3b7deffe9b62b4767692" + integrity sha512-C6gOvrp/pexbxgcd8rwN3McI4CVPWgE4JwgGrVw/VOuNF5eB4Bvy1ELI9bQNiLnoGNHhdUJD5a7nCNOMW4L9cA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/markdown-it@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/markdown-it/-/markdown-it-4.1.0.tgz#cd2804008fa53ad07134e3cfb2c55abc90be92f3" - integrity sha512-8pN6wkI7tHFTRZbVNHFqfHsc9n389C0gEuyBaCPE6AvJAHUiCShXmGp50qn7Ev23R8iX9x2boxXKEfeQ3PbTOw== +"@abp/markdown-it@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/markdown-it/-/markdown-it-4.2.0.tgz#e04514da16f9fdbfe3cab2933a60aa9193784a0b" + integrity sha512-If9AH2QwXExsZdFH5Orfo9giSrGMr9HviNM9cxDnHPwID5MJFrc7zxalqNwXcArtjGxLB+QaAfxEACIvLfLp/g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" markdown-it "^11.0.0" -"@abp/owl.carousel@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/owl.carousel/-/owl.carousel-4.1.0.tgz#67fb947682627f07fd27b2546dc218113cfb3236" - integrity sha512-RFznqVH+XIW7Pcxy9zZPqLwVuoJbWVn489PBL6kVDViFTqOSo38m4/wdMKCvUUCJPBiRNlAKO3IHkb3y4mc5fw== +"@abp/owl.carousel@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/owl.carousel/-/owl.carousel-4.2.0.tgz#1e02b137dc05529feca196568b87dd691a3d273a" + integrity sha512-T44Mvi7VlkDuv31WzoDLoskEF1jJ2KK/0UKtsg2ECauOfS1iQA1weoRx+ITK4Vg6RWayZxyQatVt1+6jz+0LcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" owl.carousel "^2.3.4" -"@abp/prismjs@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/prismjs/-/prismjs-4.1.0.tgz#fde3454460013490f566fc3b27fbc1031251b98b" - integrity sha512-jXE8oS8JyLgZS/oXrVS2CxtIH09WEHoUPM4HfndzxSPzxmg3G+E8kzMXbPrHGGx7AhHgmSxNVFGuR2+1YFpSPQ== +"@abp/prismjs@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/prismjs/-/prismjs-4.2.0.tgz#8cedfac538d225930c3654f0d94cad0102faa2f4" + integrity sha512-f4duxGD47p2TDMNiiBcvvjOG1hjhSbAoXyq306RrbP0CBUVTdjzzVhCPPnr5+nMoG55VlRBqh92zkax5kdgwQg== dependencies: - "@abp/clipboard" "~4.1.0" - "@abp/core" "~4.1.0" + "@abp/clipboard" "~4.2.0" + "@abp/core" "~4.2.0" prismjs "^1.20.0" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0.tgz#e5c8cb0c84435a0ca97be62c7b9204bbd05ae23d" - integrity sha512-VwIp7VD7zzkRMJw3yu7YOlWbIA/JbLYZeyEpNFMIDxAGYG936tVsmH+aQVTovHF/3+VsYf9Da1JjKymLVHkWRg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/tui-editor@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/tui-editor/-/tui-editor-4.1.0.tgz#337c1fbe9a7325837e57db88fe0265259da7d463" - integrity sha512-KV1IexfjW8Hrni4CcSWzqshyvUSNNH3W14S+8JmoHurPw7iDPCkrIRDt5csJQAnDFu2e4YXHKnDwORKYqmOYsg== +"@abp/tui-editor@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/tui-editor/-/tui-editor-4.2.0.tgz#893be49c6de9af515afab424bd3720796034190f" + integrity sha512-UN6CY5FGbqaYlRJoa8rLENibpMnB19XkhJReq05Bej6b/aCBiZCi7GAilgWPEghqublAObgdmeOe11NJlMrQ5Q== dependencies: - "@abp/codemirror" "~4.1.0" - "@abp/highlight.js" "~4.1.0" - "@abp/jquery" "~4.1.0" - "@abp/markdown-it" "~4.1.0" + "@abp/codemirror" "~4.2.0" + "@abp/highlight.js" "~4.2.0" + "@abp/jquery" "~4.2.0" + "@abp/markdown-it" "~4.2.0" tui-editor "^1.4.10" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Blogs/IBlogRepository.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Blogs/IBlogRepository.cs index ade8d1be0e..37dbf85ddd 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Blogs/IBlogRepository.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Blogs/IBlogRepository.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -6,6 +7,6 @@ namespace Volo.Blogging.Blogs { public interface IBlogRepository : IBasicRepository { - Task FindByShortNameAsync(string shortName); + Task FindByShortNameAsync(string shortName, CancellationToken cancellationToken = default); } } diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Comments/ICommentRepository.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Comments/ICommentRepository.cs index 88ff91d516..65144cf5c2 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Comments/ICommentRepository.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Comments/ICommentRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -7,14 +8,12 @@ namespace Volo.Blogging.Comments { public interface ICommentRepository : IBasicRepository { - Task> GetListOfPostAsync( - Guid postId - ); + Task> GetListOfPostAsync(Guid postId, CancellationToken cancellationToken = default); - Task GetCommentCountOfPostAsync(Guid postId); + Task GetCommentCountOfPostAsync(Guid postId, CancellationToken cancellationToken = default); - Task> GetRepliesOfComment(Guid id); + Task> GetRepliesOfComment(Guid id, CancellationToken cancellationToken = default); - Task DeleteOfPost(Guid id); + Task DeleteOfPost(Guid id, CancellationToken cancellationToken = default); } } 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 9a49590015..b5446515bf 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 @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -7,12 +8,12 @@ namespace Volo.Blogging.Posts { public interface IPostRepository : IBasicRepository { - Task> GetPostsByBlogId(Guid id); + Task> GetPostsByBlogId(Guid id, CancellationToken cancellationToken = default); - Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null); + Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null, CancellationToken cancellationToken = default); - Task GetPostByUrl(Guid blogId, string url); + Task GetPostByUrl(Guid blogId, string url, CancellationToken cancellationToken = default); - Task> GetOrderedList(Guid blogId,bool descending = false); + Task> GetOrderedList(Guid blogId,bool descending = false, CancellationToken cancellationToken = default); } } diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs index 8c076c49d7..12aa0031ed 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/ITagRepository.cs @@ -8,13 +8,13 @@ namespace Volo.Blogging.Tagging { public interface ITagRepository : IBasicRepository { - Task> GetListAsync(Guid blogId); + Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default); - Task GetByNameAsync(Guid blogId, string name); + Task GetByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default); - Task FindByNameAsync(Guid blogId, string name); + Task FindByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default); - Task> GetListAsync(IEnumerable ids); + Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default); Task DecreaseUsageCountOfTagsAsync(List id, CancellationToken cancellationToken = default); } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs index 564d45dc7a..d5397a66f0 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -15,9 +16,9 @@ namespace Volo.Blogging.Blogs } - public async Task FindByShortNameAsync(string shortName) + public async Task FindByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { - return await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.ShortName == shortName); + return await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.ShortName == shortName, GetCancellationToken(cancellationToken)); } } } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs index 6c28b521aa..801ef07825 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -16,29 +17,29 @@ namespace Volo.Blogging.Comments { } - public async Task> GetListOfPostAsync(Guid postId) + public async Task> GetListOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where(a => a.PostId == postId) .OrderBy(a => a.CreationTime) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCommentCountOfPostAsync(Guid postId) + public async Task GetCommentCountOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) - .CountAsync(a => a.PostId == postId); + .CountAsync(a => a.PostId == postId, GetCancellationToken(cancellationToken)); } - public async Task> GetRepliesOfComment(Guid id) + public async Task> GetRepliesOfComment(Guid id, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) - .Where(a => a.RepliedCommentId == id).ToListAsync(); + .Where(a => a.RepliedCommentId == id).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task DeleteOfPost(Guid id) + public async Task DeleteOfPost(Guid id, CancellationToken cancellationToken = default) { - var recordsToDelete = (await GetDbSetAsync()).Where(pt => pt.PostId == id); + var recordsToDelete = await (await GetDbSetAsync()).Where(pt => pt.PostId == id).ToListAsync(GetCancellationToken(cancellationToken)); (await GetDbSetAsync()).RemoveRange(recordsToDelete); } } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs index 4ab71a0222..85c34aa996 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; using Volo.Blogging.Blogs; using Volo.Blogging.Comments; using Volo.Blogging.Posts; @@ -9,6 +10,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public class BloggingDbContext : AbpDbContext, IBloggingDbContext { @@ -23,7 +25,7 @@ namespace Volo.Blogging.EntityFrameworkCore public DbSet PostTags { get; set; } public DbSet Comments { get; set; } - + public BloggingDbContext(DbContextOptions options) : base(options) { @@ -37,4 +39,4 @@ namespace Volo.Blogging.EntityFrameworkCore builder.ConfigureBlogging(); } } -} \ No newline at end of file +} 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 a5e909d8a4..9c54d0a3a0 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 @@ -20,6 +20,11 @@ namespace Volo.Blogging.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); + if (builder.IsTenantOnlyDatabase()) + { + return; + } + var options = new BloggingModelBuilderConfigurationOptions( BloggingDbProperties.DbTablePrefix, BloggingDbProperties.DbSchema diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreModule.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreModule.cs index 6e46982e44..3fc1a91323 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreModule.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingEntityFrameworkCoreModule.cs @@ -1,6 +1,11 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; +using Volo.Blogging.Blogs; +using Volo.Blogging.Comments; +using Volo.Blogging.Posts; +using Volo.Blogging.Tagging; +using Volo.Blogging.Users; namespace Volo.Blogging.EntityFrameworkCore { @@ -11,7 +16,14 @@ namespace Volo.Blogging.EntityFrameworkCore { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAbpDbContext(); + context.Services.AddAbpDbContext(options => + { + options.AddRepository(); + options.AddRepository(); + options.AddRepository(); + options.AddRepository(); + options.AddRepository(); + }); } } } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs index dcdb6c78e1..ecb7c282d4 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; using Volo.Blogging.Blogs; using Volo.Blogging.Comments; using Volo.Blogging.Posts; @@ -9,6 +10,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public interface IBloggingDbContext : IEfCoreDbContext { @@ -24,4 +26,4 @@ namespace Volo.Blogging.EntityFrameworkCore DbSet Tags { get; set; } } -} \ No newline at end of file +} 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 a5a84fd340..a676816dee 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 @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Entities; @@ -18,12 +19,12 @@ namespace Volo.Blogging.Posts } - public async Task> GetPostsByBlogId(Guid id) + public async Task> GetPostsByBlogId(Guid id, CancellationToken cancellationToken = default) { - return await (await GetDbSetAsync()).Where(p => p.BlogId == id).OrderByDescending(p=>p.CreationTime).ToListAsync(); + return await (await GetDbSetAsync()).Where(p => p.BlogId == id).OrderByDescending(p=>p.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null) + public async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null, CancellationToken cancellationToken = default) { var query = (await GetDbSetAsync()).Where(p => blogId == p.BlogId && p.Url == url); @@ -32,12 +33,12 @@ namespace Volo.Blogging.Posts query = query.Where(p => excludingPostId != p.Id); } - return await query.AnyAsync(); + return await query.AnyAsync(GetCancellationToken(cancellationToken)); } - public async Task GetPostByUrl(Guid blogId, string url) + public async Task GetPostByUrl(Guid blogId, string url, CancellationToken cancellationToken = default) { - var post = await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url); + var post = await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url, GetCancellationToken(cancellationToken)); if (post == null) { @@ -47,15 +48,15 @@ namespace Volo.Blogging.Posts return post; } - public async Task> GetOrderedList(Guid blogId,bool descending = false) + public async Task> GetOrderedList(Guid blogId,bool descending = false, CancellationToken cancellationToken = default) { if (!descending) { - return await (await GetDbSetAsync()).Where(x=>x.BlogId==blogId).OrderByDescending(x => x.CreationTime).ToListAsync(); + return await (await GetDbSetAsync()).Where(x=>x.BlogId==blogId).OrderByDescending(x => x.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } else { - return await (await GetDbSetAsync()).Where(x => x.BlogId == blogId).OrderBy(x => x.CreationTime).ToListAsync(); + return await (await GetDbSetAsync()).Where(x => x.BlogId == blogId).OrderBy(x => x.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs index a92ae780da..0a33207374 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs @@ -17,24 +17,24 @@ namespace Volo.Blogging.Tagging { } - public async Task> GetListAsync(Guid blogId) + public async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) { - return await (await GetDbSetAsync()).Where(t=>t.BlogId == blogId).ToListAsync(); + return await (await GetDbSetAsync()).Where(t=>t.BlogId == blogId).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetByNameAsync(Guid blogId, string name) + public async Task GetByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { - return await (await GetDbSetAsync()).FirstAsync(t=> t.BlogId == blogId && t.Name == name); + return await (await GetDbSetAsync()).FirstAsync(t=> t.BlogId == blogId && t.Name == name, GetCancellationToken(cancellationToken)); } - public async Task FindByNameAsync(Guid blogId, string name) + public async Task FindByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { - return await (await GetDbSetAsync()).FirstOrDefaultAsync(t => t.BlogId == blogId && t.Name == name); + return await (await GetDbSetAsync()).FirstOrDefaultAsync(t => t.BlogId == blogId && t.Name == name, GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IEnumerable ids) + public async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { - return await (await GetDbSetAsync()).Where(t => ids.Contains(t.Id)).ToListAsync(); + return await (await GetDbSetAsync()).Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } public async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default) diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs index 6025dfe3ca..2577b8d3a0 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; @@ -13,9 +14,9 @@ namespace Volo.Blogging.Blogs { } - public async Task FindByShortNameAsync(string shortName) + public async Task FindByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).FirstOrDefaultAsync(p => p.ShortName == shortName); + return await (await GetMongoQueryableAsync(cancellationToken)).FirstOrDefaultAsync(p => p.ShortName == shortName, GetCancellationToken(cancellationToken)); } } } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs index bbbe60345b..689e44abbd 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; @@ -15,33 +16,33 @@ namespace Volo.Blogging.Comments { } - public async Task> GetListOfPostAsync(Guid postId) + public async Task> GetListOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(cancellationToken)) .Where(a => a.PostId == postId) .OrderBy(a => a.CreationTime) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCommentCountOfPostAsync(Guid postId) + public async Task GetCommentCountOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) - .CountAsync(a => a.PostId == postId); + return await (await GetMongoQueryableAsync(cancellationToken)) + .CountAsync(a => a.PostId == postId, GetCancellationToken(cancellationToken)); } - public async Task> GetRepliesOfComment(Guid id) + public async Task> GetRepliesOfComment(Guid id, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) - .Where(a => a.RepliedCommentId == id).ToListAsync(); + return await (await GetMongoQueryableAsync(cancellationToken)) + .Where(a => a.RepliedCommentId == id).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task DeleteOfPost(Guid id) + public async Task DeleteOfPost(Guid id, CancellationToken cancellationToken = default) { - var recordsToDelete = (await GetMongoQueryableAsync()).Where(pt => pt.PostId == id); + var recordsToDelete = (await GetMongoQueryableAsync(cancellationToken)).Where(pt => pt.PostId == id); foreach (var record in recordsToDelete) { - await DeleteAsync(record); + await DeleteAsync(record, cancellationToken: GetCancellationToken(cancellationToken)); } } } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs index fa265b3e67..1f20ff1744 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs @@ -1,6 +1,7 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; using Volo.Blogging.Blogs; using Volo.Blogging.Comments; using Volo.Blogging.Posts; @@ -8,6 +9,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public class BloggingMongoDbContext : AbpMongoDbContext, IBloggingMongoDbContext { diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs index 8366e87d74..1dbf5eee92 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs @@ -1,6 +1,7 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; using Volo.Blogging.Blogs; using Volo.Blogging.Comments; using Volo.Blogging.Posts; @@ -8,6 +9,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public interface IBloggingMongoDbContext : IAbpMongoDbContext { @@ -22,4 +24,4 @@ namespace Volo.Blogging.MongoDB IMongoCollection Comments { get; } } -} \ No newline at end of file +} 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 27f4ad4348..a2d79c9466 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 @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; @@ -16,27 +17,27 @@ namespace Volo.Blogging.Posts { } - public async Task> GetPostsByBlogId(Guid id) + public async Task> GetPostsByBlogId(Guid id, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).Where(p => p.BlogId == id).OrderByDescending(p => p.CreationTime).ToListAsync(); + return await (await GetMongoQueryableAsync(cancellationToken)).Where(p => p.BlogId == id).OrderByDescending(p => p.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null) + public async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null, CancellationToken cancellationToken = default) { - var query = (await GetMongoQueryableAsync()).Where(p => blogId == p.BlogId && p.Url == url); + var query = (await GetMongoQueryableAsync(cancellationToken)).Where(p => blogId == p.BlogId && p.Url == url); if (excludingPostId != null) { query = query.Where(p => excludingPostId != p.Id); } - return await query.AnyAsync(); + return await query.AnyAsync(GetCancellationToken(cancellationToken)); } - public async Task GetPostByUrl(Guid blogId, string url) + public async Task GetPostByUrl(Guid blogId, string url, CancellationToken cancellationToken = default) { - var post = await (await GetMongoQueryableAsync()).FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url); + var post = await (await GetMongoQueryableAsync(cancellationToken)).FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url, GetCancellationToken(cancellationToken)); if (post == null) { @@ -46,16 +47,16 @@ namespace Volo.Blogging.Posts return post; } - public async Task> GetOrderedList(Guid blogId, bool @descending = false) + public async Task> GetOrderedList(Guid blogId, bool @descending = false, CancellationToken cancellationToken = default) { - var query = (await GetMongoQueryableAsync()).Where(x => x.BlogId == blogId); + var query = (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.BlogId == blogId); if (!descending) { - return await query.OrderBy(x => x.CreationTime).ToListAsync(); + return await query.OrderBy(x => x.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } - return await query.OrderByDescending(x => x.CreationTime).ToListAsync(); + return await query.OrderByDescending(x => x.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs index f0024b37d7..2030d47f2d 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs @@ -18,29 +18,29 @@ namespace Volo.Blogging.Tagging { } - public async Task> GetListAsync(Guid blogId) + public async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).Where(t => t.BlogId == blogId).ToListAsync(); + return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => t.BlogId == blogId).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetByNameAsync(Guid blogId, string name) + public async Task GetByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).Where(t => t.BlogId == blogId && t.Name == name).FirstAsync(); + return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => t.BlogId == blogId && t.Name == name).FirstAsync(GetCancellationToken(cancellationToken)); } - public async Task FindByNameAsync(Guid blogId, string name) + public async Task FindByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).Where(t => t.BlogId == blogId && t.Name == name).FirstOrDefaultAsync(); + return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => t.BlogId == blogId && t.Name == name).FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IEnumerable ids) + public async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).Where(t => ids.Contains(t.Id)).ToListAsync(); + return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } public async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default) { - var tags = await (await GetMongoQueryableAsync()) + var tags = await (await GetMongoQueryableAsync(cancellationToken)) .Where(t => ids.Contains(t.Id)) .ToListAsync(GetCancellationToken(cancellationToken)); diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs index fdcf4d0097..5523af8394 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs @@ -15,7 +15,7 @@ namespace Volo.Blogging.Users { } - public async Task> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken) + public async Task> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken = default) { var query = await GetMongoQueryableAsync(cancellationToken); @@ -24,7 +24,7 @@ namespace Volo.Blogging.Users query = query.Where(x => x.UserName.Contains(filter)); } - return await query.Take(maxCount).ToListAsync(cancellationToken); + return await query.Take(maxCount).ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/package.json b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/package.json index 04a2ce6b47..0a602e5e82 100644 --- a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/package.json +++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/package.json @@ -3,6 +3,6 @@ "name": "client-simulation-web", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.0" } } \ No newline at end of file diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/yarn.lock b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/yarn.lock index 001ea1aa34..7b70feb736 100644 --- a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/yarn.lock +++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0.tgz#ef1b31feb678fdf4ce6fa76fb1e9d091ca97c9a4" - integrity sha512-eAD39TaMVnXsEOVyKcChIggpzJw3TzDua8x/APlHfxWBQOuCb7C/PWLWH9DIN14kl8JsVpgRrUSlKsvvY8CIRA== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.2.0.tgz#01d6aab8a31fd6ea828b753805f1ba9a9165975f" + integrity sha512-d+7YubPbuBRY8tjqBxS4I1gyxekjg8Z0X9QaDrf/SGQBoWpIdbG09AekNdddKNkimWcPg4UgUytahPuX9f17ZA== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -43,145 +43,145 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/core@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0.tgz#6bdfa378d44cbf8f611d52dddf0915e5bbc188d5" - integrity sha512-HXkKCfh8+Yc9iVBsZy7eSoQbkBSdV1QTRAF8+cPgbEpU4x4WlUOy61xqb2pSLFzX9nSma83WhdDyQkzWDBTRZQ== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0.tgz#e5c8cb0c84435a0ca97be62c7b9204bbd05ae23d" - integrity sha512-VwIp7VD7zzkRMJw3yu7YOlWbIA/JbLYZeyEpNFMIDxAGYG936tVsmH+aQVTovHF/3+VsYf9Da1JjKymLVHkWRg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/modules/cms-kit/angular/package.json b/modules/cms-kit/angular/package.json index 2f3f207540..1fcaa68498 100644 --- a/modules/cms-kit/angular/package.json +++ b/modules/cms-kit/angular/package.json @@ -16,10 +16,10 @@ "private": true, "dependencies": { "@abp/ng.account": "~3.3.2", - "@abp/ng.identity": "~4.1.0", - "@abp/ng.setting-management": "~4.1.0", - "@abp/ng.tenant-management": "~4.1.0", - "@abp/ng.theme.basic": "~4.1.0", + "@abp/ng.identity": "~4.2.0", + "@abp/ng.setting-management": "~4.2.0", + "@abp/ng.tenant-management": "~4.2.0", + "@abp/ng.theme.basic": "~4.2.0", "@angular/animations": "~10.0.0", "@angular/common": "~10.0.0", "@angular/compiler": "~10.0.0", diff --git a/modules/cms-kit/angular/projects/cms-kit/package.json b/modules/cms-kit/angular/projects/cms-kit/package.json index 022b4e2a03..04018e4360 100644 --- a/modules/cms-kit/angular/projects/cms-kit/package.json +++ b/modules/cms-kit/angular/projects/cms-kit/package.json @@ -4,8 +4,8 @@ "peerDependencies": { "@angular/common": "^9.1.11", "@angular/core": "^9.1.11", - "@abp/ng.core": ">=4.1.0", - "@abp/ng.theme.shared": ">=4.1.0" + "@abp/ng.core": ">=4.2.0", + "@abp/ng.theme.shared": ">=4.2.0" }, "dependencies": { "tslib": "^2.0.0" diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs index 57b49409fc..d34f42aa6f 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs @@ -22,6 +22,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.Autofac; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.EntityFrameworkCore; @@ -47,7 +48,8 @@ namespace Volo.CmsKit typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpAspNetCoreSerilogModule) + typeof(AbpAspNetCoreSerilogModule), + typeof(BlobStoringDatabaseEntityFrameworkCoreModule) )] public class CmsKitHttpApiHostModule : AbpModule { diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs index c31c977ebe..d833e84caa 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/EntityFrameworkCore/CmsKitHttpApiHostMigrationsDbContext.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; namespace Volo.CmsKit.EntityFrameworkCore @@ -16,6 +17,7 @@ namespace Volo.CmsKit.EntityFrameworkCore base.OnModelCreating(modelBuilder); modelBuilder.ConfigureCmsKit(); + modelBuilder.ConfigureBlobStoring(); } } } diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs new file mode 100644 index 0000000000..28e6976776 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.Designer.cs @@ -0,0 +1,531 @@ +// +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.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))] + [Migration("20201231111745_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + 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"); + }); + + 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"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", 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("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + 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("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", 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(512) + .HasColumnType("nvarchar(512)"); + + 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("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", 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("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + 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(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + 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("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("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs new file mode 100644 index 0000000000..55f1ed7245 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/20201231111745_Initial.cs @@ -0,0 +1,309 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpBlobContainers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobContainers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsComments", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Text = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: false), + RepliedCommentId = table.Column(type: "uniqueidentifier", nullable: true), + CreatorId = table.Column(type: "uniqueidentifier", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsComments", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsContents", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Value = table.Column(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsContents", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsEntityTags", + columns: table => new + { + TagId = table.Column(type: "uniqueidentifier", nullable: false), + EntityId = table.Column(type: "nvarchar(450)", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId }); + }); + + migrationBuilder.CreateTable( + name: "CmsPages", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Title = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Description = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsPages", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsRatings", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + StarCount = table.Column(type: "smallint", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsRatings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsTags", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsTags", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsUserReactions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ReactionName = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsUserReactions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsUsers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Surname = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + EmailConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + PhoneNumber = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(type: "bit", nullable: false, defaultValue: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpBlobs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContainerId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Content = table.Column(type: "varbinary(max)", maxLength: 2147483647, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobs", x => x.Id); + table.ForeignKey( + name: "FK_AbpBlobs_AbpBlobContainers_ContainerId", + column: x => x.ContainerId, + principalTable: "AbpBlobContainers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobContainers_TenantId_Name", + table: "AbpBlobContainers", + columns: new[] { "TenantId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_ContainerId", + table: "AbpBlobs", + column: "ContainerId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_TenantId_ContainerId_Name", + table: "AbpBlobs", + columns: new[] { "TenantId", "ContainerId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsComments_TenantId_EntityType_EntityId", + table: "CmsComments", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsComments_TenantId_RepliedCommentId", + table: "CmsComments", + columns: new[] { "TenantId", "RepliedCommentId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsContents_TenantId_EntityType_EntityId", + table: "CmsContents", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsEntityTags_TenantId_EntityId_TagId", + table: "CmsEntityTags", + columns: new[] { "TenantId", "EntityId", "TagId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsPages_TenantId_Url", + table: "CmsPages", + columns: new[] { "TenantId", "Url" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId", + table: "CmsRatings", + columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsTags_TenantId_Name", + table: "CmsTags", + columns: new[] { "TenantId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName", + table: "CmsUserReactions", + columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUserReactions_TenantId_EntityType_EntityId_ReactionName", + table: "CmsUserReactions", + columns: new[] { "TenantId", "EntityType", "EntityId", "ReactionName" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUsers_TenantId_Email", + table: "CmsUsers", + columns: new[] { "TenantId", "Email" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsUsers_TenantId_UserName", + table: "CmsUsers", + columns: new[] { "TenantId", "UserName" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpBlobs"); + + migrationBuilder.DropTable( + name: "CmsComments"); + + migrationBuilder.DropTable( + name: "CmsContents"); + + migrationBuilder.DropTable( + name: "CmsEntityTags"); + + migrationBuilder.DropTable( + name: "CmsPages"); + + migrationBuilder.DropTable( + name: "CmsRatings"); + + migrationBuilder.DropTable( + name: "CmsTags"); + + migrationBuilder.DropTable( + name: "CmsUserReactions"); + + migrationBuilder.DropTable( + name: "CmsUsers"); + + migrationBuilder.DropTable( + name: "AbpBlobContainers"); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs new file mode 100644 index 0000000000..cd29086668 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Migrations/CmsKitHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -0,0 +1,529 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(CmsKitHttpApiHostMigrationsDbContext))] + partial class CmsKitHttpApiHostMigrationsDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + 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"); + }); + + 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"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", 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("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + 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("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", 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(512) + .HasColumnType("nvarchar(512)"); + + 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("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", 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("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + 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(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + 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("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("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj index 688c47bc87..2fc36d2f4b 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/Volo.CmsKit.HttpApi.Host.csproj @@ -24,6 +24,7 @@ + diff --git a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/package.json b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/package.json index 1a4cf0759e..1d3fc57a43 100644 --- a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/package.json +++ b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/package.json @@ -3,6 +3,6 @@ "name": "my-app-identityserver", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.0" } } \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/yarn.lock b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/yarn.lock index 85f88705f0..2fc3f25822 100644 --- a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/yarn.lock +++ b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0.tgz#ef1b31feb678fdf4ce6fa76fb1e9d091ca97c9a4" - integrity sha512-eAD39TaMVnXsEOVyKcChIggpzJw3TzDua8x/APlHfxWBQOuCb7C/PWLWH9DIN14kl8JsVpgRrUSlKsvvY8CIRA== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.2.0.tgz#01d6aab8a31fd6ea828b753805f1ba9a9165975f" + integrity sha512-d+7YubPbuBRY8tjqBxS4I1gyxekjg8Z0X9QaDrf/SGQBoWpIdbG09AekNdddKNkimWcPg4UgUytahPuX9f17ZA== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -43,145 +43,145 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/core@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0.tgz#6bdfa378d44cbf8f611d52dddf0915e5bbc188d5" - integrity sha512-HXkKCfh8+Yc9iVBsZy7eSoQbkBSdV1QTRAF8+cPgbEpU4x4WlUOy61xqb2pSLFzX9nSma83WhdDyQkzWDBTRZQ== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0.tgz#e5c8cb0c84435a0ca97be62c7b9204bbd05ae23d" - integrity sha512-VwIp7VD7zzkRMJw3yu7YOlWbIA/JbLYZeyEpNFMIDxAGYG936tVsmH+aQVTovHF/3+VsYf9Da1JjKymLVHkWRg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Host/package.json b/modules/cms-kit/host/Volo.CmsKit.Web.Host/package.json index 372875f0c9..010901f2f3 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Host/package.json +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Host/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.0" } } \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Host/yarn.lock b/modules/cms-kit/host/Volo.CmsKit.Web.Host/yarn.lock index 6cdea1692b..69cec15c38 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Host/yarn.lock +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Host/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0.tgz#ef1b31feb678fdf4ce6fa76fb1e9d091ca97c9a4" - integrity sha512-eAD39TaMVnXsEOVyKcChIggpzJw3TzDua8x/APlHfxWBQOuCb7C/PWLWH9DIN14kl8JsVpgRrUSlKsvvY8CIRA== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.2.0.tgz#01d6aab8a31fd6ea828b753805f1ba9a9165975f" + integrity sha512-d+7YubPbuBRY8tjqBxS4I1gyxekjg8Z0X9QaDrf/SGQBoWpIdbG09AekNdddKNkimWcPg4UgUytahPuX9f17ZA== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -43,145 +43,145 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/core@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0.tgz#6bdfa378d44cbf8f611d52dddf0915e5bbc188d5" - integrity sha512-HXkKCfh8+Yc9iVBsZy7eSoQbkBSdV1QTRAF8+cPgbEpU4x4WlUOy61xqb2pSLFzX9nSma83WhdDyQkzWDBTRZQ== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0.tgz#e5c8cb0c84435a0ca97be62c7b9204bbd05ae23d" - integrity sha512-VwIp7VD7zzkRMJw3yu7YOlWbIA/JbLYZeyEpNFMIDxAGYG936tVsmH+aQVTovHF/3+VsYf9Da1JjKymLVHkWRg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs index 2055266d20..b9f562bf98 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs @@ -15,6 +15,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.Autofac; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.SqlServer; @@ -63,8 +64,9 @@ namespace Volo.CmsKit typeof(AbpTenantManagementApplicationModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), - typeof(AbpAspNetCoreSerilogModule) - )] + typeof(AbpAspNetCoreSerilogModule), + typeof(BlobStoringDatabaseEntityFrameworkCoreModule) + )] public class CmsKitWebUnifiedModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs index d1b31e0ae7..fe6c11b300 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/EntityFrameworkCore/UnifiedDbContext.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore; +using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore; @@ -28,6 +29,7 @@ namespace Volo.CmsKit.EntityFrameworkCore modelBuilder.ConfigureTenantManagement(); modelBuilder.ConfigureFeatureManagement(); modelBuilder.ConfigureCmsKit(); + modelBuilder.ConfigureBlobStoring(); } } } diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs new file mode 100644 index 0000000000..15e01fa673 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.Designer.cs @@ -0,0 +1,1725 @@ +// +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.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20201231111657_Added_Blob_Storing")] + partial class Added_Blob_Storing + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + 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"); + }); + + 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"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", 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(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + 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"); + }); + + 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"); + }); + + 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("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"); + }); + + 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"); + }); + + 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"); + }); + + 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("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + 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("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("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"); + }); + + 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"); + }); + + 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"); + }); + + 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"); + }); + + 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"); + }); + + 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"); + }); + + 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("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"); + }); + + 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"); + }); + + 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("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + 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"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", 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("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", 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("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + 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("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", 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(512) + .HasColumnType("nvarchar(512)"); + + 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("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", 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("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + 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(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + 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("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("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + 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.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + 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.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs new file mode 100644 index 0000000000..11cf1901fa --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201231111657_Added_Blob_Storing.cs @@ -0,0 +1,95 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_Blob_Storing : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Description", + table: "CmsPages", + type: "nvarchar(512)", + maxLength: 512, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(515)", + oldMaxLength: 515, + oldNullable: true); + + migrationBuilder.CreateTable( + name: "AbpBlobContainers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobContainers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpBlobs", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContainerId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Content = table.Column(type: "varbinary(max)", maxLength: 2147483647, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpBlobs", x => x.Id); + table.ForeignKey( + name: "FK_AbpBlobs_AbpBlobContainers_ContainerId", + column: x => x.ContainerId, + principalTable: "AbpBlobContainers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobContainers_TenantId_Name", + table: "AbpBlobContainers", + columns: new[] { "TenantId", "Name" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_ContainerId", + table: "AbpBlobs", + column: "ContainerId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpBlobs_TenantId_ContainerId_Name", + table: "AbpBlobs", + columns: new[] { "TenantId", "ContainerId", "Name" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpBlobs"); + + migrationBuilder.DropTable( + name: "AbpBlobContainers"); + + migrationBuilder.AlterColumn( + name: "Description", + table: "CmsPages", + type: "nvarchar(515)", + maxLength: 515, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(512)", + oldMaxLength: 512, + oldNullable: true); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index 37622217c5..074d655f16 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -273,6 +273,79 @@ namespace Volo.CmsKit.Migrations b.ToTable("AbpEntityPropertyChanges"); }); + 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"); + }); + + 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"); + }); + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => { b.Property("Id") @@ -1197,8 +1270,8 @@ namespace Volo.CmsKit.Migrations .HasColumnName("DeletionTime"); b.Property("Description") - .HasMaxLength(515) - .HasColumnType("nvarchar(515)"); + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") @@ -1499,6 +1572,15 @@ namespace Volo.CmsKit.Migrations .IsRequired(); }); + 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) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj index 152d740864..1dbafb4ad6 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj @@ -32,6 +32,7 @@ + diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json index fbedc7395f..1c93432838 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json @@ -3,7 +3,7 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0", - "@abp/cms-kit": "4.1.0" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.0", + "@abp/cms-kit": "4.2.0" } } \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock index a996bc79a5..4bcd9f8297 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0.tgz#ef1b31feb678fdf4ce6fa76fb1e9d091ca97c9a4" - integrity sha512-eAD39TaMVnXsEOVyKcChIggpzJw3TzDua8x/APlHfxWBQOuCb7C/PWLWH9DIN14kl8JsVpgRrUSlKsvvY8CIRA== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.2.0.tgz#01d6aab8a31fd6ea828b753805f1ba9a9165975f" + integrity sha512-d+7YubPbuBRY8tjqBxS4I1gyxekjg8Z0X9QaDrf/SGQBoWpIdbG09AekNdddKNkimWcPg4UgUytahPuX9f17ZA== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -43,161 +43,160 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" - -"@abp/cms-kit@4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/cms-kit/-/cms-kit-4.1.0-rc.2.tgz#d2790dd3812214ab0c8eba6e9ad2b8019889e056" - integrity sha512-bS632Qp3tN+LHVj505lUgwtu2JVOhSf3W6VAXlYG0pSy8n1ltonDZHNKO6iwvnskdPaAA4wgJPWgqjXigChx0Q== +"@abp/cms-kit@4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/cms-kit/-/cms-kit-4.2.0.tgz#cfca768d3d7f95251c224a2737e8a78038635e68" + integrity sha512-CbO3FLmdRHJVFE5tqqj2EKgfDkhFFDXu5H7nyAtwk9zi1yV8pGvNFTQVJfzgZ7g0r5KaKTMRL3rFvSixWTF4jg== dependencies: - "@abp/star-rating-svg" "~4.1.0-rc.2" + "@abp/star-rating-svg" "~4.2.0" -"@abp/core@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0-rc.2.tgz#d306106a53fa56109751be0099785c94f43be56f" - integrity sha512-b0mOYSz8hNgZ/hBeYg8hkthJgE8CLyHNa2NcythPoIW8RR5qHmDtGoFnuFovLvLk7r+M4NWyxXRKEshSszIPyA== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/star-rating-svg@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/star-rating-svg/-/star-rating-svg-4.1.0-rc.2.tgz#558c681eb591847b3e8f114cbe610e4331f8a0a2" - integrity sha512-LNFCfytarGhqS+91lxYHQKMvlbHMDpjU0Knj8qyefNtQ+rbM2CEspWEtcducim+Qn4brqIHRudUvLI+eEC/0yQ== +"@abp/star-rating-svg@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/star-rating-svg/-/star-rating-svg-4.2.0.tgz#19d8ce9dacd92d573ff462aa194fdfa341a39ecc" + integrity sha512-jzcdwR1iz63OQaEgXBescuTntg+8DDAhDmDRMss6fO2ou1qlGLqs7mvb/al4z2FvxdDAqaoY8h9c1jKp7+yzuA== dependencies: - "@abp/jquery" "~4.1.0-rc.2" + "@abp/jquery" "~4.2.0" star-rating-svg "^3.5.0" -"@abp/sweetalert@~4.1.0-rc.2": - version "4.1.0-rc.2" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0-rc.2.tgz#cdcaf8e9a33cf218a687fd6a42cfe1c85d89c6b7" - integrity sha512-sjQd8TF9oUnaQ1OPTGdVyAfWqSZEk4bRbC/qw2CouEOfRLatzkC0JcmzFLN0f5N1am1RQwkFakpENKH7NqTCvg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs new file mode 100644 index 0000000000..ce1ca1e86c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs @@ -0,0 +1,12 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Admin.Contents +{ + public class ContentGetListDto : EntityDto + { + public string EntityType { get; set; } + + public string EntityId { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs index 02b25aa16d..52bd07aa86 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.CmsKit.Admin.Contents; @@ -7,10 +8,12 @@ namespace Volo.CmsKit.Admin.Contents public interface IContentAdminAppService : ICrudAppService< ContentDto, + ContentGetListDto, Guid, ContentGetListInput, ContentCreateDto, ContentUpdateDto> { + Task GetAsync(string entityType, string entityId); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs deleted file mode 100644 index abb1d81c12..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CheckUrlInputDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Volo.CmsKit.Admin.Pages -{ - public class CheckUrlInputDto - { - [Required] - public string Url { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs index 50c7a68f32..d2ddfe6e88 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs @@ -1,15 +1,21 @@ using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Pages { public class CreatePageInputDto { [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] public string Description { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs deleted file mode 100644 index bff09b595b..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageWithContentInputDto.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Volo.CmsKit.Admin.Pages -{ - public class CreatePageWithContentInputDto - { - [Required] - public string Title { get; set; } - - [Required] - public string Url { get; set; } - - public string Description { get; set; } - - [Required] - public string Content { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs new file mode 100644 index 0000000000..8523eeeffa --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/GetPagesInputDto.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Admin.Pages +{ + public class GetPagesInputDto : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs index 048d2d89c7..6ac96bbbfa 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/IPageAdminAppService.cs @@ -1,22 +1,11 @@ using System; using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Content; namespace Volo.CmsKit.Admin.Pages { - public interface IPageAdminAppService + public interface IPageAdminAppService : ICrudAppService { - Task GetAsync(Guid id); - - Task CreatePageAsync(CreatePageInputDto input); - - Task CreatePageWithContentAsync(CreatePageWithContentInputDto input); - - Task UpdatePageAsync(Guid id, UpdatePageInputDto input); - - Task DoesUrlExistAsync(CheckUrlInputDto input); - - Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input); - - Task DeleteAsync(Guid id); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs index e8750ce07b..3aebb76b51 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs @@ -3,7 +3,7 @@ using Volo.Abp.Application.Dtos; namespace Volo.CmsKit.Admin.Pages { - public class PageDto : EntityDto + public class PageDto : AuditedEntityDto { public string Title { get; set; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs deleted file mode 100644 index 119dedb041..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageWithContentDto.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; -using Volo.CmsKit.Admin.Contents; - -namespace Volo.CmsKit.Admin.Pages -{ - public class PageWithContentDto : EntityDto - { - public string Title { get; set; } - - public string Url { get; set; } - - public string Description { get; set; } - - public ContentDto Content { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs deleted file mode 100644 index f6d46167c8..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageContentInputDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Volo.CmsKit.Admin.Pages -{ - public class UpdatePageContentInputDto - { - [Required] - public string Content { get; set; } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs index eb831fee45..17b3c948bd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs @@ -1,15 +1,21 @@ using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Pages { public class UpdatePageInputDto { [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] public string Description { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/EntityTagCreateDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/EntityTagCreateDto.cs new file mode 100644 index 0000000000..92e83fecf4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/EntityTagCreateDto.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace Volo.CmsKit.Admin.Tags +{ + public class EntityTagCreateDto + { + [Required] + public string TagName { get; set; } + + [Required] + public string EntityType { get; set; } + + [Required] + public string EntityId { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/EntityTagRemoveDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/EntityTagRemoveDto.cs new file mode 100644 index 0000000000..411d4c7157 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/EntityTagRemoveDto.cs @@ -0,0 +1,17 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Volo.CmsKit.Admin.Tags +{ + public class EntityTagRemoveDto + { + [Required] + public Guid TagId { get; set; } + + [Required] + public string EntityType { get; set; } + + [Required] + public string EntityId { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/IEntityTagAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/IEntityTagAdminAppService.cs new file mode 100644 index 0000000000..aece4d5c00 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/IEntityTagAdminAppService.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; + +namespace Volo.CmsKit.Admin.Tags +{ + public interface IEntityTagAdminAppService + { + Task AddTagToEntityAsync(EntityTagCreateDto input); + + Task RemoveTagFromEntityAsync(EntityTagRemoveDto input); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/ITagAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/ITagAdminAppService.cs index e677a54c28..a5ae9d85d4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/ITagAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/ITagAdminAppService.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.CmsKit.Tags; @@ -6,5 +8,6 @@ namespace Volo.CmsKit.Admin.Tags { public interface ITagAdminAppService : ICrudAppService { + Task> GetTagDefinitionsAsync(); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/TagDefinitionDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/TagDefinitionDto.cs new file mode 100644 index 0000000000..0fdfe04b00 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Tags/TagDefinitionDto.cs @@ -0,0 +1,18 @@ +namespace Volo.CmsKit.Admin.Tags +{ + public class TagDefinitionDto + { + public TagDefinitionDto() + { + } + public TagDefinitionDto(string entityType, string displayName) + { + EntityType = entityType; + DisplayName = displayName; + } + + public string EntityType { get; set; } + + public string DisplayName { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs index 34c7947d67..bc55cc14e1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs @@ -27,6 +27,14 @@ namespace Volo.CmsKit.Permissions tagGroup.AddChild(CmsKitAdminPermissions.Tags.Update, L("Permission:TagManagement.Update")); tagGroup.AddChild(CmsKitAdminPermissions.Tags.Delete, L("Permission:TagManagement.Delete")); } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + var pageManagement = cmsGroup.AddPermission(CmsKitAdminPermissions.Pages.Default, L("Permission:PageManagement")); + pageManagement.AddChild(CmsKitAdminPermissions.Pages.Create, L("Permission:PageManagement:Create")); + pageManagement.AddChild(CmsKitAdminPermissions.Pages.Update, L("Permission:PageManagement:Update")); + pageManagement.AddChild(CmsKitAdminPermissions.Pages.Delete, L("Permission:PageManagement:Delete")); + } } private static LocalizableString L(string name) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs index 55bffff67f..a08ba9d6c8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs @@ -5,6 +5,7 @@ namespace Volo.CmsKit.Permissions public class CmsKitAdminPermissions { public const string GroupName = "CmsKit"; + public static class Tags { public const string Default = GroupName + ".Tags"; @@ -12,7 +13,7 @@ namespace Volo.CmsKit.Permissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } - + public static class Contents { public const string Default = GroupName + ".Contents"; @@ -20,5 +21,13 @@ namespace Volo.CmsKit.Permissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } + + public static class Pages + { + public const string Default = GroupName + ".Pages"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs index 4b7a6eb58f..a7ea1b5124 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs @@ -1,8 +1,10 @@ using AutoMapper; using Volo.CmsKit.Admin.Contents; using Volo.CmsKit.Admin.Pages; +using Volo.CmsKit.Admin.Tags; using Volo.CmsKit.Contents; using Volo.CmsKit.Pages; +using Volo.CmsKit.Tags; namespace Volo.CmsKit.Admin { @@ -13,8 +15,11 @@ namespace Volo.CmsKit.Admin CreateMap(); CreateMap(MemberList.Destination); + CreateMap(MemberList.Destination); CreateMap(MemberList.Source); CreateMap(MemberList.Source); + + CreateMap(MemberList.Destination); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs index 4695339fd7..300cf31181 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs @@ -1,6 +1,8 @@ -using Microsoft.AspNetCore.Authorization; +using JetBrains.Annotations; +using Microsoft.AspNetCore.Authorization; using System; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; using Volo.CmsKit.Contents; @@ -14,6 +16,7 @@ namespace Volo.CmsKit.Admin.Contents CrudAppService< Content, ContentDto, + ContentGetListDto, Guid, ContentGetListInput, ContentCreateDto, @@ -30,13 +33,13 @@ namespace Volo.CmsKit.Admin.Contents IContentRepository contentRepository) : base(repository) { ContentManager = contentManager; + ContentRepository = contentRepository; GetListPolicyName = CmsKitAdminPermissions.Contents.Default; GetPolicyName = CmsKitAdminPermissions.Contents.Default; CreatePolicyName = CmsKitAdminPermissions.Contents.Create; UpdatePolicyName = CmsKitAdminPermissions.Contents.Update; DeletePolicyName = CmsKitAdminPermissions.Contents.Delete; - ContentRepository = contentRepository; } [Authorize(CmsKitAdminPermissions.Contents.Create)] @@ -51,7 +54,19 @@ namespace Volo.CmsKit.Admin.Contents await ContentManager.InsertAsync(entity); - return MapToGetListOutputDto(entity); + return MapToGetOutputDto(entity); + } + + public async Task GetAsync( + [NotNull] string entityType, + [NotNull] string entityId) + { + Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); + Check.NotNullOrWhiteSpace(entityId, nameof(entityId)); + + var content = await ContentRepository.GetAsync(entityType, entityId, CurrentTenant?.Id); + + return ObjectMapper.Map(content); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs index 6778dd7916..3db45dac95 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs @@ -1,58 +1,63 @@ using System; -using System.Threading; +using System.Collections.Generic; using System.Threading.Tasks; -using Volo.Abp; -using Volo.CmsKit.Contents; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Dtos; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Pages; +using Volo.CmsKit.Permissions; namespace Volo.CmsKit.Admin.Pages { + [RequiresGlobalFeature(typeof(PagesFeature))] + [Authorize(CmsKitAdminPermissions.Pages.Default)] public class PageAdminAppService : CmsKitAdminAppServiceBase, IPageAdminAppService { protected readonly IPageRepository PageRepository; - protected readonly IContentRepository ContentRepository; - - public PageAdminAppService(IPageRepository pageRepository, IContentRepository contentRepository) + + public PageAdminAppService(IPageRepository pageRepository) { PageRepository = pageRepository; - ContentRepository = contentRepository; } public virtual async Task GetAsync(Guid id) { var page = await PageRepository.GetAsync(id); - return ObjectMapper.Map(page); } - public virtual async Task CreatePageAsync(CreatePageInputDto input) + public virtual async Task> GetListAsync(GetPagesInputDto input) { - var page = await CreatePageAsync(input.Title, input.Url, input.Description); - - await PageRepository.InsertAsync(page); + var count = await PageRepository.GetCountAsync(input.Filter); - return ObjectMapper.Map(page); + var pages = await PageRepository.GetListAsync( + input.Filter, + input.MaxResultCount, + input.SkipCount, + input.Sorting + ); + + return new PagedResultDto( + count, + ObjectMapper.Map, List>(pages) + ); } - public virtual async Task CreatePageWithContentAsync(CreatePageWithContentInputDto input) + [Authorize(CmsKitAdminPermissions.Pages.Create)] + public virtual async Task CreateAsync(CreatePageInputDto input) { - var page = await CreatePageAsync(input.Title, input.Url, input.Description); + await CheckPageUrlAsync(input.Url); - await PageRepository.InsertAsync(page); - - var content = new Content( - GuidGenerator.Create(), - nameof(Page), - page.Id.ToString(), - input.Content, - page.TenantId); + var page = new Page(GuidGenerator.Create(), input.Title, input.Url, input.Description, CurrentTenant?.Id); - await ContentRepository.InsertAsync(content); + await PageRepository.InsertAsync(page); return ObjectMapper.Map(page); } - public virtual async Task UpdatePageAsync(Guid id, UpdatePageInputDto input) + [Authorize(CmsKitAdminPermissions.Pages.Update)] + public virtual async Task UpdateAsync(Guid id, UpdatePageInputDto input) { var page = await PageRepository.GetAsync(id); @@ -66,42 +71,21 @@ namespace Volo.CmsKit.Admin.Pages page.Description = input.Description; await PageRepository.UpdateAsync(page); - - return ObjectMapper.Map(page); - } - - public virtual Task DoesUrlExistAsync(CheckUrlInputDto input) - { - return PageRepository.DoesExistAsync(input.Url); - } - - public virtual async Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input) - { - var pageContent = await ContentRepository.GetAsync(nameof(Page), id.ToString()); - pageContent.SetValue(input.Content); - - await ContentRepository.UpdateAsync(pageContent); + return ObjectMapper.Map(page); } + [Authorize(CmsKitAdminPermissions.Pages.Delete)] public virtual async Task DeleteAsync(Guid id) { - await ContentRepository.DeleteAsync(nameof(Page), id.ToString(), CurrentTenant?.Id, CancellationToken.None); - await PageRepository.DeleteAsync(id, cancellationToken: CancellationToken.None); - } - - protected virtual async Task CreatePageAsync(string title, string url, string description) - { - await CheckPageUrlAsync(url); - - return new Page(GuidGenerator.Create(), title, url, description, CurrentTenant?.Id); + await PageRepository.DeleteAsync(id); } protected virtual async Task CheckPageUrlAsync(string url) { - if (await PageRepository.DoesExistAsync(url)) + if (await PageRepository.ExistsAsync(url)) { - throw new UserFriendlyException("Url exist"); + throw new PageUrlAlreadyExistException(url); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/EntityTagAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/EntityTagAdminAppService.cs new file mode 100644 index 0000000000..1ef6a8bdf9 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/EntityTagAdminAppService.cs @@ -0,0 +1,52 @@ +using System; +using System.Threading.Tasks; +using Volo.CmsKit.Admin.Tags; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Admin.Application.Volo.CmsKit.Admin.Tags +{ + public class EntityTagAdminAppService : CmsKitAdminAppServiceBase, IEntityTagAdminAppService + { + protected ITagDefinitionStore _tagDefinitionStore; + protected IEntityTagManager _entityTagManager; + protected ITagManager _tagManager; + + public EntityTagAdminAppService( + ITagDefinitionStore tagDefinitionStore, + IEntityTagManager entityTagManager, + ITagManager tagManager) + { + _tagDefinitionStore = tagDefinitionStore; + _entityTagManager = entityTagManager; + _tagManager = tagManager; + } + + public async Task AddTagToEntityAsync(EntityTagCreateDto input) + { + var definition = await _tagDefinitionStore.GetTagEntityTypeDefinitionsAsync(input.EntityType); + + await CheckPolicyAsync(definition.CreatePolicy); + + var tag = await _tagManager.GetOrAddAsync(input.EntityType, input.TagName, CurrentTenant?.Id); + + await _entityTagManager.AddTagToEntityAsync( + tag.Id, + input.EntityType, + input.EntityId, + CurrentTenant?.Id); + } + + public async Task RemoveTagFromEntityAsync(EntityTagRemoveDto input) + { + var definition = await _tagDefinitionStore.GetTagEntityTypeDefinitionsAsync(input.EntityType); + + await CheckPolicyAsync(definition.DeletePolicy); + + await _entityTagManager.RemoveTagFromEntityAsync( + input.TagId, + input.EntityType, + input.EntityId, + CurrentTenant?.Id); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs index cda45c23de..eccdaf82c0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs @@ -1,12 +1,11 @@ using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Localization; using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; -using Volo.CmsKit.Admin.Tags; using Volo.CmsKit.Permissions; using Volo.CmsKit.Tags; @@ -25,11 +24,15 @@ namespace Volo.CmsKit.Admin.Tags { protected ITagManager TagManager { get; } + protected IStringLocalizerFactory StringLocalizerFactory { get; } + public TagAdminAppService( IRepository repository, - ITagManager tagManager) : base(repository) + ITagManager tagManager, + IStringLocalizerFactory stringLocalizerFactory) : base(repository) { TagManager = tagManager; + StringLocalizerFactory = stringLocalizerFactory; GetListPolicyName = CmsKitAdminPermissions.Tags.Default; GetPolicyName = CmsKitAdminPermissions.Tags.Default; @@ -68,5 +71,17 @@ namespace Volo.CmsKit.Admin.Tags x.Name.ToLower().Contains(input.Filter) || x.EntityType.ToLower().Contains(input.Filter)); } + + public async Task> GetTagDefinitionsAsync() + { + var definitions = await TagManager.GetTagDefinitionsAsync(); + + return definitions + .Select(s => + new TagDefinitionDto( + s.EntityType, + s.DisplayName?.Localize(StringLocalizerFactory) ?? s.EntityType)) + .ToList(); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs index 935606b686..4e3a56a8e2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs @@ -48,7 +48,7 @@ namespace Volo.CmsKit.Admin.Contents [HttpGet] [Authorize(CmsKitAdminPermissions.Contents.Default)] - public Task> GetListAsync(ContentGetListInput input) + public Task> GetListAsync(ContentGetListInput input) { return ContentAdminAppService.GetListAsync(input); } @@ -59,5 +59,13 @@ namespace Volo.CmsKit.Admin.Contents { return ContentAdminAppService.UpdateAsync(id, input); } + + [HttpGet] + [Route("{entityType}/{entityId}")] + [Authorize(CmsKitAdminPermissions.Contents.Default)] + public Task GetAsync(string entityType, string entityId) + { + return ContentAdminAppService.GetAsync(entityType, entityId); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs deleted file mode 100644 index 4e37848e37..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Page/PageAdminController.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp; -using Volo.CmsKit.Admin.Pages; - -namespace Volo.CmsKit.Admin.Page -{ - [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] - [Area("cms-kit")] - [Route("api/cms-kit-admin/pages")] - public class PageAdminController : CmsKitAdminController, IPageAdminAppService - { - protected readonly IPageAdminAppService PageAdminAppService; - - public PageAdminController(IPageAdminAppService pageAdminAppService) - { - PageAdminAppService = pageAdminAppService; - } - - [HttpGet] - [Route("{id}")] - public virtual Task GetAsync(Guid id) - { - return PageAdminAppService.GetAsync(id); - } - - [HttpPost] - [Route("create")] - public virtual Task CreatePageAsync(CreatePageInputDto input) - { - return PageAdminAppService.CreatePageAsync(input); - } - - [HttpPost] - [Route("create-with-content")] - public virtual Task CreatePageWithContentAsync(CreatePageWithContentInputDto input) - { - return PageAdminAppService.CreatePageWithContentAsync(input); - } - - [HttpPut] - [Route("{id}")] - public virtual Task UpdatePageAsync(Guid id, UpdatePageInputDto input) - { - return PageAdminAppService.UpdatePageAsync(id, input); - } - - [HttpPost] - [Route("does-url-exist")] - public virtual Task DoesUrlExistAsync(CheckUrlInputDto input) - { - return PageAdminAppService.DoesUrlExistAsync(input); - } - - [HttpPut] - [Route("update-content/{id}")] - public virtual Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input) - { - return PageAdminAppService.UpdatePageContentAsync(id, input); - } - - [HttpDelete] - [Route("{id}")] - public virtual Task DeleteAsync(Guid id) - { - return PageAdminAppService.DeleteAsync(id); - } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs new file mode 100644 index 0000000000..810f09330f --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Pages/PageAdminController.cs @@ -0,0 +1,63 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Permissions; + +namespace Volo.CmsKit.Admin.Pages +{ + [RequiresGlobalFeature(typeof(PagesFeature))] + [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Area("cms-kit")] + [Authorize(CmsKitAdminPermissions.Pages.Default)] + [Route("api/cms-kit-admin/pages")] + public class PageAdminController : CmsKitAdminController, IPageAdminAppService + { + protected readonly IPageAdminAppService PageAdminAppService; + + public PageAdminController(IPageAdminAppService pageAdminAppService) + { + PageAdminAppService = pageAdminAppService; + } + + [HttpGet] + [Route("{id}")] + public virtual Task GetAsync(Guid id) + { + return PageAdminAppService.GetAsync(id); + } + + [HttpGet] + public virtual Task> GetListAsync(GetPagesInputDto input) + { + return PageAdminAppService.GetListAsync(input); + } + + [HttpPost] + [Authorize(CmsKitAdminPermissions.Pages.Create)] + public virtual Task CreateAsync(CreatePageInputDto input) + { + return PageAdminAppService.CreateAsync(input); + } + + [HttpPut] + [Authorize(CmsKitAdminPermissions.Pages.Update)] + [Route("{id}")] + public virtual Task UpdateAsync(Guid id, UpdatePageInputDto input) + { + return PageAdminAppService.UpdateAsync(id, input); + } + + [HttpDelete] + [Authorize(CmsKitAdminPermissions.Pages.Delete)] + [Route("{id}")] + public virtual Task DeleteAsync(Guid id) + { + return PageAdminAppService.DeleteAsync(id); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs index cc755fa63f..4655c60bd6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Tags/TagAdminController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System; +using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Dtos; @@ -60,5 +61,12 @@ namespace Volo.CmsKit.Admin.Tags { return TagAdminAppService.UpdateAsync(id, input); } + + [HttpGet] + [Route("tag-definitions")] + public Task> GetTagDefinitionsAsync() + { + return TagAdminAppService.GetTagDefinitionsAsync(); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs index 4b57a5a52e..35cbad6374 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs @@ -2,7 +2,17 @@ { public static class CmsKitErrorCodes { - public const string TagAlreadyExist = "CmsKit:0001"; + public static class Tags + { + public const string TagAlreadyExist = "CmsKit:Tag:0001"; + public const string EntityNotTaggable = "CmsKit:Tag:0002"; + } + public const string ContentAlreadyExist = "CmsKit:0002"; + + public static class Pages + { + public const string UrlAlreadyExist = "CmsKit:Page:0001"; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 8ad45af0ff..00eccab1be 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -2,6 +2,7 @@ "culture": "en", "texts": { "CmsKit:0002": "Content already exists!", + "CmsKit:0003": "The entity {0} is not taggable.", "CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display.", "Comments": "Comments", "Delete": "Delete", @@ -17,9 +18,13 @@ "Permission:Contents.Delete": "Delete Content", "Permission:Contents.Update": "Update Content", "Permission:TagManagement": "Tag Management", - "Permission:TagManagement.Create": "Create Tag", - "Permission:TagManagement.Delete": "Delete Tag", - "Permission:TagManagement.Update": "Update Tag", + "Permission:TagManagement.Create": "Create", + "Permission:TagManagement.Delete": "Delete", + "Permission:TagManagement.Update": "Update", + "Permission:PageManagement": "Page Management", + "Permission:PageManagement:Create": "Create", + "Permission:PageManagement:Delete": "Delete", + "Permission:PageManagement:Update": "Update", "PickYourReaction": "Pick your reaction", "RatingUndoMessage": "Your rating will be undo.", "Reply": "Reply", @@ -30,6 +35,7 @@ "Undo": "Undo", "Update": "Update", "YourComment": "Your comment", - "YourReply": "Your reply" + "YourReply": "Your reply", + "CmsKit:Page:0001": "The given url ({0}) already exists." } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/nl.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/nl.json new file mode 100644 index 0000000000..164ffd9138 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/nl.json @@ -0,0 +1,35 @@ +{ + "culture": "nl", + "texts": { + "CmsKit:0002": "Inhoud bestaat al!", + "CommentAuthorizationExceptionMessage": "Die opmerkingen zijn niet toegestaan voor openbare vertoning.", + "Comments": "Opmerkingen", + "Delete": "Verwijderen", + "Edit": "Bewerken", + "LoginToAddComment": "Log in om een opmerking toe te voegen", + "LoginToRate": "Log in om te beoordelen", + "LoginToReply": "Log in om te antwoorden", + "Menu:CMS": "CMS", + "MessageDeletionConfirmationMessage": "Deze opmerking wordt volledig verwijderd.", + "Permission:CmsKit": "CMS-Kit", + "Permission:Contents": "Inhoud beheer", + "Permission:Contents.Create": "Creëer inhoud", + "Permission:Contents.Delete": "Inhoud verwijderen", + "Permission:Contents.Update": "Bewerk inhoud", + "Permission:TagManagement": "Tagbeheer", + "Permission:TagManagement.Create": "Tag Creëer", + "Permission:TagManagement.Delete": "Tag verwijderen", + "Permission:TagManagement.Update": "Tag bewerken", + "PickYourReaction": "Kies uw reactie", + "RatingUndoMessage": "Uw beoordeling wordt ongedaan gemaakt.", + "Reply": "Beantwoorden", + "Send": "verzenden", + "Star": "Star", + "TagDeletionConfirmationMessage": "Weet u zeker dat u de tag '{0}' wilt verwijderen?", + "Tags": "Tags", + "Undo": "Ongedaan maken", + "Update": "Bijwerken", + "YourComment": "Jouw opmerking", + "YourReply": "Uw antwoord" + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index c081b86fc7..1ebb0c126b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -2,6 +2,7 @@ "culture": "tr", "texts": { "CmsKit:0002": "İçerik zaten mevcut!", + "CmsKit:0003": "{0} ögesi etiketlenebilir değil.", "CommentAuthorizationExceptionMessage": "Bu yorumları görebilmek için yetki gerekir.", "Comments": "Yorumlar", "Delete": "Sil", @@ -30,6 +31,7 @@ "Undo": "Geri al", "Update": "Güncelle", "YourComment": "Yorumunuz", - "YourReply": "Cevabınız" + "YourReply": "Cevabınız", + "CmsKit:Page:0001": "Girilen url ({0}) kullanımdadır." } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs index 105566c2bd..dcafb6a466 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs @@ -2,10 +2,10 @@ { public class PageConsts { - public static int MaxTitleLength = 256; + public static int MaxTitleLength { get; set; } = 256; + + public static int MaxUrlLength { get; set; } = 256; - public static int MaxUrlLength = 256; - - public static int MaxDescriptionLength = 515; + public static int MaxDescriptionLength { get; set; } = 512; } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs index b1937dd6e0..a60cb0d521 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitDomainModule.cs @@ -1,7 +1,14 @@ -using Volo.Abp.Domain; +using Microsoft.Extensions.Options; +using Volo.Abp.Domain; +using Volo.Abp.GlobalFeatures; +using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.Users; +using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Localization; +using Volo.CmsKit.Pages; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; namespace Volo.CmsKit { @@ -28,7 +35,18 @@ namespace Volo.CmsKit options.Reactions.AddOrReplace(StandardReactions.HeartBroken); options.Reactions.AddOrReplace(StandardReactions.Rocket); options.Reactions.AddOrReplace(StandardReactions.Pray); + }); + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + // TODO: Configure TagEntityTypes here... + } + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); } } -} +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitOptions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitOptions.cs index cc69f715ce..8075895184 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitOptions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/CmsKitOptions.cs @@ -1,16 +1,12 @@ using JetBrains.Annotations; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; namespace Volo.CmsKit { public class CmsKitOptions { [NotNull] - public ReactionDefinitionDictionary Reactions { get; } - - public CmsKitOptions() - { - Reactions = new ReactionDefinitionDictionary(); - } + public ReactionDefinitionDictionary Reactions { get; } = new ReactionDefinitionDictionary(); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs index 95c09474aa..931618f774 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -6,10 +8,19 @@ namespace Volo.CmsKit.Pages { public interface IPageRepository : IBasicRepository { - Task GetByUrlAsync(string url); + Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default); - Task FindByUrlAsync(string url); + Task> GetListAsync( + string filter = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string sorting = null, + CancellationToken cancellationToken = default); + + Task GetByUrlAsync(string url, CancellationToken cancellationToken = default); - Task DoesExistAsync(string url); + Task FindByUrlAsync(string url, CancellationToken cancellationToken = default); + + Task ExistsAsync(string url, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs new file mode 100644 index 0000000000..142d03c441 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/PageUrlAlreadyExistException.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.Serialization; +using JetBrains.Annotations; +using Volo.Abp; + +namespace Volo.CmsKit.Pages +{ + [Serializable] + public class PageUrlAlreadyExistException : BusinessException + { + public PageUrlAlreadyExistException([NotNull] string url) + { + Code = CmsKitErrorCodes.Pages.UrlAlreadyExist; + WithData(nameof(Page.Url), url); + } + + public PageUrlAlreadyExistException(SerializationInfo serializationInfo, StreamingContext context) + : base(serializationInfo, context) + { + + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs new file mode 100644 index 0000000000..6105beab97 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs @@ -0,0 +1,32 @@ +using JetBrains.Annotations; +using Volo.Abp; +using Volo.Abp.Localization; + +namespace Volo.CmsKit.Domain.Volo.CmsKit +{ + public abstract class PolicySpecifiedDefinition + { + protected PolicySpecifiedDefinition() + { + } + + public PolicySpecifiedDefinition( + [CanBeNull] string createPolicy = null, + [CanBeNull] string updatePolicy = null, + [CanBeNull] string deletePolicy = null) + { + CreatePolicy = createPolicy; + DeletePolicy = deletePolicy; + UpdatePolicy = updatePolicy; + } + + [CanBeNull] + public virtual string CreatePolicy { get; set; } + + [CanBeNull] + public virtual string UpdatePolicy { get; set; } + + [CanBeNull] + public virtual string DeletePolicy { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/CmsKitTagOptions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/CmsKitTagOptions.cs new file mode 100644 index 0000000000..8f9b073d6b --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/CmsKitTagOptions.cs @@ -0,0 +1,11 @@ +using JetBrains.Annotations; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Tags +{ + public class CmsKitTagOptions + { + [NotNull] + public TagEntityTypeDefinitionDictionary EntityTypes { get; } = new TagEntityTypeDefinitionDictionary(); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/DefaultTagDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/DefaultTagDefinitionStore.cs new file mode 100644 index 0000000000..5a79bea25a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/DefaultTagDefinitionStore.cs @@ -0,0 +1,58 @@ +using JetBrains.Annotations; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.DependencyInjection; + +namespace Volo.CmsKit.Tags +{ + public class DefaultTagDefinitionStore : ITagDefinitionStore, ITransientDependency + { + private readonly CmsKitTagOptions options; + + public DefaultTagDefinitionStore(IOptions options) + { + this.options = options.Value; + } + + /// + /// Gets single by entityType. + /// + /// EntityType to get definition. + /// Thrown when EntityType is not configured as taggable. + /// More than one element satisfies the condition in predicate. + public virtual Task GetTagEntityTypeDefinitionsAsync([NotNull] string entityType) + { + Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); + + var result = options.EntityTypes.SingleOrDefault(x => x.EntityType == entityType) ?? throw new EntityNotTaggableException(entityType); + + return Task.FromResult(result); + } + + /// + /// Gets all defined elements. + /// + public virtual Task> GetTagEntityTypeDefinitionListAsync() + { + return Task.FromResult(options.EntityTypes.ToList()); + } + + /// + /// Checks if EntityType defined as taggable. + /// + /// EntityType to check. + /// More than one element satisfies the condition in predicate." + public virtual Task IsDefinedAsync([NotNull] string entityType) + { + Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); + + var definition = options.EntityTypes.SingleOrDefault(x => x.EntityType == entityType); + + return Task.FromResult(definition != null); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityNotTaggableException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityNotTaggableException.cs new file mode 100644 index 0000000000..8787fb16a5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityNotTaggableException.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Logging; +using System; +using Volo.Abp; + +namespace Volo.CmsKit.Tags +{ + [Serializable] + public class EntityNotTaggableException : BusinessException + { + public EntityNotTaggableException( + string code = null, + string message = null, + string details = null, + Exception innerException = null, + LogLevel logLevel = LogLevel.Warning) + : base(code, message, details, innerException, logLevel) + { + } + + public EntityNotTaggableException(string entityType) + { + Code = CmsKitErrorCodes.Tags.EntityNotTaggable; + WithData(nameof(Tag.EntityType), entityType); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs index 5d27e8b15f..c49a9661ef 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs @@ -16,7 +16,7 @@ namespace Volo.CmsKit.Tags { } - public EntityTag(Guid tagId, string entityId, Guid? tenantId = null) + internal EntityTag(Guid tagId, string entityId, Guid? tenantId = null) { TagId = tagId; EntityId = entityId; @@ -27,6 +27,5 @@ namespace Volo.CmsKit.Tags { return new object[] { TagId, EntityId }; } - } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTagManager.cs new file mode 100644 index 0000000000..0de6328775 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTagManager.cs @@ -0,0 +1,52 @@ +using JetBrains.Annotations; +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Tags +{ + public class EntityTagManager : DomainService, IEntityTagManager + { + protected readonly IEntityTagRepository _entityTagRepository; + protected readonly ITagDefinitionStore _tagDefinitionStore; + + public EntityTagManager( + IEntityTagRepository entityTagRepository, + ITagDefinitionStore tagDefinitionStore) + { + _entityTagRepository = entityTagRepository; + _tagDefinitionStore = tagDefinitionStore; + } + + public async Task AddTagToEntityAsync( + [NotNull] Guid tagId, + [NotNull] string entityType, + [NotNull] string entityId, + [CanBeNull] Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + if (!await _tagDefinitionStore.IsDefinedAsync(entityType)) + { + throw new EntityNotTaggableException(entityType); + } + + var entityTag = new EntityTag(tagId, entityId, tenantId); + + return await _entityTagRepository.InsertAsync(entityTag, cancellationToken: cancellationToken); + } + + public async Task RemoveTagFromEntityAsync( + [NotNull] Guid tagId, + [NotNull] string entityType, + [NotNull] string entityId, + [CanBeNull] Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + var entityTag = await _entityTagRepository.FindAsync(tagId, entityId, tenantId, cancellationToken); + + await _entityTagRepository.DeleteAsync(entityTag); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagManager.cs new file mode 100644 index 0000000000..704568619a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagManager.cs @@ -0,0 +1,24 @@ +using JetBrains.Annotations; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Volo.CmsKit.Tags +{ + public interface IEntityTagManager + { + Task AddTagToEntityAsync( + [NotNull] Guid tagId, + [NotNull] string entityType, + [NotNull] string entityId, + [CanBeNull] Guid? tenantId = null, + CancellationToken cancellationToken = default); + + Task RemoveTagFromEntityAsync( + [NotNull] Guid tagId, + [NotNull] string entityType, + [NotNull] string entityId, + [CanBeNull] Guid? tenantId = null, + CancellationToken cancellationToken = default); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs index 6ec0fd4b44..f2ed160671 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs @@ -1,9 +1,17 @@ -using Volo.Abp.Domain.Repositories; +using JetBrains.Annotations; +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; namespace Volo.CmsKit.Tags { public interface IEntityTagRepository : IBasicRepository { - + Task FindAsync( + [NotNull] Guid tagId, + [NotNull] string entityId, + [CanBeNull] Guid? tenantId, + CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagDefinitionStore.cs new file mode 100644 index 0000000000..1dd8ae2bc3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagDefinitionStore.cs @@ -0,0 +1,15 @@ +using JetBrains.Annotations; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Volo.CmsKit.Tags +{ + public interface ITagDefinitionStore + { + Task> GetTagEntityTypeDefinitionListAsync(); + + Task GetTagEntityTypeDefinitionsAsync([NotNull] string entityType); + + Task IsDefinedAsync([NotNull] string entityType); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs index 943fd6af00..4b9cef5fb8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs @@ -1,5 +1,6 @@ using JetBrains.Annotations; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Services; @@ -26,5 +27,7 @@ namespace Volo.CmsKit.Tags [NotNull] string name, Guid? tenantId = null, CancellationToken cancellationToken = default); + + Task> GetTagDefinitionsAsync(CancellationToken cancellationToken = default); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagAlreadyExistException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagAlreadyExistException.cs index 6cae0dde92..2d87668043 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagAlreadyExistException.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagAlreadyExistException.cs @@ -9,7 +9,7 @@ namespace Volo.CmsKit.Tags { public TagAlreadyExistException([NotNull] string entityType, [NotNull] string name) { - Code = CmsKitErrorCodes.TagAlreadyExist; + Code = CmsKitErrorCodes.Tags.TagAlreadyExist; WithData(nameof(Tag.EntityType), entityType); WithData(nameof(Tag.Name), name); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefinitionDictionary.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefinitionDictionary.cs new file mode 100644 index 0000000000..888ad15577 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefinitionDictionary.cs @@ -0,0 +1,11 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; +using Volo.Abp.Localization; + +namespace Volo.CmsKit.Tags +{ + public class TagEntityTypeDefinitionDictionary : List + { + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs new file mode 100644 index 0000000000..463c78d4a4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs @@ -0,0 +1,37 @@ +using JetBrains.Annotations; +using System; +using Volo.Abp; +using Volo.Abp.Localization; +using Volo.CmsKit.Domain.Volo.CmsKit; + +namespace Volo.CmsKit.Tags +{ + public class TagEntityTypeDefiniton : PolicySpecifiedDefinition, IEquatable + { + public string EntityType { get; } + + [CanBeNull] + public virtual ILocalizableString DisplayName { get; } + + protected TagEntityTypeDefiniton() + { + } + + public TagEntityTypeDefiniton( + [NotNull] string entityType, + [CanBeNull] ILocalizableString displayName = null, + [CanBeNull] string createPolicy = null, + [CanBeNull] string updatePolicy = null, + [CanBeNull] string deletePolicy = null) : base(createPolicy, updatePolicy, deletePolicy) + { + EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); + + DisplayName = displayName; + } + + public bool Equals(TagEntityTypeDefiniton other) + { + return EntityType == other.EntityType; + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs index 042b4e27a9..77d50e9949 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs @@ -1,5 +1,8 @@ using JetBrains.Annotations; +using Microsoft.Extensions.Options; using System; +using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Volo.Abp; @@ -10,10 +13,14 @@ namespace Volo.CmsKit.Tags public class TagManager : DomainService, ITagManager { private readonly ITagRepository _tagRepository; + private readonly ITagDefinitionStore _tagDefinitionStore; - public TagManager(ITagRepository tagRepository) + public TagManager( + ITagRepository tagRepository, + ITagDefinitionStore tagDefinitionStore) { _tagRepository = tagRepository; + _tagDefinitionStore = tagDefinitionStore; } public async Task GetOrAddAsync( @@ -44,6 +51,11 @@ namespace Volo.CmsKit.Tags throw new TagAlreadyExistException(entityType, name); } + if (!await _tagDefinitionStore.IsDefinedAsync(entityType)) + { + throw new EntityNotTaggableException(entityType); + } + return await _tagRepository.InsertAsync( new Tag( id, @@ -70,5 +82,10 @@ namespace Volo.CmsKit.Tags return await _tagRepository.UpdateAsync(entity, cancellationToken: cancellationToken); } + + public Task> GetTagDefinitionsAsync(CancellationToken cancellationToken = default) + { + return _tagDefinitionStore.GetTagEntityTypeDefinitionListAsync(); + } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 2cc5e8a52a..60cf1332f8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -62,6 +62,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new {x.TenantId, x.CreatorId, x.EntityType, x.EntityId, x.ReactionName}); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -80,6 +84,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new {x.TenantId, x.RepliedCommentId}); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -96,6 +104,10 @@ namespace Volo.CmsKit.EntityFrameworkCore r.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId, x.CreatorId }); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -112,6 +124,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId }); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -145,50 +161,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new { x.TenantId, x.EntityId, x.TagId }); }); } - - if (GlobalFeatureManager.Instance.IsEnabled()) + else { - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "Pages", options.Schema); - - b.ConfigureByConvention(); - - b.Property(x => x.Title).IsRequired().HasMaxLength(PageConsts.MaxTitleLength); - b.Property(x => x.Url).IsRequired().HasMaxLength(PageConsts.MaxUrlLength); - b.Property(x => x.Description).HasMaxLength(PageConsts.MaxDescriptionLength); - - b.HasIndex(x => new { x.TenantId, x.Url }); - }); - } - - if (GlobalFeatureManager.Instance.IsEnabled()) - { - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "Tags", options.Schema); - - b.ConfigureByConvention(); - - b.Property(x => x.EntityType).IsRequired().HasMaxLength(TagConsts.MaxEntityTypeLength); - b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength); - - b.HasIndex(x => new {x.TenantId, x.Name}); - }); - - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "EntityTags", options.Schema); - - b.ConfigureByConvention(); - - b.HasKey(x => new {x.EntityId, x.TagId}); - - b.Property(x => x.EntityId).IsRequired(); - b.Property(x => x.TagId).IsRequired(); - - b.HasIndex(x => new {x.TenantId, x.EntityId, x.TagId}); - }); + builder.Ignore(); + builder.Ignore(); } if (GlobalFeatureManager.Instance.IsEnabled()) @@ -206,6 +182,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new {x.TenantId, x.Url}); }); } + else + { + builder.Ignore(); + } } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs index 93a7df00d2..2fc6d92c52 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -1,4 +1,8 @@ using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -13,19 +17,44 @@ namespace Volo.CmsKit.Pages { } - public Task GetByUrlAsync(string url) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { - return GetAsync(x => x.Url == url); + return await (await GetDbSetAsync()).WhereIf( + !filter.IsNullOrWhiteSpace(), + x => + x.Title.Contains(filter) + ).CountAsync(GetCancellationToken(cancellationToken)); } - public Task FindByUrlAsync(string url) + public virtual async Task> GetListAsync( + string filter = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string sorting = null, + CancellationToken cancellationToken = default) { - return FindAsync(x => x.Url == url); + return await (await GetDbSetAsync()).WhereIf( + !filter.IsNullOrWhiteSpace(), + x => + x.Title.Contains(filter)) + .OrderBy(sorting ?? nameof(Page.Title)) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task DoesExistAsync(string url) + public virtual Task GetByUrlAsync(string url, CancellationToken cancellationToken = default) { - return await (await GetDbSetAsync()).AnyAsync(x => x.Url == url); + return GetAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); + } + + public virtual Task FindByUrlAsync(string url, CancellationToken cancellationToken = default) + { + return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); + } + + public virtual async Task ExistsAsync(string url, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs index cca61b802b..a82fb7005a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs @@ -1,4 +1,8 @@ -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using JetBrains.Annotations; +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.EntityFrameworkCore; @@ -9,5 +13,18 @@ namespace Volo.CmsKit.Tags public EfCoreEntityTagRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task FindAsync( + [NotNull] Guid tagId, + [NotNull] string entityId, + [CanBeNull] Guid? tenantId, + CancellationToken cancellationToken = default) + { + return base.FindAsync(x => + x.TagId == tagId && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs index f42b0890e7..1068c352d5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs @@ -54,7 +54,7 @@ namespace Volo.CmsKit.MongoDB.Contents public async Task ExistsAsync([NotNull] string entityType, [NotNull] string entityId, Guid? tenantId = null, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).AnyAsync(x => + return await (await GetMongoQueryableAsync(cancellationToken)).AnyAsync(x => x.EntityType == entityType && x.EntityId == entityId && x.TenantId == tenantId, diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs index 8537500c96..af72da56c8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs @@ -1,5 +1,10 @@ using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; +using MongoDB.Driver; using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; @@ -13,19 +18,52 @@ namespace Volo.CmsKit.MongoDB.Pages { } - public Task GetByUrlAsync(string url) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { - return GetAsync(x => x.Url == url); + var cancellation = GetCancellationToken(cancellationToken); + + return await (await GetMongoQueryableAsync(cancellation)) + .WhereIf>( + !filter.IsNullOrWhiteSpace(), + u => + u.Title.Contains(filter) + ).CountAsync(cancellation); } - public Task FindByUrlAsync(string url) + public virtual async Task> GetListAsync( + string filter = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string sorting = null, + CancellationToken cancellationToken = default) { - return FindAsync(x => x.Url == url); + var cancellation = GetCancellationToken(cancellationToken); + + return await (await GetMongoQueryableAsync(cancellation)) + .WhereIf>( + !filter.IsNullOrWhiteSpace(), + u => + u.Title.Contains(filter) + ) + .OrderBy(sorting ?? nameof(Page.Title)) + .As>() + .PageBy>(skipCount, maxResultCount) + .ToListAsync(cancellation); } - public async Task DoesExistAsync(string url) + public virtual Task GetByUrlAsync(string url, CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()).AnyAsync(x => x.Url == url); + return GetAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); + } + + public virtual Task FindByUrlAsync(string url, CancellationToken cancellationToken = default) + { + return FindAsync(x => x.Url == url, cancellationToken: GetCancellationToken(cancellationToken)); + } + + public virtual async Task ExistsAsync(string url, CancellationToken cancellationToken = default) + { + return await (await GetMongoQueryableAsync(cancellationToken)).AnyAsync(x => x.Url == url, GetCancellationToken(cancellationToken)); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs index 5ac1a4b69c..3f9e1814fc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs @@ -1,4 +1,8 @@ -using Volo.Abp.Domain.Repositories.MongoDB; +using JetBrains.Annotations; +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; using Volo.CmsKit.Tags; @@ -9,5 +13,18 @@ namespace Volo.CmsKit.MongoDB.Tags public MongoEntityTagRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task FindAsync( + [NotNull] Guid tagId, + [NotNull] string entityId, + [CanBeNull] Guid? tenantId, + CancellationToken cancellationToken = default) + { + return base.FindAsync(x => + x.TagId == tagId && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPageAppService.cs index d8ea8f1751..7363d32a3c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPageAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/IPageAppService.cs @@ -5,6 +5,6 @@ namespace Volo.CmsKit.Public.Pages { public interface IPageAppService { - Task GetByUrlAsync([NotNull] string url); + Task FindByUrlAsync([NotNull] string url); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs index 49798d5202..ab8ee9ee80 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs @@ -8,7 +8,5 @@ namespace Volo.CmsKit.Public.Pages public string Title { get; set; } public string Url { get; set; } - - public string Description { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PageAppService.cs index 38f4406cab..1e1d63bf71 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PageAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Pages/PageAppService.cs @@ -12,9 +12,14 @@ namespace Volo.CmsKit.Public.Pages PageRepository = pageRepository; } - public virtual async Task GetByUrlAsync(string url) + public virtual async Task FindByUrlAsync(string url) { - var page = await PageRepository.GetByUrlAsync(url); + var page = await PageRepository.FindByUrlAsync(url); + + if (page == null) + { + return null; + } return ObjectMapper.Map(page); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs index 45dda25ab5..a9c6cd70e4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Pages/PagesPublicController.cs @@ -7,7 +7,7 @@ namespace Volo.CmsKit.Public.Pages [RemoteService(Name = CmsKitPublicRemoteServiceConsts.RemoteServiceName)] [Area("cms-kit")] [Route("api/cms-kit-public/comments")] - public class PagesPublicController + public class PagesPublicController : IPageAppService { protected readonly IPageAppService PageAppService; @@ -18,9 +18,9 @@ namespace Volo.CmsKit.Public.Pages [HttpGet] [Route("url/{url}")] - public Task GetByUrlAsync(string url) + public Task FindByUrlAsync(string url) { - return PageAppService.GetByUrlAsync(url); + return PageAppService.FindByUrlAsync(url); } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs index 0149722671..8cb5644256 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs @@ -1,10 +1,13 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Linq; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AutoMapper; +using Volo.Abp.GlobalFeatures; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; +using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Localization; using Volo.CmsKit.Public.Web.Menus; using Volo.CmsKit.Web; @@ -56,7 +59,11 @@ namespace Volo.CmsKit.Public.Web Configure(options => { - //... + if (GlobalFeatureManager.Instance.IsEnabled()) + { + // TODO: Work on this route logic. Blocks some routes with this logic. + options.Conventions.AddPageRoute("/CmsKit/Pages/Index", "/{*pageUrl}"); + } }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml index 47e73b8b19..73c7637b01 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml @@ -1,4 +1,4 @@ -@page "{pageUrl}" +@page "{*pageUrl}" @using Microsoft.AspNetCore.Mvc.Localization @using Volo.CmsKit.Localization @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages @@ -9,6 +9,5 @@ new { pageId = Model.Page.Id, - title = Model.Page.Title, - description = Model.Page.Description + title = Model.Page.Title }) \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml.cs index 1d5dca0940..5443608845 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml.cs @@ -19,9 +19,16 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Pages PageAppService = pageAppService; } - public async Task OnGetAsync() + public async Task OnGetAsync() { - Page = await PageAppService.GetByUrlAsync(PageUrl); + Page = await PageAppService.FindByUrlAsync(PageUrl); + + if (Page == null) + { + return NotFound(); + } + + return Page(); } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs index 129bff61cf..6a2a4e5a13 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Domain.Entities; using Volo.CmsKit.Public.Contents; using Volo.CmsKit.Web.Contents; @@ -25,18 +26,26 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents string entityType, string entityId) { - var content = await contentAppService.GetAsync(new GetContentInput + var content = string.Empty; + + try { - EntityId = entityId, - EntityType = entityType - }); + var contentDto = await contentAppService.GetAsync(new GetContentInput + { + EntityId = entityId, + EntityType = entityType + }); + + content = contentDto.Value; + } + catch (EntityNotFoundException e) + { + // ContentDto can be null, we will render empty content. + } var viewModel = new ContentViewModel { - EntityId = entityId, - EntityType = entityType, - ContentId = content.Id, - Rendered = await contentRenderer.RenderAsync(content.Value) + Value = await contentRenderer.RenderAsync(content) }; return View("~/Pages/CmsKit/Shared/Components/Contents/Default.cshtml", viewModel); @@ -44,12 +53,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents public class ContentViewModel { - public Guid ContentId { get; set; } - public string EntityType { get; set; } - - public string EntityId { get; set; } - - public string Rendered { get; set; } + public string Value { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml index 29f7bfa6a3..0f1ddedfe5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml @@ -1,3 +1,3 @@ @model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents.ContentViewComponent.ContentViewModel -@Html.Raw(Model.Rendered) +@Html.Raw(Model.Value) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml index 1f90458ee7..e10fa0754a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml @@ -1,21 +1,22 @@ @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap @using Microsoft.AspNetCore.Mvc.RazorPages +@using Volo.Abp.AspNetCore.Mvc.UI.Layout @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents @model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages.PageViewModel +@inject IPageLayout PageLayout + +@{ + PageLayout.Content.Title = Model.Title; +} - -

    - @Model.Title -

    -
    - -

    - @Model.Description -

    - - @await Component.InvokeAsync(typeof(ContentViewComponent), new { entityType = nameof(Page), entityId = Model.Id.ToString() }) + @await Component.InvokeAsync(typeof(ContentViewComponent), + new + { + entityType = nameof(Page), + entityId = Model.Id.ToString() + })
    diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs index 450b7ad97e..c3e02b1f90 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs @@ -21,8 +21,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages var model = new PageViewModel { Id = pageId, - Title = title, - Description = description + Title = title }; return View("~/Pages/CmsKit/Shared/Components/Pages/Default.cshtml", model); @@ -34,7 +33,5 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages public Guid Id { get; set; } public string Title { get; set; } - - public string Description { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs index d8c5d62a61..5c7e5969f1 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs @@ -38,6 +38,7 @@ namespace Volo.CmsKit.Contents result.ShouldNotBeNull(); result.Items.ShouldNotBeEmpty(); result.Items.Count.ShouldBe(4); + result.Items.All(x => x.ShouldBeOfType() != null); } [Fact] @@ -46,6 +47,8 @@ namespace Volo.CmsKit.Contents var result = await _service.GetAsync(_data.Content_1_Id); result.ShouldNotBeNull(); + result.ShouldBeOfType(); + result.ShouldNotBeNull(result.Value); } [Fact] @@ -125,5 +128,15 @@ namespace Volo.CmsKit.Contents await Should.NotThrowAsync(async () => await _service.DeleteAsync(_data.Content_2_Id)); } + + [Fact] + public async Task ShouldGetByEntityAsync() + { + var entity = await _service.GetAsync(_data.Content_1_EntityType, _data.Content_1_EntityId); + + entity.ShouldNotBeNull(); + entity.EntityId.ShouldBe(_data.Content_1_EntityId); + entity.EntityType.ShouldBe(_data.Content_1_EntityType); + } } } diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs index 59fcc8c8bd..7fa0d934fb 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using Shouldly; using Volo.Abp.Uow; @@ -14,16 +15,41 @@ namespace Volo.CmsKit.Pages private readonly IPageAdminAppService _pageAdminAppService; private readonly IPageRepository _pageRepository; - private readonly IContentRepository _contentRepository; public PageAdminAppService_Tests() { _data = GetRequiredService(); _pageAdminAppService = GetRequiredService(); _pageRepository = GetRequiredService(); - _contentRepository = GetRequiredService(); } + [Fact] + public async Task ShouldGetListAsync() + { + var input = new GetPagesInputDto(); + + var pages = await _pageAdminAppService.GetListAsync(input); + + pages.TotalCount.ShouldBe(2); + pages.Items.Count.ShouldBe(2); + + input.MaxResultCount = 1; + + var pages2 = await _pageAdminAppService.GetListAsync(input); + + pages2.TotalCount.ShouldBe(2); + pages2.Items.Count.ShouldBe(1); + pages2.Items.First().Title.ShouldBe(_data.Page_1_Title); + + input.SkipCount = 1; + + var pages3 = await _pageAdminAppService.GetListAsync(input); + + pages3.TotalCount.ShouldBe(2); + pages3.Items.Count.ShouldBe(1); + pages3.Items.First().Title.ShouldBe(_data.Page_2_Title); + } + [Fact] public async Task ShouldGetAsync() { @@ -41,7 +67,7 @@ namespace Volo.CmsKit.Pages Url = "test-url" }; - await Should.NotThrowAsync(async () => await _pageAdminAppService.CreatePageAsync(dto)); + await Should.NotThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); var page = await _pageRepository.GetByUrlAsync(dto.Url); @@ -49,7 +75,7 @@ namespace Volo.CmsKit.Pages } [Fact] - public async Task ShouldNotCreateAsync() + public async Task ShouldNotCreateExistUrlAsync() { var dto = new CreatePageInputDto { @@ -57,39 +83,9 @@ namespace Volo.CmsKit.Pages Url = _data.Page_1_Url }; - await Should.ThrowAsync(async () => await _pageAdminAppService.CreatePageAsync(dto)); - } - - [Fact] - public async Task ShouldCreateWithContentAsync() - { - var dto = new CreatePageWithContentInputDto - { - Title = "test", - Url = "test-url", - Content = "my-test-content" - }; - - await Should.NotThrowAsync(async () => await _pageAdminAppService.CreatePageWithContentAsync(dto)); - - var page = await _pageRepository.GetByUrlAsync(dto.Url); - - var content = await _contentRepository.GetAsync(nameof(Page), page.Id.ToString()); + var exception = await Should.ThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); - content.Value.ShouldBe(dto.Content); - } - - [Fact] - public async Task ShouldNotCreateWithContentAsync() - { - var dto = new CreatePageWithContentInputDto - { - Title = "test", - Url = _data.Page_1_Url, - Content = "my-test-content" - }; - - await Should.ThrowAsync(async () => await _pageAdminAppService.CreatePageWithContentAsync(dto)); + exception.Code.ShouldBe(CmsKitErrorCodes.Pages.UrlAlreadyExist); } [Fact] @@ -102,7 +98,7 @@ namespace Volo.CmsKit.Pages Url = _data.Page_1_Url+ "test" }; - await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdatePageAsync(_data.Page_1_Id, dto)); + await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto)); var updatedPage = await _pageRepository.GetAsync(_data.Page_1_Id); @@ -117,7 +113,7 @@ namespace Volo.CmsKit.Pages } [Fact] - public async Task ShouldNotUpdatePageAsync() + public async Task ShouldNotUpdateWithExistUrlAsync() { var dto = new UpdatePageInputDto { @@ -126,58 +122,15 @@ namespace Volo.CmsKit.Pages Url = _data.Page_2_Url }; - await Should.ThrowAsync(async () => await _pageAdminAppService.UpdatePageAsync(_data.Page_1_Id, dto)); + await Should.ThrowAsync(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto)); } - [Fact] - public async Task ShouldBeExistAsync() - { - var dto = new CheckUrlInputDto - { - Url = _data.Page_1_Url - }; - - var doesExist = await _pageAdminAppService.DoesUrlExistAsync(dto); - - doesExist.ShouldBeTrue(); - } - - [Fact] - public async Task ShouldNotBeExistAsync() - { - var dto = new CheckUrlInputDto - { - Url = _data.Page_1_Url+ "+" - }; - - var doesExist = await _pageAdminAppService.DoesUrlExistAsync(dto); - - doesExist.ShouldBeFalse(); - } - - [Fact] - public async Task ShouldUpdateContentAsync() - { - var dto = new UpdatePageContentInputDto - { - Content = "my-new-content" - }; - - await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdatePageContentAsync(_data.Page_1_Id, dto)); - - var content = await _contentRepository.GetAsync(nameof(Page), _data.Page_1_Id.ToString()); - - content.Value.ShouldBe(dto.Content); - } - [Fact] public async Task ShouldDeleteAsync() { await _pageAdminAppService.DeleteAsync(_data.Page_1_Id); await Should.ThrowAsync(async () => await _pageRepository.GetAsync(_data.Page_1_Id)); - - await Should.ThrowAsync(async () => await _contentRepository.GetAsync(nameof(Page), _data.Page_1_Id.ToString())); } } } \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PagePublicAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PagePublicAppService_Tests.cs index 290f02caff..c0943a1279 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PagePublicAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PagePublicAppService_Tests.cs @@ -18,15 +18,20 @@ namespace Volo.CmsKit.Pages } [Fact] - public async Task ShouldGetByUrlAsync() + public async Task ShouldFindByUrlAsync() { - await Should.NotThrowAsync(async () => await _pageAppService.GetByUrlAsync(_data.Page_1_Url)); + var page = await _pageAppService.FindByUrlAsync(_data.Page_1_Url); + + page.ShouldNotBeNull(); + page.Title.ShouldBe(_data.Page_1_Title); } [Fact] public async Task ShouldNotGetByUrlAsync() { - await Should.ThrowAsync(async () => await _pageAppService.GetByUrlAsync("not-exist-url")); + var page = await _pageAppService.FindByUrlAsync("not-exist-url"); + + page.ShouldBeNull(); } } } \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Tags/TagAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Tags/TagAdminAppService_Tests.cs index 4ad0d43468..b2128bb385 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Tags/TagAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Tags/TagAdminAppService_Tests.cs @@ -32,8 +32,8 @@ namespace Volo.CmsKit.Tags { var list = await _tagAdminAppService.CreateAsync(new TagCreateDto { - EntityType = "any_new_type", - Name = "1", + EntityType = _cmsKitTestData.EntityType1, + Name = "My First Tag", }); list.Id.ShouldNotBe(Guid.Empty); diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/CmsKitDomainTestModule.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/CmsKitDomainTestModule.cs index fc41440757..b5af93fc74 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/CmsKitDomainTestModule.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/CmsKitDomainTestModule.cs @@ -12,6 +12,5 @@ namespace Volo.CmsKit )] public class CmsKitDomainTestModule : AbpModule { - } } diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/EntityTagManager_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/EntityTagManager_Tests.cs new file mode 100644 index 0000000000..5a6144733c --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/EntityTagManager_Tests.cs @@ -0,0 +1,60 @@ +using Shouldly; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Guids; +using Xunit; + +namespace Volo.CmsKit.Tags +{ + public class EntityTagManager_Tests : CmsKitDomainTestBase + { + private readonly CmsKitTestData _cmsKitTestData; + private readonly IEntityTagManager _entityTagManager; + private readonly ITagRepository _tagRepository; + private readonly IGuidGenerator _guidGenerator; + + public EntityTagManager_Tests() + { + _cmsKitTestData = GetRequiredService(); + _entityTagManager = GetRequiredService(); + _tagRepository = GetRequiredService(); + _guidGenerator = GetRequiredService(); + } + + [Fact] + public async Task AddTagToEntityAsync_ShouldAdd_WhenEverythingCorrect() + { + var tag = await _tagRepository.InsertAsync(new Tag(_guidGenerator.Create(), _cmsKitTestData.EntityType1, "My Test Tag #1")); + + var entityTag = await _entityTagManager.AddTagToEntityAsync(tag.Id, _cmsKitTestData.EntityType1, _cmsKitTestData.EntityId1); + + entityTag.ShouldNotBeNull(); + } + + [Fact] + public async Task AddTagToEntity_ShouldThrowNotTaggable_WithNotConfiguredEntityType() + { + var entityType = "Not.Configured.EntityType"; + + var exception = Should.Throw(async () => + await _entityTagManager.AddTagToEntityAsync(_cmsKitTestData.TagId_1, entityType, _cmsKitTestData.EntityId1) + ); + + exception.ShouldNotBeNull(); + exception.Data[nameof(Tag.EntityType)].ShouldBe(entityType); + } + + [Fact] + public async Task RemoveTagFromEntityAsync_ShouldRemove_WhenEverythingCorrect() + { + var tagToDelete = (await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.EntityType1, _cmsKitTestData.EntityId1)) + .First(); + + await _entityTagManager.RemoveTagFromEntityAsync(tagToDelete.Id, tagToDelete.EntityType, _cmsKitTestData.EntityId1); + + var tags = await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.EntityType1, _cmsKitTestData.EntityId1); + + tags.ShouldNotContain(x => x.Id == tagToDelete.Id); + } + } +} diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagEntityTypeDefinitionDictionary_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagEntityTypeDefinitionDictionary_Tests.cs new file mode 100644 index 0000000000..a405c27190 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagEntityTypeDefinitionDictionary_Tests.cs @@ -0,0 +1,64 @@ +using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Options; +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Localization; +using Volo.CmsKit.Localization; +using Xunit; + +namespace Volo.CmsKit.Tags +{ + public class TagEntityTypeDefinitionDictionary_Tests : CmsKitDomainTestBase + { + private readonly CmsKitTagOptions cmsKitTagOptions; + + public TagEntityTypeDefinitionDictionary_Tests() + { + var options = GetRequiredService>(); + cmsKitTagOptions = options.Value; + } + + [Fact] + public void ShouldAddEntityTypeProperly_WithOnlyEntityType() + { + cmsKitTagOptions.EntityTypes.Add(new TagEntityTypeDefiniton("My.Entity.Type")); + } + + [Fact] + public void ShouldAddEntityTypeProperly_WithEntityTypeAndDisplayName() + { + cmsKitTagOptions.EntityTypes.Add( + new TagEntityTypeDefiniton( + "My.Entity.Type", + LocalizableString.Create("MyEntity"))); + } + + [Fact] + public void ShouldAddEntityType_WithAllParameters() + { + cmsKitTagOptions.EntityTypes.Add( + new TagEntityTypeDefiniton( + "My.Entity.Type", + LocalizableString.Create("MyEntity"), + "SomeCreatePolicy", + "SomeUpdatePolicy", + "SomeDeletePolicy" + )); + } + + [Fact] + public void ShouldThrowException_WhileAddingExistingType() + { + var expectedCount = cmsKitTagOptions.EntityTypes.Count + 1; + + cmsKitTagOptions.EntityTypes.Add(new TagEntityTypeDefiniton("My.Entity.Type")); + cmsKitTagOptions.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton("My.Entity.Type")); + + cmsKitTagOptions.EntityTypes.Count.ShouldBe(expectedCount); + } + } +} diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs index aa31b015cc..7d7416c8ce 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs @@ -22,7 +22,7 @@ namespace Volo.CmsKit.Tags [Fact] public async Task ShouldAddWhenGettingAsync() { - var newTagEntityType = "testEntity"; + var newTagEntityType = _cmsKitTestData.EntityType1; var newTagName = "test_tag_2123"; var doesExist = await _tagRepository.AnyAsync(newTagEntityType, newTagName); @@ -53,16 +53,28 @@ namespace Volo.CmsKit.Tags } [Fact] - public async Task ShouldInsert() + public async Task ShouldInsertAsync() { - var tag = await _tagManager.InsertAsync(Guid.NewGuid(), "test", "test"); + var tagName = "Freshly Created New Tag"; + var tag = await _tagManager.InsertAsync(Guid.NewGuid(), _cmsKitTestData.EntityType1, tagName); tag.ShouldNotBeNull(); - var doesExist = await _tagRepository.AnyAsync("test", "test"); + var doesExist = await _tagRepository.AnyAsync(_cmsKitTestData.EntityType1, tagName); doesExist.ShouldBeTrue(); } + [Fact] + public async Task ShouldntInsertWithUnconfiguredEntityTypeAsync() + { + var notConfiguredEntityType = "My.Namespace.SomeEntity"; + + var exception = await Should.ThrowAsync(async () => + await _tagManager.InsertAsync(Guid.NewGuid(), notConfiguredEntityType, "test")); + + exception.ShouldNotBeNull(); + exception.Data[nameof(Tag.EntityType)].ShouldBe(notConfiguredEntityType); + } [Fact] public async Task ShouldNotInsert() @@ -100,5 +112,15 @@ namespace Volo.CmsKit.Tags Should.Throw(async () => await _tagManager.UpdateAsync(tag.Id, newName)); } + + [Fact] + public async Task ShouldGetTagDefinitionsProperly_WithoutParameter() + { + var definitions = await _tagManager.GetTagDefinitionsAsync(); + + definitions.ShouldNotBeNull(); + definitions.Count.ShouldBeGreaterThan(1); + definitions.ShouldContain(x => x.EntityType == _cmsKitTestData.TagDefinition_1_EntityType); + } } } \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index 46a552641b..e916dd22b3 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -1,4 +1,6 @@ -using System; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.Data; @@ -26,9 +28,12 @@ namespace Volo.CmsKit private readonly IRatingRepository _ratingRepository; private readonly ICurrentTenant _currentTenant; private readonly IContentRepository _contentRepository; - private readonly IEntityTagRepository _entityTagRepository; + private readonly IEntityTagManager _entityTagManager; private readonly ITagManager _tagManager; private readonly IPageRepository _pageRepository; + private readonly IOptions _options; + private readonly IOptions _tagOptions; + public CmsKitDataSeedContributor( IGuidGenerator guidGenerator, ICmsUserRepository cmsUserRepository, @@ -36,11 +41,13 @@ namespace Volo.CmsKit ICommentRepository commentRepository, ReactionManager reactionManager, IRatingRepository ratingRepository, - ICurrentTenant currentTenant, + ICurrentTenant currentTenant, IContentRepository contentRepository, - ITagManager tagManager, - IEntityTagRepository entityTagRepository, - IPageRepository pageRepository) + ITagManager tagManager, + IEntityTagManager entityTagManager, + IPageRepository pageRepository, + IOptions options, + IOptions tagOptions) { _guidGenerator = guidGenerator; _cmsUserRepository = cmsUserRepository; @@ -51,14 +58,18 @@ namespace Volo.CmsKit _currentTenant = currentTenant; _contentRepository = contentRepository; _tagManager = tagManager; - _entityTagRepository = entityTagRepository; + _entityTagManager = entityTagManager; _pageRepository = pageRepository; + _options = options; + _tagOptions = tagOptions; } public async Task SeedAsync(DataSeedContext context) { using (_currentTenant.Change(context?.TenantId)) { + await ConfigureCmsKitOptionsAsync(); + await SeedUsersAsync(); await SeedCommentsAsync(); @@ -75,6 +86,17 @@ namespace Volo.CmsKit } } + private Task ConfigureCmsKitOptionsAsync() + { + _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.EntityType1)); + _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.EntityType2)); + _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.Content_1_EntityType)); + _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.Content_2_EntityType)); + _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.TagDefinition_1_EntityType)); + + return Task.CompletedTask; + } + private async Task SeedUsersAsync() { await _cmsUserRepository.InsertAsync(new CmsUser(new UserData(_cmsKitTestData.User1Id, "user1", @@ -208,14 +230,14 @@ namespace Volo.CmsKit _cmsKitTestData.Content_1_EntityId, _cmsKitTestData.Content_1 ); - + var content2 = new Content( _cmsKitTestData.Content_2_Id, _cmsKitTestData.Content_2_EntityType, _cmsKitTestData.Content_2_EntityId, _cmsKitTestData.Content_2 ); - + var content3 = new Content( Guid.NewGuid(), "deleted_entity_type", @@ -233,18 +255,26 @@ namespace Volo.CmsKit private async Task SeedTagsAsync() { + var created1 = await _tagManager.InsertAsync(_cmsKitTestData.TagId_1, _cmsKitTestData.EntityType1, _cmsKitTestData.TagName_1); + + await _entityTagManager.AddTagToEntityAsync(created1.Id, created1.EntityType, _cmsKitTestData.EntityId1); + + var created2 = await _tagManager.InsertAsync(_cmsKitTestData.TagId_2, _cmsKitTestData.EntityType2, _cmsKitTestData.TagName_2); + + await _entityTagManager.AddTagToEntityAsync(created2.Id, created2.EntityType, _cmsKitTestData.EntityId2); + foreach (var tag in _cmsKitTestData.Content_1_Tags) { var tagEntity = await _tagManager.InsertAsync(_guidGenerator.Create(), _cmsKitTestData.Content_1_EntityType, tag); - await _entityTagRepository.InsertAsync(new EntityTag(tagEntity.Id, _cmsKitTestData.Content_1_EntityId)); + await _entityTagManager.AddTagToEntityAsync(tagEntity.Id, _cmsKitTestData.Content_1_EntityType, _cmsKitTestData.Content_1_EntityId); } - + foreach (var tag in _cmsKitTestData.Content_2_Tags) { var tagEntity = await _tagManager.InsertAsync(_guidGenerator.Create(), _cmsKitTestData.Content_2_EntityType, tag); - - await _entityTagRepository.InsertAsync(new EntityTag(tagEntity.Id, _cmsKitTestData.Content_2_EntityId)); + + await _entityTagManager.AddTagToEntityAsync(tagEntity.Id, _cmsKitTestData.Content_2_EntityType, _cmsKitTestData.Content_2_EntityId); } } @@ -252,10 +282,10 @@ namespace Volo.CmsKit { var page1 = new Page(_cmsKitTestData.Page_1_Id, _cmsKitTestData.Page_1_Title, _cmsKitTestData.Page_1_Url, _cmsKitTestData.Page_1_Description); var page1Content = new Content(_guidGenerator.Create(), nameof(Page), page1.Id.ToString(), _cmsKitTestData.Page_1_Content); - + await _pageRepository.InsertAsync(page1); await _contentRepository.InsertAsync(page1Content); - + var page2 = new Page(_cmsKitTestData.Page_2_Id, _cmsKitTestData.Page_2_Title, _cmsKitTestData.Page_2_Url, _cmsKitTestData.Page_2_Description); var page2Content = new Content(_guidGenerator.Create(), nameof(Page), page2.Id.ToString(), _cmsKitTestData.Page_2_Content); diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs index 8e5049f55e..e12f3d31e8 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestBaseModule.cs @@ -1,11 +1,14 @@ using Microsoft.Extensions.DependencyInjection; +using NSubstitute; using Volo.Abp; using Volo.Abp.Authorization; using Volo.Abp.Autofac; +using Volo.Abp.BlobStoring; using Volo.Abp.Data; using Volo.Abp.GlobalFeatures; using Volo.Abp.Modularity; using Volo.Abp.Threading; +using Volo.FileManagement; namespace Volo.CmsKit { @@ -26,6 +29,16 @@ namespace Volo.CmsKit GlobalFeatureManager.Instance.Modules.CmsKit().EnableAll(); }); + context.Services.AddSingleton(Substitute.For()); + + Configure(options => + { + options.Containers.ConfigureAll((containerName, containerConfiguration) => + { + containerConfiguration.ProviderType = typeof(FakeBlobProvider); + }); + }); + context.Services.AddAlwaysAllowAuthorization(); } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs index 7433759f40..4415cd7eb3 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs @@ -12,6 +12,7 @@ namespace Volo.CmsKit public Guid CommentWithChildId { get; } = Guid.NewGuid(); + public string EntityType1 { get; } = "EntityName1"; public string EntityType2 { get; } = "EntityName2"; @@ -59,5 +60,15 @@ namespace Volo.CmsKit public Guid Page_2_Id { get; } = Guid.NewGuid(); public string Page_2_Content => Content_2; + + public string TagDefinition_1_EntityType => "My.Namespace.CustomType"; + + public Guid TagId_1 { get; } = Guid.NewGuid(); + + public string TagName_1 => "Awesome"; + + public Guid TagId_2 { get; } = Guid.NewGuid(); + + public string TagName_2 => "News"; } } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs new file mode 100644 index 0000000000..1f3db06e6e --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/FakeBlobProvider.cs @@ -0,0 +1,34 @@ +using System.IO; +using System.Threading.Tasks; +using Volo.Abp.BlobStoring; + +namespace Volo.FileManagement +{ + public class FakeBlobProvider : IBlobProvider + { + public virtual Task SaveAsync(BlobProviderSaveArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task DeleteAsync(BlobProviderDeleteArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task ExistsAsync(BlobProviderExistsArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task GetAsync(BlobProviderGetArgs args) + { + throw new System.NotImplementedException(); + } + + public virtual Task GetOrNullAsync(BlobProviderGetArgs args) + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs index 68b91f72a9..67a691c5a8 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Pages/PageRepository_Test.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Linq; +using System.Threading.Tasks; using Shouldly; using Volo.Abp.Modularity; using Xunit; @@ -17,6 +18,38 @@ namespace Volo.CmsKit.Pages _pageRepository = GetRequiredService(); } + [Fact] + public async Task CountAsync() + { + var totalCount = await _pageRepository.GetCountAsync(); + + totalCount.ShouldBe(2); + + var filteredCount = await _pageRepository.GetCountAsync(_cmsKitTestData.Page_2_Title); + + filteredCount.ShouldBe(1); + } + + [Fact] + public async Task GetListAsync() + { + var list = await _pageRepository.GetListAsync(); + + list.ShouldNotBeNull(); + list.Count.ShouldBe(2); + + var list_page_1 = await _pageRepository.GetListAsync(maxResultCount: 1); + var list_page_2 = await _pageRepository.GetListAsync(maxResultCount: 1, skipCount: 1); + + list_page_1.ShouldNotBeNull(); + list_page_1.Count.ShouldBe(1); + list_page_1.First().Title.ShouldBe(_cmsKitTestData.Page_1_Title); + + list_page_2.ShouldNotBeNull(); + list_page_1.Count.ShouldBe(1); + list_page_2.First().Title.ShouldBe(_cmsKitTestData.Page_2_Title); + } + [Fact] public async Task ShouldGetByUrlAsync() { @@ -46,7 +79,7 @@ namespace Volo.CmsKit.Pages [Fact] public async Task ShouldBeExistAsync() { - var page = await _pageRepository.DoesExistAsync(_cmsKitTestData.Page_1_Url); + var page = await _pageRepository.ExistsAsync(_cmsKitTestData.Page_1_Url); page.ShouldBeTrue(); } @@ -54,7 +87,7 @@ namespace Volo.CmsKit.Pages [Fact] public async Task ShouldNotBeExistAsync() { - var page = await _pageRepository.DoesExistAsync("not-exist-lyrics"); + var page = await _pageRepository.ExistsAsync("not-exist-lyrics"); page.ShouldBeFalse(); } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj b/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj index 35c8c151ea..66c009b9a9 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Volo.CmsKit.TestBase.csproj @@ -15,6 +15,7 @@ +
    diff --git a/modules/docs/app/VoloDocs.Web/package.json b/modules/docs/app/VoloDocs.Web/package.json index 0b8416dfd6..ea20ee6d82 100644 --- a/modules/docs/app/VoloDocs.Web/package.json +++ b/modules/docs/app/VoloDocs.Web/package.json @@ -3,7 +3,7 @@ "name": "volo.docstestapp", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0", - "@abp/docs": "^4.1.0" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.2.0", + "@abp/docs": "^4.2.0" } } diff --git a/modules/docs/app/VoloDocs.Web/yarn.lock b/modules/docs/app/VoloDocs.Web/yarn.lock index 2657d440e9..3c3e937d50 100644 --- a/modules/docs/app/VoloDocs.Web/yarn.lock +++ b/modules/docs/app/VoloDocs.Web/yarn.lock @@ -2,45 +2,45 @@ # yarn lockfile v1 -"@abp/anchor-js@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/anchor-js/-/anchor-js-4.1.0.tgz#3762fb4dc12f1c5e01178250cf6381a938908b30" - integrity sha512-+Pk3af5lAiKbXun99TEpgH/AY+il8nqzYWaEVvXkWYVr1/S9YyABz17XblwvyE/o9+CMVRQBgAoC2YuTdX3MwA== +"@abp/anchor-js@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/anchor-js/-/anchor-js-4.2.0.tgz#d45c1262e8fc5746e16b5cdd3a56cbb859cb25b5" + integrity sha512-Lx75d+eaDf15akt6xmEzaVKMassNg536ACU8p/FwKqtQuv7BLW09PWOPfFKuICXHoC/MDZwsyIYkxRxrGpSq6A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" anchor-js "^4.2.2" -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0.tgz#ef1b31feb678fdf4ce6fa76fb1e9d091ca97c9a4" - integrity sha512-eAD39TaMVnXsEOVyKcChIggpzJw3TzDua8x/APlHfxWBQOuCb7C/PWLWH9DIN14kl8JsVpgRrUSlKsvvY8CIRA== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0.tgz#40ef6d20a83a8e700179be7f3989c8d5135808d0" - integrity sha512-UdT3XCUMEKguB1w7qF4TO1ClayWn63oiP7wnOUmIg+O1EdKTHUBYfztle4Qb/aqtzjHoZBsOnMZH/KOyQKejDg== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0" - "@abp/bootstrap" "~4.1.0" - "@abp/bootstrap-datepicker" "~4.1.0" - "@abp/datatables.net-bs4" "~4.1.0" - "@abp/font-awesome" "~4.1.0" - "@abp/jquery-form" "~4.1.0" - "@abp/jquery-validation-unobtrusive" "~4.1.0" - "@abp/lodash" "~4.1.0" - "@abp/luxon" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/select2" "~4.1.0" - "@abp/sweetalert" "~4.1.0" - "@abp/timeago" "~4.1.0" - "@abp/toastr" "~4.1.0" - -"@abp/aspnetcore.mvc.ui@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0.tgz#c23ba554270a9534ac29a7e7ca8ab1ed0dc1cc7b" - integrity sha512-CaPVi8dKLD0/7zrsCdi3hA1alkUKVE3jVoUa2bl0mrBg30Xzu+IDAu6aIWFXOCnIX8YthejhA2Wtn4knbTOB4g== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.2.0.tgz#01d6aab8a31fd6ea828b753805f1ba9a9165975f" + integrity sha512-d+7YubPbuBRY8tjqBxS4I1gyxekjg8Z0X9QaDrf/SGQBoWpIdbG09AekNdddKNkimWcPg4UgUytahPuX9f17ZA== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.2.0" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.2.0.tgz#a72b5e1cefa27e658b7f072a8c2c1b4ee12baef8" + integrity sha512-bgWwBBJA/74kFGWh7O+lzb+inV5LOlYOpDoCNAL0XgQTrutrPNHwsk5ZnGVfhSYrBgk47HGVZDwsqKMCTRn1ig== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.2.0" + "@abp/bootstrap" "~4.2.0" + "@abp/bootstrap-datepicker" "~4.2.0" + "@abp/datatables.net-bs4" "~4.2.0" + "@abp/font-awesome" "~4.2.0" + "@abp/jquery-form" "~4.2.0" + "@abp/jquery-validation-unobtrusive" "~4.2.0" + "@abp/lodash" "~4.2.0" + "@abp/luxon" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/select2" "~4.2.0" + "@abp/sweetalert" "~4.2.0" + "@abp/timeago" "~4.2.0" + "@abp/toastr" "~4.2.0" + +"@abp/aspnetcore.mvc.ui@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.2.0.tgz#9c090f64a33d31962936d8d53b345afeaa9f2ba3" + integrity sha512-Qt3MUZ41vuvnIVEAYxyOm1mflvFwwvKYsEjFBbePBnwaYL7udooiIFxTEm4FBh3EQJOi+8T84rnXqiIXj4Pi8A== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -51,181 +51,181 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0.tgz#5c97fba78e56ba90820014a13e4c2d394d27332f" - integrity sha512-5XDW/Y2Gu1SgIm/tyRuo6vwcJdpFWIEnqDJ+0wjdOvWl3a+HnQTDya5g74mCmEBfYQgYDw8Wz8ovChOOzExh7Q== +"@abp/bootstrap-datepicker@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.2.0.tgz#92abebe044a91b94b8a3b85560b501120a0fa500" + integrity sha512-bhEa/+zGVX00vkXGrbKI/hcl9o5Xgqwb27by9ZQqxk9Go4lwsEP/7lrXM49Cg8XZTT3L0/lYclneEMDrqGafaQ== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0.tgz#50ac670e319a60a985109e96302eed3e46d36afe" - integrity sha512-4lFrbaNPYRa45oH/D+fFUSmgD/OdSoCmHXvSdG2ye6+wyl6gy4JRfjjTOFmwpsyOWJdPMJSV6CARCSSsfeaItA== +"@abp/bootstrap@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.2.0.tgz#c7ce82ead40bf0d62a318f67f180663ec76aa53c" + integrity sha512-E1gEX0ct67KFjKiZB6eQcIYJ3TS/pF1S4CxknBVCd77Zs03bHI+eEgBNlwcYriVBbQo+vheUQAaACbi+e2mm3Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/clipboard@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/clipboard/-/clipboard-4.1.0.tgz#257d582a28e2311f4d433500aff3a529d5756d0a" - integrity sha512-BlJ3+eHXJcj0RJ5PdZ1I8ag0wylp4lW7ukzmXifzSYbT0on6o8pJuCvQM5rAyNqA5ucunjj9QiYXRRo44guKtQ== +"@abp/clipboard@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/clipboard/-/clipboard-4.2.0.tgz#860220df1d57ef64e864401d56cb5cf7068d5861" + integrity sha512-yBgMDhpqPEHp9N9//Ur1BEIOicFIoKBut75PMz9XPOttLyqCmqHYEPj/jgAkUzLd5O+fJM9TE3yGNM7YdRbRPg== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" clipboard "^2.0.6" -"@abp/core@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0.tgz#6bdfa378d44cbf8f611d52dddf0915e5bbc188d5" - integrity sha512-HXkKCfh8+Yc9iVBsZy7eSoQbkBSdV1QTRAF8+cPgbEpU4x4WlUOy61xqb2pSLFzX9nSma83WhdDyQkzWDBTRZQ== +"@abp/core@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.2.0.tgz#20da3d1bab30e80d8864915fdd67e99db729be71" + integrity sha512-Cfa6Ck+Tr7isVpNxo9qT9eKByLadDErA+QVjeps7qYq9ztIpIz/7Yl85tHYEH0YPO9y2zcSOvxjy5SCBXlph5Q== dependencies: - "@abp/utils" "^4.1.0" + "@abp/utils" "^4.2.0" -"@abp/datatables.net-bs4@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0.tgz#c28097b82f62b236d6f2578d7148128914eb5cd8" - integrity sha512-/fM/3Q/yXJaPsXGKIOZBgihxGLZ/T+n+6wguFeEypsAXCJ4MfpcRZ/eFPvVlBmmc/PVIdE8xtj5rnH9+/2KHWg== +"@abp/datatables.net-bs4@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.2.0.tgz#b5cb47235079a4063c5ff8ce78e65596fa587709" + integrity sha512-N4hp2xCst1qavt07Nf+zXlvbZfeSah64VuMjsZgaimHMlDjxg6zVsTHLgLfzwfPV/eOBrGiecPEuvfEeaqcw4A== dependencies: - "@abp/datatables.net" "~4.1.0" + "@abp/datatables.net" "~4.2.0" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0.tgz#a037fdae4beb9805e8eea71f086573eed4fd3c92" - integrity sha512-OZogC3UEvTSyas+VcxffggQ8U2fi399Ka+++4p+oXCPGykDLU1EKOSA/CToiu9uYNYJQ3125SjRZSOJD5h/ukg== +"@abp/datatables.net@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.2.0.tgz#2e0273c3212e5a62fc8b4138e4570fb27143f701" + integrity sha512-33ZkaorkVkPQ7HNtDjyIvcVbvAdFm8V+gFN+xMQZhA10wMlMGrKzVJjriv4NhNpPjtB4/owhOv6wobiuWBrGiA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" datatables.net "^1.10.21" -"@abp/docs@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/docs/-/docs-4.1.0.tgz#cc967324ca6227c8d22a94b8b722736c065a7528" - integrity sha512-9EsN0GHma7NgZyfzJgovagYNYmOa2PbLq6IcRpJ7Y3lrq/YTstPFsZTh9YrLq7TD1x0iooc11wp/1wgs909Vww== +"@abp/docs@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/docs/-/docs-4.2.0.tgz#6520643a3aa6346a45789c63a6383439e126a5bb" + integrity sha512-JoQkUeqSN9LwvdWFI8zDNGi1lx+vG0aZHGsmoM7WgtMCcGDyv/NGEYwyKCKSXYiOQcXRqpSjOIxo5gi4RO0UzA== dependencies: - "@abp/anchor-js" "~4.1.0" - "@abp/clipboard" "~4.1.0" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0" - "@abp/popper.js" "~4.1.0" - "@abp/prismjs" "~4.1.0" + "@abp/anchor-js" "~4.2.0" + "@abp/clipboard" "~4.2.0" + "@abp/malihu-custom-scrollbar-plugin" "~4.2.0" + "@abp/popper.js" "~4.2.0" + "@abp/prismjs" "~4.2.0" -"@abp/font-awesome@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0.tgz#a95f8df5f7e3695aaf05e3eab9f3087f4017d7e9" - integrity sha512-Zc4mPp740ACe10ollWez4qNg2QnM/AexDkF3pkxYNb1B9J4Fb8H7SefOOtMRdRgHK+sEe5vrPfIs8//gTf4xeQ== +"@abp/font-awesome@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.2.0.tgz#a637d164634b0df862e4ea620736afae282c71c9" + integrity sha512-P8OXp+XIZj6l7cNJ5+7Lpl8iixI/bHGSPkATggaOYZ2EWoNR3B/8pj7p44weP2bCAvUEvaxk214BKlpAslo8eQ== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0.tgz#b773c4f4619c3731c781993bba59a1cf38357918" - integrity sha512-7Mio+ehj7M2qt3oOyDBi97yNg1ip6BZiUpHkMtmPc/OxdnxpOZV9tZHyhbsoZFYTu1dUSmrpY6HKY0zibohyBQ== +"@abp/jquery-form@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.2.0.tgz#12b88a79a69f7d3b15aed8c7ca3ff5bc9f526f22" + integrity sha512-lxvXhA4kg002gmDTWgoE6TcQWDe6kBcpV4KBB7aK/6LjK3noeT29SPX0kvKxjoUKyM5TqT2Hx7rg4jgtICjFFA== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0.tgz#954ce53a46475c09056d789eba761568482ea8c9" - integrity sha512-diykqQiGzowYDpsG9PMd3ipeXFrilRQiHQX2mglBf+FNKMocp7LBAIeD2INkiObczZfIKkoqu7WCRqb1bl5uKg== +"@abp/jquery-validation-unobtrusive@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.2.0.tgz#05bcd303ec1e22b85389d03a8941eb898bac354f" + integrity sha512-mtvUcoTD5XSurMFI5cybgWzFI9bn35vU1PvH5NJxJitjJ7sg9gjtLf9WOIddIy4FdqmprhbG2YnR32GITOwFhg== dependencies: - "@abp/jquery-validation" "~4.1.0" + "@abp/jquery-validation" "~4.2.0" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0.tgz#29cffb21270c52758804cf0d3f5b6e83b327047d" - integrity sha512-JrDcejGKz33LeNMn3+DguzDd8XN6LXlceffMc8jz4zYvtb+NqwUn7NFvH3gnKfNKBc8V9cQIHxQpYQa8luYcsA== +"@abp/jquery-validation@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.2.0.tgz#a09d7cf2abf8ccf0c59f27eadacb030fb2067bbe" + integrity sha512-/nvJrs1pt3LJX+SgH3FtDPfCDrcl4M0LDxjV7hf0Y1jtyhvWOQiyJMb8FKzMweTTEOd0pHG/GvOKd90STabSiw== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0.tgz#3c021d24eb5ef7fe198da8982657075556556701" - integrity sha512-1HLjkxj5EudcoxZ9CVqsP0tgKwLQBs5KI9vnnW9I9pco6fIf1Q2PT+TZZywOZ3ftkYfMp90PF+A5IL/JfovnpQ== +"@abp/jquery@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.2.0.tgz#0a24488198ca6c9b84273fa028b853ee9f94f3a7" + integrity sha512-6a42Iy7knhgzvQUvCHenrVnPDKhsOyqgZkPxs9pa9x/wNapSch+jLM7u1ezKAFj/Ai4w9yG/yqP+4YE8seZDZw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" jquery "~3.5.1" -"@abp/lodash@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0.tgz#e605644ba745813a2937b24f3b9d2ad86b20dec9" - integrity sha512-jUjua8iZIE5P/AELI/nffS09IorBRM/Jfq6agCOX6Qg7d8od66B9gV727mTuaMd9ZW65S1wW5+zMJhm5gy7Qpg== +"@abp/lodash@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.2.0.tgz#74dfac7d70f1563df2b78c5ebd0b2450e11c4c42" + integrity sha512-5hpjxWZJPvjMIY7FCCw/v/B+JzJbB/yuoioRzcU4vrisY9uRq54vVYcX7hH1DldsJFPTuXY3Id1WBflHA5I9Aw== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" lodash "^4.17.15" -"@abp/luxon@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0.tgz#12c9b6eb2a87e0ebe7df58bcbd5f38211ca62e81" - integrity sha512-gc8DAZHa+fcnDGWGQHmI8Tllr+QzHAZejrwoVSRiRX+Oebf67sCEDdbwB8yWeEHSa3MbpPtm7I1aTc/+dQI8Dg== +"@abp/luxon@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.2.0.tgz#9cd02faa02cda1315f3e23ae204991ef47d6ae7c" + integrity sha512-dwtv2kqWCDyQADA1Os0aIy6Au2PhBtN6q9kukLWCvYmQZI23OKuEBMSngbJVTqEPfz0LV6CWbsWCUC3okAs46A== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0.tgz#a340fa3757eb01bd510d3dcb54331b5b0a93a63f" - integrity sha512-CMCIxQNwPNRmmg4WctusMWhg8evrCoq3frQ5Fxnc/fKaMrrzQKL5PY2cV2jY2m5Se+Y+S9EPa3cNOQ1/KYuQ9w== +"@abp/malihu-custom-scrollbar-plugin@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.2.0.tgz#2f8538df5567a2cf227998e4e2fb9a44b6e814eb" + integrity sha512-3D5REdR7yw2sRRfm3Oi+qlhDABLrKvfU/l7JcCJy+vrBvadx3e3pTdTLXsGptypPN3x/Qr400LgwIrrgyefN8g== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/popper.js@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/popper.js/-/popper.js-4.1.0.tgz#62b973486d95ad01880a0bd48fb84cce93c821f1" - integrity sha512-nS8y92JmOMiewUaLX8WtkN7de+qnNk6vyGftj1nsv4LeUb6MMB+yrAubtF4ZtMEWaEP4EcZFwkXv4YEK78cBuA== +"@abp/popper.js@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/popper.js/-/popper.js-4.2.0.tgz#9dcae6af647974b37ce650160d0ced003aa0efdc" + integrity sha512-ipaJqx72I2X+UcST2FOdAVm3AoMggJ+Cl1fbm+CdUcaVi50dhwxFV2E259neLNEHb6sCi3swao2YSAPMb7hX6Q== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" popper.js "^1.16.0" -"@abp/prismjs@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/prismjs/-/prismjs-4.1.0.tgz#fde3454460013490f566fc3b27fbc1031251b98b" - integrity sha512-jXE8oS8JyLgZS/oXrVS2CxtIH09WEHoUPM4HfndzxSPzxmg3G+E8kzMXbPrHGGx7AhHgmSxNVFGuR2+1YFpSPQ== +"@abp/prismjs@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/prismjs/-/prismjs-4.2.0.tgz#8cedfac538d225930c3654f0d94cad0102faa2f4" + integrity sha512-f4duxGD47p2TDMNiiBcvvjOG1hjhSbAoXyq306RrbP0CBUVTdjzzVhCPPnr5+nMoG55VlRBqh92zkax5kdgwQg== dependencies: - "@abp/clipboard" "~4.1.0" - "@abp/core" "~4.1.0" + "@abp/clipboard" "~4.2.0" + "@abp/core" "~4.2.0" prismjs "^1.20.0" -"@abp/select2@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0.tgz#c1b8b7cca16bfe813d83e84f738acda8f8182159" - integrity sha512-p6atSzYTU5o36S4GHCHvi3wHf3fgg6wNJIxk4ohSxu1mOQnUbmyYbxKiDFxq+MOR2sOfVmAjqb4xvcIjexg6hA== +"@abp/select2@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.2.0.tgz#eb05d22b1390c037911ba25e5ca0f2ed508a93b1" + integrity sha512-VlNoa9+F1/kGmaEI2wbL/cRNeAEpp0UdLpbadAnsmpUIODxCULCWS556Q4Y6Ff4CzYtzkYz2qaJ8T8pn+3EOcA== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0.tgz#e5c8cb0c84435a0ca97be62c7b9204bbd05ae23d" - integrity sha512-VwIp7VD7zzkRMJw3yu7YOlWbIA/JbLYZeyEpNFMIDxAGYG936tVsmH+aQVTovHF/3+VsYf9Da1JjKymLVHkWRg== +"@abp/sweetalert@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.2.0.tgz#b1daf641f27f0c8c2e246d364d6285c133faf773" + integrity sha512-AarV/L031xNB1gk/OYEUxkKZmls7zTwovS2t3ZrmwXXoav7nBCSPjEf1ByR2yhZRU/Yo1SNY/CNQQ4dgyf7Xng== dependencies: - "@abp/core" "~4.1.0" + "@abp/core" "~4.2.0" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0.tgz#06df44618398cbec7bd174b7afd180907b67bb69" - integrity sha512-e1n9i8O0CaT4EIrnzMOur1HxSDpelgaVCLS9NWsTf4j4fIR3ojFqSNt76tpaPqVGBY9vRraGGu16XembYFF+jA== +"@abp/timeago@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.2.0.tgz#9b15c496b7e63df93921d41de9e9eaf35a8dccbe" + integrity sha512-hyuLVGluHxtWEhR0VakPx5UCbyPcfq4lECEgHhI62PvH0xcSNNZ3bp1QnBTd3se/HAYvwA5sCwJY0YXQgUF2UQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" timeago "^1.6.7" -"@abp/toastr@~4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0.tgz#eaa79a9e48638a2e86cb9573516e8614bfaf15a4" - integrity sha512-lA3pCdXgAWe1sVhC+/UNJa4T9AdxgN5ncW/3KW+9fg+IOieDwDibPIiuyornxrm+8G6uvrGxi//I3EeeqHABbg== +"@abp/toastr@~4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.2.0.tgz#400e2f28b19c72b131ca32aa188ff5151d035752" + integrity sha512-tuGZd3kXqj1t/Y1xN8sOUH1KxiArYKD7xkhuajoOS65Ex5ad8mHPuzCtu8Pv+KL8TVFys9x3U3Tg24DQ6ASjhQ== dependencies: - "@abp/jquery" "~4.1.0" + "@abp/jquery" "~4.2.0" toastr "^2.1.4" -"@abp/utils@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0.tgz#1f5d8b4dc8a234c15d87869436485fd737f18b50" - integrity sha512-fksnKF1bsOab5AVe8qBs2HZmcRVjrnsMwXs23xaqSRdpWXpPgsLRuKCJHlD0usREyerDGPkpY5opUnXWggHvCg== +"@abp/utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.2.0.tgz#073330e3e3f6ee61892f50260e48dbe1b05df35e" + integrity sha512-75qR3SdiAa75wqleAx9sUMXLj4m9duuBo5+2sVv7Y29GcEyKUPvm8B1s6tksvSGA0e3vnFTHeVEc10eD1xKHSQ== dependencies: just-compare "^1.3.0" diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/nl.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/nl.json index fad3137f04..6451eed41e 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/nl.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/nl.json @@ -7,6 +7,7 @@ "Permission:Delete": "Verwijder", "Permission:Create": "Maak aan", "Permission:Documents": "Documenten", + "Menu:Documents": "Documenten", "Menu:DocumentManagement": "Documenten", "Menu:ProjectManagement": "Projecten", "CreateANewProject": "Maak een nieuw project", @@ -30,8 +31,29 @@ "DisplayName:GitHubRootUrl": "GitHub root URL", "DisplayName:GitHubAccessToken": "GitHub-toegangstoken", "DisplayName:GitHubUserAgent": "GitHub-gebruikersagent", + "DisplayName:GithubVersionProviderSource": "GitHub versieprovider bron", + "DisplayName:VersionBranchPrefix": "Versie branch prefix", "DisplayName:All": "Pull all", "DisplayName:LanguageCode": "Taalcode", - "DisplayName:Version": "Versie" + "DisplayName:Version": "Versie", + "Documents": "Documenten", + "RemoveFromCache": "Verwijderen uit cache", + "Reindex": "Opnieuw indexeren", + "ReindexCompleted": "Opnieuw indexeren voltooid", + "RemovedFromCache": "Verwijderen uit cache", + "RemoveFromCacheConfirmation": "Weet u zeker dat u dit item uit de cache wilt verwijderen?", + "ReIndexDocumentConfirmation": "Weet u zeker dat u dit item opnieuw wilt indexeren?", + "DeleteFromDatabase": "Verwijder uit database", + "Deleted": "Verwijderd", + "Search": "Zoeken", + "StartDate": "Startdatum", + "EndDate": "Einddatum", + "CreationTime": "Aanmaaktijd", + "LastUpdateTime": "Laatste update", + "LastSignificantUpdateTime": "Laatste significante update", + "Version": "Versie", + "LanguageCode": "Taalcode", + "FileName": "Bestandsnaam", + "LastCachedTime": "Cache tijd" } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de-DE.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de-DE.json index b6687f978b..432e9617dc 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de-DE.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de-DE.json @@ -34,6 +34,8 @@ "NewExplanation": "In den letzten zwei Wochen erstellt.", "UpdatedExplanation": "In den letzten zwei Wochen aktualisiert.", "Volo.Docs.Domain:010002": "Kurzname {ShortName} existiert bereits.", - "Preview": "Vorschau" + "Preview": "Vorschau", + "Search": "Suchen", + "SearchResults": "Suchergebnisse" } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de.json index 25994178f7..544a7ca7c8 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/de.json @@ -10,22 +10,32 @@ "LastEditTime": "Letzte Bearbeitung", "Delete": "Löschen", "ClearCache": "Cache leeren", - "ClearCacheConfirmationMessage": "Sind Sie sicher, dass Sie alle Caches für das Projekt löschen \"{0}\"", + "ClearCacheConfirmationMessage": "Sind Sie sicher, alle Caches für das Projekt \"{0}\" zu löschen?", + "ReIndexAllProjects": "Alle Projekte neu indizieren", + "ReIndexProject": "Projekt neu indizieren", + "ReIndexProjectConfirmationMessage": "Sind Sie sicher, dass Sie das Projekt \"{0}\" neu indizieren?", + "SuccessfullyReIndexProject": "Neuindizierung für Projekt \"{0}\"", + "ReIndexAllProjectConfirmationMessage": "Sind Sie sicher, alle Projekte neu zu indizieren?", + "SuccessfullyReIndexAllProject": "Alle Projekte erfolgreich neu indizieren", "InThisDocument": "In diesem Dokument", "GoToTop": "Nach oben", "Projects": "Projekt(e)", "NoProjectWarning": "Es gibt noch keine Projekte!", "DocumentNotFound": "Hoppla, das angeforderte Dokument wurde nicht gefunden!", + "ProjectNotFound": "Hoppla, das angeforderte Projekt wurde nicht gefunden!", "NavigationDocumentNotFound": "Diese Version hat kein Navigationsdokument!", "DocumentNotFoundInSelectedLanguage": "Das Dokument wurde nicht in der von Ihnen gewünschten Sprache gefunden. Das Dokument wird in der Standardsprache angezeigt.", "FilterTopics": "Themen filtern", - "FullSearch": "Suche in Dokumenten", + "FullSearch": "In Dokumenten suchen", "Volo.Docs.Domain:010001": "Elastic search ist nicht aktiviert.", "MultipleVersionDocumentInfo": "Dieses Dokument hat mehrere Versionen. Wählen Sie die für Sie am besten geeigneten Optionen aus.", "New": "Neu", "Upd": "Upd", "NewExplanation": "Erstellt in den letzten zwei Wochen.", "UpdatedExplanation": "Aktualisiert in den letzten zwei Wochen.", - "Volo.Docs.Domain:010002": "Kurzname {ShortName} existiert bereits." + "Volo.Docs.Domain:010002": "Kurzname {ShortName} existiert bereits.", + "Preview": "Vorschau", + "Search": "Suchen", + "SearchResults": "Suchergebnisse" } } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json index 4a9ac08ebb..dd60e2602b 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json @@ -34,6 +34,8 @@ "NewExplanation": "Created in the last two weeks.", "UpdatedExplanation": "Updated in the last two weeks.", "Volo.Docs.Domain:010002": "ShortName {ShortName} already exists.", - "Preview": "preview" + "Preview": "preview", + "Search": "Search", + "SearchResults": "Search Results" } } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/nl.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/nl.json index 26aa1b614c..7433361079 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/nl.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/nl.json @@ -11,11 +11,18 @@ "Delete": "Verwijder", "ClearCache": "Cache wissen", "ClearCacheConfirmationMessage": "Weet u zeker dat u alle caches voor het project \"{0}\" wilt wissen?", + "ReIndexAllProjects": "Alle Projecten opnieuw indexeren", + "ReIndexProject": "Project opnieuw indexeren", + "ReIndexProjectConfirmationMessage": "Weet u zeker dat u project \"{0}\" opnieuw wilt indexeren?", + "SuccessfullyReIndexProject": "Project \"{0}\" is succesvol opnieuw geïndexeerd", + "ReIndexAllProjectConfirmationMessage": "Weet u zeker dat u alle projecten opnieuw wilt indexeren?", + "SuccessfullyReIndexAllProject": "Alle projecten zijn succesvol opnieuw geïndexeerd", "InThisDocument": "In dit document", "GoToTop": "Ga naar boven", "Projects": "Project (en)", "NoProjectWarning": "Er zijn nog geen projecten!", "DocumentNotFound": "Oeps, het opgevraagde document is niet gevonden!", + "ProjectNotFound": "Oeps, het opgevraagde project is niet gevonden!", "NavigationDocumentNotFound": "Deze versie heeft geen navigatiedocument!", "DocumentNotFoundInSelectedLanguage": "Document in de gewenste taal is niet gevonden. Document in de standaardtaal wordt weergegeven.", "FilterTopics": "Filter onderwerpen", @@ -26,6 +33,7 @@ "Upd": "Bew", "NewExplanation": "Gemaakt in de afgelopen twee weken.", "UpdatedExplanation": "Bewerkt in de afgelopen twee weken.", - "Volo.Docs.Domain:010002": "KorteNaam {ShortName} bestaat al." + "Volo.Docs.Domain:010002": "KorteNaam {ShortName} bestaat al.", + "Preview": "voorbeeld" } -} +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json index f12c1f4149..9c32e143f1 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json @@ -33,6 +33,9 @@ "Upd": "更新", "NewExplanation": "在最近两周内创建.", "UpdatedExplanation": "在最近两周内更新.", - "Volo.Docs.Domain:010002": "简称 {ShortName} 已经存在." + "Volo.Docs.Domain:010002": "简称 {ShortName} 已经存在.", + "Preview": "预览", + "Search": "搜索", + "SearchResults": "搜索结果" } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/IProjectRepository.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/IProjectRepository.cs index add77749b4..4893ab4114 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/IProjectRepository.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/IProjectRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -7,10 +8,10 @@ namespace Volo.Docs.Projects { public interface IProjectRepository : IBasicRepository { - Task> GetListAsync(string sorting, int maxResultCount, int skipCount); + Task> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default); - Task GetByShortNameAsync(string shortName); + Task GetByShortNameAsync(string shortName, CancellationToken cancellationToken = default); - Task ShortNameExistsAsync(string shortName); + Task ShortNameExistsAsync(string shortName, CancellationToken cancellationToken = default); } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Project.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Project.cs index 720cf494d6..48eb93d19e 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Project.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Project.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using JetBrains.Annotations; using Volo.Abp; using Volo.Abp.Domain.Entities; diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs index 7c1c635617..911db81a15 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs @@ -1,11 +1,13 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public class DocsDbContext: AbpDbContext, IDocsDbContext { @@ -15,7 +17,7 @@ namespace Volo.Docs.EntityFrameworkCore public DbSet DocumentContributors { get; set; } - public DocsDbContext(DbContextOptions options) + public DocsDbContext(DbContextOptions options) : base(options) { diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs index 379ca8792d..c751475728 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs @@ -16,6 +16,11 @@ namespace Volo.Docs.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); + if (builder.IsTenantOnlyDatabase()) + { + return; + } + var options = new DocsModelBuilderConfigurationOptions( DocsDbProperties.DbTablePrefix, DocsDbProperties.DbSchema @@ -69,4 +74,4 @@ namespace Volo.Docs.EntityFrameworkCore }); } } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs index 6e96604592..8edd1b74a0 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs @@ -1,11 +1,13 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public interface IDocsDbContext : IEfCoreDbContext { @@ -15,4 +17,4 @@ namespace Volo.Docs.EntityFrameworkCore DbSet DocumentContributors { get; set; } } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs index bf92a8a795..294241c992 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic.Core; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Entities; @@ -18,20 +19,20 @@ namespace Volo.Docs.Projects { } - public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount) + public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default) { var projects = await (await GetDbSetAsync()).OrderBy(sorting ?? "Id desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return projects; } - public async Task GetByShortNameAsync(string shortName) + public async Task GetByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); - var project = await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.ShortName == normalizeShortName); + var project = await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.ShortName == normalizeShortName, GetCancellationToken(cancellationToken)); if (project == null) { @@ -41,11 +42,11 @@ namespace Volo.Docs.Projects return project; } - public async Task ShortNameExistsAsync(string shortName) + public async Task ShortNameExistsAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); - return await (await GetDbSetAsync()).AnyAsync(x => x.ShortName == normalizeShortName); + return await (await GetDbSetAsync()).AnyAsync(x => x.ShortName == normalizeShortName, GetCancellationToken(cancellationToken)); } private string NormalizeShortName(string shortName) diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs index afc430c945..3bfb5df491 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs @@ -2,10 +2,12 @@ using Volo.Abp.Data; using Volo.Docs.Projects; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; using Volo.Docs.Documents; namespace Volo.Docs.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public class DocsMongoDbContext : AbpMongoDbContext, IDocsMongoDbContext { diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs index 92c86a7c4f..f6b748611c 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs @@ -1,11 +1,13 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public interface IDocsMongoDbContext : IAbpMongoDbContext { @@ -13,4 +15,4 @@ namespace Volo.Docs.MongoDB IMongoCollection Documents { get; } } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs index 91f1af9b2a..99aa5a99dd 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs @@ -9,6 +9,7 @@ using Volo.Abp.MongoDB; using Volo.Docs.MongoDB; using System.Linq; using System.Linq.Dynamic.Core; +using System.Threading; namespace Volo.Docs.Projects { @@ -19,20 +20,20 @@ namespace Volo.Docs.Projects { } - public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount) + public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default) { - var projects = await (await GetMongoQueryableAsync()).OrderBy(sorting ?? "Id desc").As>() + var projects = await (await GetMongoQueryableAsync(cancellationToken)).OrderBy(sorting ?? "Id desc").As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); return projects; } - public async Task GetByShortNameAsync(string shortName) + public async Task GetByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); - var project = await (await GetMongoQueryableAsync()).FirstOrDefaultAsync(p => p.ShortName == normalizeShortName); + var project = await (await GetMongoQueryableAsync(cancellationToken)).FirstOrDefaultAsync(p => p.ShortName == normalizeShortName, GetCancellationToken(cancellationToken)); if (project == null) { @@ -42,11 +43,11 @@ namespace Volo.Docs.Projects return project; } - public async Task ShortNameExistsAsync(string shortName) + public async Task ShortNameExistsAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); - return await (await GetMongoQueryableAsync()).AnyAsync(x => x.ShortName == normalizeShortName); + return await (await GetMongoQueryableAsync(cancellationToken)).AnyAsync(x => x.ShortName == normalizeShortName, GetCancellationToken(cancellationToken)); } private string NormalizeShortName(string shortName) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Search.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Search.cshtml index 127994a24c..5d1f232acd 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Search.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Search.cshtml @@ -30,12 +30,12 @@
    -

    Search in Documents

    +

    @L["FullSearch"]

    -
    +
    @@ -43,7 +43,7 @@
    -
    Search Results
    +
    @L["SearchResults"]
    @foreach (var docs in Model.SearchOutputs) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/nl.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/nl.json index 8bb07d32d4..c34ae5cc93 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/nl.json +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/nl.json @@ -2,6 +2,9 @@ "culture": "nl", "texts": { "Features": "Functies", - "NoFeatureFoundMessage": "Er is geen functie beschikbaar." + "NoFeatureFoundMessage": "Er is geen functie beschikbaar.", + "Permission:FeatureManagement": "Functiebeheer", + "Permission:FeatureManagement.ManageHostFeatures": "Beheer host functies", + "Volo.Abp.FeatureManagement:InvalidFeatureValue": "{0} functie-waarde is niet geldig!" } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/IFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/IFeatureValueRepository.cs index f5b5c85da4..800424e901 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/IFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/IFeatureValueRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -7,10 +8,21 @@ namespace Volo.Abp.FeatureManagement { public interface IFeatureValueRepository : IBasicRepository { - Task FindAsync(string name, string providerName, string providerKey); + Task FindAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default); - Task> FindAllAsync(string name, string providerName, string providerKey); + Task> FindAllAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default); - Task> GetListAsync(string providerName, string providerKey); + Task> GetListAsync( + string providerName, + string providerKey, + CancellationToken cancellationToken = default); } } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs index be75e600d8..8256b08c2d 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -15,29 +16,38 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { } - public virtual async Task FindAsync(string name, string providerName, string providerKey) + public virtual async Task FindAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .OrderBy(x => x.Id) - .FirstOrDefaultAsync( - s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey - ); + .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken)); } - public async Task> FindAllAsync(string name, string providerName, string providerKey) + public async Task> FindAllAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where( s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(); + ).ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListAsync(string providerName, string providerKey) + public virtual async Task> GetListAsync( + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where( s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(); + ).ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs index af027dc9ba..9c47fcc28c 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs @@ -1,15 +1,17 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public class FeatureManagementDbContext : AbpDbContext, IFeatureManagementDbContext { public DbSet FeatureValues { get; set; } - public FeatureManagementDbContext(DbContextOptions options) + public FeatureManagementDbContext(DbContextOptions options) : base(options) { @@ -22,4 +24,4 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore builder.ConfigureFeatureManagement(); } } -} \ No newline at end of file +} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs index d854f89448..0398096b95 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs @@ -12,6 +12,11 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); + if (builder.IsTenantOnlyDatabase()) + { + return; + } + var options = new FeatureManagementModelBuilderConfigurationOptions( FeatureManagementDbProperties.DbTablePrefix, FeatureManagementDbProperties.DbSchema @@ -34,4 +39,4 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore }); } } -} \ No newline at end of file +} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs index 14abbccc5c..5f1f3f19b2 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs @@ -1,12 +1,14 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public interface IFeatureManagementDbContext : IEfCoreDbContext { DbSet FeatureValues { get; set; } } -} \ No newline at end of file +} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs index e563130d4f..ba87fbabfb 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs @@ -1,9 +1,11 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.FeatureManagement.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public class FeatureManagementMongoDbContext : AbpMongoDbContext, IFeatureManagementMongoDbContext { @@ -16,4 +18,4 @@ namespace Volo.Abp.FeatureManagement.MongoDB modelBuilder.ConfigureFeatureManagement(); } } -} \ No newline at end of file +} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs index 290dfbe950..d826571ba6 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs @@ -1,9 +1,11 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.FeatureManagement.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public interface IFeatureManagementMongoDbContext : IAbpMongoDbContext { diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs index 21d4784f6e..8f5a659fd8 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; @@ -16,24 +17,35 @@ namespace Volo.Abp.FeatureManagement.MongoDB } - public virtual async Task FindAsync(string name, string providerName, string providerKey) + public virtual async Task FindAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(cancellationToken)) .OrderBy(x => x.Id) - .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey); + .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken)); } - public async Task> FindAllAsync(string name, string providerName, string providerKey) + public async Task> FindAllAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) - .Where(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync(); + return await (await GetMongoQueryableAsync(cancellationToken)) + .Where(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListAsync(string providerName, string providerKey) + public virtual async Task> GetListAsync( + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(cancellationToken)) .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml index f3080b7275..aa8d7313d9 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml @@ -26,7 +26,7 @@ { var featureGroups = Model.FeatureListResultDto.Groups; - + diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs index 9097bbc144..ef3b5fd35d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; @@ -37,17 +38,26 @@ namespace Volo.Abp.Identity var user = await UserManager.GetByIdAsync(CurrentUser.GetId()); - if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled)) + if (!string.Equals(user.UserName, input.UserName, StringComparison.InvariantCultureIgnoreCase)) { - (await UserManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); + if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled)) + { + (await UserManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); + } } - if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled)) + if (!string.Equals(user.Email, input.Email, StringComparison.InvariantCultureIgnoreCase)) { - (await UserManager.SetEmailAsync(user, input.Email)).CheckErrors(); + if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled)) + { + (await UserManager.SetEmailAsync(user, input.Email)).CheckErrors(); + } } - (await UserManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); + if (!string.Equals(user.PhoneNumber, input.PhoneNumber, StringComparison.InvariantCultureIgnoreCase)) + { + (await UserManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); + } user.Name = input.Name; user.Surname = input.Surname; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json index 1ca863e935..4abc1394c7 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json @@ -11,7 +11,7 @@ "DisplayName:IsDefault": "Standaard", "DisplayName:IsStatic": "Statisch", "DisplayName:IsPublic": "Openbaar", - "Roles": "Roles", + "Roles": "Rollen", "Password": "Wachtwoord", "PersonalInfo": "Mijn profiel", "PersonalSettings": "Persoonlijke instellingen", @@ -24,7 +24,7 @@ "DisplayName:Password": "Wachtwoord", "DisplayName:Email": "E-mail adres", "DisplayName:PhoneNumber": "Telefoonnummer", - "DisplayName:TwoFactorEnabled": "Twee-factor-verificatie", + "DisplayName:TwoFactorEnabled": "Tweefactor authenticatie", "DisplayName:LockoutEnabled": "Account vergrendelen na mislukte inlogpogingen", "NewRole": "Nieuwe rol", "RoleName": "Rol naam", @@ -36,14 +36,14 @@ "PasswordChangedMessage": "Uw wachtwoord is met succes veranderd.", "PersonalSettingsSavedMessage": "Uw persoonlijke instellingen zijn succesvol opgeslagen.", "Volo.Abp.Identity:DefaultError": "Er is een onbekende fout opgetreden.", - "Volo.Abp.Identity:ConcurrencyFailure": "Optimistische gelijktijdigheidsfout, object is gewijzigd.", + "Volo.Abp.Identity:ConcurrencyFailure": "Optimistische gelijktijdigheidsfout, object is al gewijzigd.", "Volo.Abp.Identity:DuplicateEmail": "E-mail '{0}' is al in gebruik.", - "Volo.Abp.Identity:DuplicateRoleName": "De rolnaam '{0}' is al in gebruik.", + "Volo.Abp.Identity:DuplicateRoleName": "De rol naam '{0}' is al in gebruik.", "Volo.Abp.Identity:DuplicateUserName": "Gebruikersnaam '{0}' is al in gebruik.", - "Volo.Abp.Identity:InvalidEmail": "E-mail' {0} 'is ongeldig.", + "Volo.Abp.Identity:InvalidEmail": "E-mailadres '{0}' is ongeldig.", "Volo.Abp.Identity:InvalidPasswordHasherCompatibilityMode": "De opgegeven PasswordHasherCompatibilityMode is ongeldig.", "Volo.Abp.Identity:InvalidPasswordHasherIterationCount": "De iteratietelling moet een positief geheel getal zijn.", - "Volo.Abp.Identity:InvalidRoleName": "Rolnaam '{0}' is ongeldig.", + "Volo.Abp.Identity:InvalidRoleName": "Rol naam '{0}' is ongeldig.", "Volo.Abp.Identity:InvalidToken": "Ongeldig token.", "Volo.Abp.Identity:InvalidUserName": "Gebruikersnaam '{0}' is ongeldig, mag alleen letters of cijfers bevatten.", "Volo.Abp.Identity:LoginAlreadyAssociated": "Er bestaat al een gebruiker met deze login.", @@ -61,9 +61,15 @@ "Volo.Abp.Identity:UserNameNotFound": "Gebruiker {0} bestaat niet.", "Volo.Abp.Identity:UserNotInRole": "Gebruiker speelt geen rol '{0}'.", "Volo.Abp.Identity:PasswordConfirmationFailed": "Wachtwoord komt niet overeen met de wachtwoord bevestiging.", + "Volo.Abp.Identity:010001": "U kunt uw eigen account niet verwijderen!", + "Volo.Abp.Identity:010002": "Kan niet meer dan {MaxUserMembershipCount} organisatie-eenheden koppelen aan een gebruiker!", + "Volo.Abp.Identity:010003": "Kan het wachtwoord van een extern ingelogde gebruiker niet wijzigen!", + "Volo.Abp.Identity:010004": "Er is al een organisatie-eenheid met naam {0}. Twee eenheden met dezelfde naam kunnen niet op hetzelfde niveau worden gemaakt.", "Volo.Abp.Identity:010005": "Statische rollen kunnen niet worden hernoemd.", "Volo.Abp.Identity:010006": "Statische rollen kunnen niet worden verwijderd.", - "Volo.Abp.Identity:010001": "U kunt uw eigen account niet verwijderen!", + "Volo.Abp.Identity:010007": "U kunt uw instelling voor tweefactor authenticatie niet wijzigen.", + "Volo.Abp.Identity:010008": "Het is niet toegestaan om de instelling van tweefactor authenticatie te wijzigen.", + "Identity.OrganizationUnit.MaxUserMembershipCount": "Maximaal toegestande aantal lidmaatschappen van organisatie-eenheden voor een gebruiker", "Permission:IdentityManagement": "Identiteitsbeheer", "Permission:RoleManagement": "Rolbeheer", "Permission:Create": "Maak aan", @@ -72,6 +78,12 @@ "Permission:ChangePermissions": "Wijzig de rechten", "Permission:UserManagement": "Gebruikersbeheer", "Permission:UserLookup": "Gebruiker opzoeken", + "Feature:IdentityGroup": "Identiteit", + "Feature:TwoFactor": "Tweefactor authenticatie gedrag", + "Feature:TwoFactorDescription": "Stel tweefactor authenticatie gedrag in. Mogelijke waardes: Optioneel,Uitgeschakeld,Afgedwongen", + "Feature:TwoFactor.Optional": "Optioneel", + "Feature:TwoFactor.Disabled": "Uitgeschakeld", + "Feature:TwoFactor.Forced": "Afgedwongen", "DisplayName:Abp.Identity.Password.RequiredLength": "Vereiste lengte", "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "Vereist aantal unieke tekens", "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "Vereist niet-alfanumeriek teken", @@ -99,6 +111,10 @@ "Description:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "Of het telefoonnummer kan worden bevestigd door de gebruiker.", "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "Of een bevestigd telefoonnummer vereist is om in te loggen.", "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "Of de gebruikersnaam kan worden bijgewerkt door de gebruiker.", - "Description:Abp.Identity.User.IsEmailUpdateEnabled": "Of de e-mail door de gebruiker kan worden veranderd." + "Description:Abp.Identity.User.IsEmailUpdateEnabled": "Of de e-mail door de gebruiker kan worden veranderd.", + "DisplayName:Abp.Identity.TwoFactorBehaviour": "Tweefactor authenticatie gedrag", + "Description:Abp.Identity.TwoFactorBehaviour": "Tweefactor authenticatie gedrag", + "DisplayName:Abp.Identity.UsersCanChange": "Sta gebruikers toe hun Tweefactor authenticatie te wijzigen.", + "Description:Abp.Identity.UsersCanChange": "Sta gebruikers toe hun Tweefactor authenticatie te wijzigen." } -} +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs index f71f8f76e9..cb1ffc9d8a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs @@ -1,17 +1,50 @@ using System; -using System.Collections; using System.Linq; using System.Collections.Generic; using System.Globalization; +using System.Resources; using Microsoft.Extensions.Localization; +using Volo.Abp; using Volo.Abp.Identity; -using Volo.Abp.Localization; using Volo.Abp.Text.Formatting; namespace Microsoft.AspNetCore.Identity { public static class AbpIdentityResultExtensions { + private static readonly Dictionary IdentityStrings = new Dictionary(); + + static AbpIdentityResultExtensions() + { + var identityResourceManager = new ResourceManager("Microsoft.Extensions.Identity.Core.Resources", typeof(UserManager<>).Assembly); + var resourceSet = identityResourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, false); + if (resourceSet == null) + { + throw new AbpException("Can't get the ResourceSet of Identity."); + } + + var iterator = resourceSet.GetEnumerator(); + while (true) + { + if (!iterator.MoveNext()) + { + break; + } + + var key = iterator.Key?.ToString(); + var value = iterator.Value?.ToString(); + if (key != null && value != null) + { + IdentityStrings.Add(key, value); + } + } + + if (!IdentityStrings.Any()) + { + throw new AbpException("ResourceSet values of Identity is empty."); + } + } + public static void CheckErrors(this IdentityResult identityResult) { if (identityResult.Succeeded) @@ -41,25 +74,19 @@ namespace Microsoft.AspNetCore.Identity } var error = identityResult.Errors.First(); - var key = $"Volo.Abp.Identity:{error.Code}"; + var englishString = IdentityStrings.GetOrDefault(error.Code); - using (CultureHelper.Use(CultureInfo.GetCultureInfo("en"))) + if (englishString == null) { - var englishLocalizedString = localizer[key]; - - if (englishLocalizedString.ResourceNotFound) - { - return Array.Empty(); - } - - if (FormattedStringValueExtracter.IsMatch(error.Description, englishLocalizedString.Value, - out var values)) - { - return values; - } - return Array.Empty(); } + + if (FormattedStringValueExtracter.IsMatch(error.Description, englishString, out var values)) + { + return values; + } + + return Array.Empty(); } public static string LocalizeErrors(this IdentityResult identityResult, IStringLocalizer localizer) @@ -85,16 +112,12 @@ namespace Microsoft.AspNetCore.Identity if (!localizedString.ResourceNotFound) { - using (CultureHelper.Use(CultureInfo.GetCultureInfo("en"))) + var englishString = IdentityStrings.GetOrDefault(error.Code); + if (englishString != null) { - var englishLocalizedString = localizer[key]; - if (!englishLocalizedString.ResourceNotFound) + if (FormattedStringValueExtracter.IsMatch(error.Description, englishString, out var values)) { - if (FormattedStringValueExtracter.IsMatch(error.Description, englishLocalizedString.Value, - out var values)) - { - return string.Format(localizedString.Value, values.Cast().ToArray()); - } + return string.Format(localizedString.Value, values.Cast().ToArray()); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs index 9831b03d5d..2543e846e6 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs @@ -10,21 +10,29 @@ using Volo.Abp.Uow; namespace Volo.Abp.Identity { - public class AbpUserClaimsPrincipalFactory : UserClaimsPrincipalFactory, ITransientDependency + public class AbpUserClaimsPrincipalFactory : UserClaimsPrincipalFactory, + ITransientDependency { + protected ICurrentPrincipalAccessor CurrentPrincipalAccessor { get; } + protected IAbpClaimsPrincipalFactory AbpClaimsPrincipalFactory { get; } + public AbpUserClaimsPrincipalFactory( UserManager userManager, RoleManager roleManager, - IOptions options) + IOptions options, + ICurrentPrincipalAccessor currentPrincipalAccessor, + IAbpClaimsPrincipalFactory abpClaimsPrincipalFactory) : base( - userManager, - roleManager, - options) + userManager, + roleManager, + options) { + CurrentPrincipalAccessor = currentPrincipalAccessor; + AbpClaimsPrincipalFactory = abpClaimsPrincipalFactory; } [UnitOfWork] - public async override Task CreateAsync(IdentityUser user) + public override async Task CreateAsync(IdentityUser user) { var principal = await base.CreateAsync(user); var identity = principal.Identities.First(); @@ -49,7 +57,8 @@ namespace Volo.Abp.Identity identity.AddIfNotContains(new Claim(AbpClaimTypes.PhoneNumber, user.PhoneNumber)); } - identity.AddIfNotContains(new Claim(AbpClaimTypes.PhoneNumberVerified, user.PhoneNumberConfirmed.ToString())); + identity.AddIfNotContains( + new Claim(AbpClaimTypes.PhoneNumberVerified, user.PhoneNumberConfirmed.ToString())); if (!user.Email.IsNullOrWhiteSpace()) { @@ -58,6 +67,15 @@ namespace Volo.Abp.Identity identity.AddIfNotContains(new Claim(AbpClaimTypes.EmailVerified, user.EmailConfirmed.ToString())); + using (CurrentPrincipalAccessor.Change(identity)) + { + var abpClaimsPrincipal = await AbpClaimsPrincipalFactory.CreateAsync(); + foreach (var claim in abpClaimsPrincipal.Claims) + { + identity.AddIfNotContains(claim); + } + } + return principal; } } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs index 91915cd9b8..c985680455 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EFCoreIdentitySecurityLogRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -54,7 +54,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .ToListAsync(cancellationToken); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( DateTime? startTime = null, DateTime? endTime = null, string applicationName = null, @@ -84,7 +84,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await query.LongCountAsync(cancellationToken); } - public async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, CancellationToken cancellationToken = default) + public virtual async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .OrderBy(x => x.Id) diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs index 4cbdfb5725..f634050b23 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs @@ -47,7 +47,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return identityClaimTypes; } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs index 6920d1081e..c7e81f327e 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityLinkUserRepository.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore } - public async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .OrderBy(x => x.Id).FirstOrDefaultAsync(x => @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore , cancellationToken: GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where(x => diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs index b1389afd6a..aed6ed2232 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs @@ -64,7 +64,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs index 8fcce7c35a..57b625a816 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs @@ -231,7 +231,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await query.ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetUsersInOrganizationsListAsync( + public virtual async Task> GetUsersInOrganizationsListAsync( List organizationUnitIds, CancellationToken cancellationToken = default ) diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs index a533ce6340..4e43721a80 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs @@ -152,18 +152,21 @@ namespace Volo.Abp.Identity.EntityFrameworkCore b.HasIndex(uc => uc.RoleId); }); - builder.Entity(b => + if (builder.IsHostDatabase()) { - b.ToTable(options.TablePrefix + "ClaimTypes", options.Schema); + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "ClaimTypes", options.Schema); - b.ConfigureByConvention(); + b.ConfigureByConvention(); - b.Property(uc => uc.Name).HasMaxLength(IdentityClaimTypeConsts.MaxNameLength) - .IsRequired(); // make unique - b.Property(uc => uc.Regex).HasMaxLength(IdentityClaimTypeConsts.MaxRegexLength); - b.Property(uc => uc.RegexDescription).HasMaxLength(IdentityClaimTypeConsts.MaxRegexDescriptionLength); - b.Property(uc => uc.Description).HasMaxLength(IdentityClaimTypeConsts.MaxDescriptionLength); - }); + b.Property(uc => uc.Name).HasMaxLength(IdentityClaimTypeConsts.MaxNameLength) + .IsRequired(); // make unique + b.Property(uc => uc.Regex).HasMaxLength(IdentityClaimTypeConsts.MaxRegexLength); + b.Property(uc => uc.RegexDescription).HasMaxLength(IdentityClaimTypeConsts.MaxRegexDescriptionLength); + b.Property(uc => uc.Description).HasMaxLength(IdentityClaimTypeConsts.MaxDescriptionLength); + }); + } builder.Entity(b => { @@ -233,22 +236,23 @@ namespace Volo.Abp.Identity.EntityFrameworkCore b.HasIndex(x => new { x.TenantId, x.UserId }); }); - builder.Entity(b => + if (builder.IsHostDatabase()) { - b.ToTable(options.TablePrefix + "LinkUsers", options.Schema); - - b.ConfigureByConvention(); - - b.HasIndex(x => new + builder.Entity(b => { - UserId = x.SourceUserId, - TenantId = x.SourceTenantId, - LinkedUserId = x.TargetUserId, - LinkedTenantId = x.TargetTenantId - }).IsUnique(); - }); - - + b.ToTable(options.TablePrefix + "LinkUsers", options.Schema); + + b.ConfigureByConvention(); + + b.HasIndex(x => new + { + UserId = x.SourceUserId, + TenantId = x.SourceTenantId, + LinkedUserId = x.TargetUserId, + LinkedTenantId = x.TargetTenantId + }).IsUnique(); + }); + } } } } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs index 6795735793..3ad208efc0 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs @@ -55,7 +55,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs index 43bad94271..e670759e5c 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityLinkUserRepository.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Identity.MongoDB { } - public async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task FindAsync(IdentityLinkUserInfo sourceLinkUserInfo, IdentityLinkUserInfo targetLinkUserInfo, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .OrderBy(x => x.Id).FirstOrDefaultAsync(x => @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.MongoDB , cancellationToken: GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(IdentityLinkUserInfo linkUserInfo, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.SourceUserId == linkUserInfo.UserId && x.SourceTenantId == linkUserInfo.TenantId || diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs index 0731008f57..f4b5049b16 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity.MongoDB { } - public async Task FindByNormalizedNameAsync( + public virtual async Task FindByNormalizedNameAsync( string normalizedRoleName, bool includeDetails = true, CancellationToken cancellationToken = default) @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity.MongoDB .FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, @@ -64,7 +64,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( string filter = null, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs index a0a8b9b103..1ac54cfc82 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Identity.MongoDB { } - public async Task> GetListAsync( + public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = 50, int skipCount = 0, @@ -44,7 +44,8 @@ namespace Volo.Abp.Identity.MongoDB userId, userName, clientId, - correlationId + correlationId, + cancellationToken ); return await query.OrderBy(sorting ?? nameof(IdentitySecurityLog.CreationTime) + " desc") @@ -53,7 +54,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync( + public virtual async Task GetCountAsync( DateTime? startTime = null, DateTime? endTime = null, string applicationName = null, @@ -74,7 +75,8 @@ namespace Volo.Abp.Identity.MongoDB userId, userName, clientId, - correlationId + correlationId, + cancellationToken ); return await query.As>() @@ -82,7 +84,7 @@ namespace Volo.Abp.Identity.MongoDB } - public async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, + public virtual async Task GetByUserIdAsync(Guid id, Guid userId, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).OrderBy(x => x.Id).FirstOrDefaultAsync(x => x.Id == id && x.UserId == userId, @@ -98,9 +100,10 @@ namespace Volo.Abp.Identity.MongoDB Guid? userId = null, string userName = null, string clientId = null, - string correlationId = null) + string correlationId = null, + CancellationToken cancellationToken = default) { - return (await GetMongoQueryableAsync()) + return (await GetMongoQueryableAsync(cancellationToken)) .WhereIf(startTime.HasValue, securityLog => securityLog.CreationTime >= startTime.Value) .WhereIf(endTime.HasValue, securityLog => securityLog.CreationTime < endTime.Value.AddDays(1).Date) .WhereIf(!applicationName.IsNullOrWhiteSpace(), diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index 0864f7b01c..1909b269cc 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -53,7 +53,7 @@ namespace Volo.Abp.Identity.MongoDB return await dbContext.Roles.AsQueryable().Where(r => allRoleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetRoleNamesInOrganizationUnitAsync( + public virtual async Task> GetRoleNamesInOrganizationUnitAsync( Guid id, CancellationToken cancellationToken = default) { @@ -178,7 +178,7 @@ namespace Volo.Abp.Identity.MongoDB return await dbContext.Roles.AsQueryable().Where(r => allRoleIds.Contains(r.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetOrganizationUnitsAsync( + public virtual async Task> GetOrganizationUnitsAsync( Guid id, bool includeDetails = false, CancellationToken cancellationToken = default) @@ -210,7 +210,7 @@ namespace Volo.Abp.Identity.MongoDB .LongCountAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetUsersInOrganizationUnitAsync( + public virtual async Task> GetUsersInOrganizationUnitAsync( Guid organizationUnitId, CancellationToken cancellationToken = default) { @@ -221,7 +221,7 @@ namespace Volo.Abp.Identity.MongoDB return result; } - public async Task> GetUsersInOrganizationsListAsync( + public virtual async Task> GetUsersInOrganizationsListAsync( List organizationUnitIds, CancellationToken cancellationToken = default) { @@ -232,7 +232,7 @@ namespace Volo.Abp.Identity.MongoDB return result; } - public async Task> GetUsersInOrganizationUnitWithChildrenAsync( + public virtual async Task> GetUsersInOrganizationUnitWithChildrenAsync( string code, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs index de0afd8abc..6479bc4be0 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs @@ -112,7 +112,7 @@ namespace Volo.Abp.Identity.MongoDB .CountAsync(cancellationToken); } - public async Task> GetUnaddedRolesAsync( + public virtual async Task> GetUnaddedRolesAsync( OrganizationUnit organizationUnit, string sorting = null, int maxResultCount = int.MaxValue, @@ -132,7 +132,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(cancellationToken); } - public async Task GetUnaddedRolesCountAsync( + public virtual async Task GetUnaddedRolesCountAsync( OrganizationUnit organizationUnit, string filter = null, CancellationToken cancellationToken = default) @@ -174,7 +174,7 @@ namespace Volo.Abp.Identity.MongoDB return await query.CountAsync(cancellationToken); } - public async Task> GetUnaddedUsersAsync( + public virtual async Task> GetUnaddedUsersAsync( OrganizationUnit organizationUnit, string sorting = null, int maxResultCount = int.MaxValue, @@ -199,7 +199,7 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetUnaddedUsersCountAsync(OrganizationUnit organizationUnit, string filter = null, + public virtual async Task GetUnaddedUsersCountAsync(OrganizationUnit organizationUnit, string filter = null, CancellationToken cancellationToken = default) { var dbContext = await GetDbContextAsync(cancellationToken); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj index 1771b68a5c..3413ff430c 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj @@ -19,6 +19,12 @@ + + + + + + diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs index ccfbb85359..a6228a7cd6 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs @@ -2,9 +2,12 @@ using Volo.Abp.Authorization.Permissions; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Identity.EntityFrameworkCore; +using Volo.Abp.Identity.Localization; +using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.Identity; using Volo.Abp.Threading; +using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.Identity { @@ -21,6 +24,18 @@ namespace Volo.Abp.Identity { options.AutoEventSelectors.Add(); }); + + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/Volo/Abp/Identity/LocalizationExtensions"); + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs index cc349fd3f3..306ea16c91 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityResultException_Tests.cs @@ -28,10 +28,18 @@ namespace Volo.Abp.Identity using (CultureHelper.Use("tr")) { var localizeMessage = exception.LocalizeMessage(new LocalizationContext(ServiceProvider)); - + localizeMessage.ShouldContain("Şifre en az 6 karakter uzunluğunda olmalı."); localizeMessage.ShouldContain("Şifre en az bir sayı ya da harf olmayan karakter içermeli."); } + + using (CultureHelper.Use("en")) + { + var localizeMessage = exception.LocalizeMessage(new LocalizationContext(ServiceProvider)); + + localizeMessage.ShouldContain("Password length must be greater than 6 characters."); + localizeMessage.ShouldContain("Password must contain at least one non-alphanumeric character."); + } } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/LocalizationExtensions/en.json b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/LocalizationExtensions/en.json new file mode 100644 index 0000000000..e8f68fb950 --- /dev/null +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/LocalizationExtensions/en.json @@ -0,0 +1,7 @@ +{ + "culture": "en", + "texts": { + "Volo.Abp.Identity:PasswordTooShort": "Password length must be greater than {0} characters.", + "Volo.Abp.Identity:PasswordRequiresNonAlphanumeric": "Password must contain at least one non-alphanumeric character." + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/nl.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/nl.json index 0ae2ba8cd9..9b6943c54f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/nl.json +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/nl.json @@ -3,10 +3,12 @@ "texts": { "Volo.IdentityServer:DuplicateIdentityResourceName": "Identiteitsbronnaam bestaat al: {Name}", "Volo.IdentityServer:DuplicateApiResourceName": "API-bronnaam bestaat al: {Name}", + "Volo.IdentityServer:DuplicateApiScopeName": "Api-scope met naam: '{Name}' bestaat al", "Volo.IdentityServer:DuplicateClientId": "ClientId bestaat al: {ClientId}", "UserLockedOut": "Het gebruikersaccount is geblokkeerd vanwege ongeldige inlogpogingen. Wacht even en probeer het opnieuw.", "InvalidUserNameOrPassword": "ongeldige gebruikersnaam of wachtwoord!", "LoginIsNotAllowed": "U mag niet inloggen! U moet uw e-mailadres / telefoonnummer bevestigen.", - "InvalidUsername": "Ongeldige gebruikersnaam of wachtwoord!" + "InvalidUsername": "Ongeldige gebruikersnaam of wachtwoord!", + "TheTargetUserIsNotLinkedToYou": "De beoogde gebruiker is niet aan jou gekoppeld!" } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs index 3e6a7c76b2..a032ce6824 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs @@ -25,6 +25,15 @@ namespace Volo.Abp.IdentityServer { } + protected override IEnumerable FilterRequestedClaimTypes(IEnumerable claimTypes) + { + return base.FilterRequestedClaimTypes(claimTypes) + .Union(new []{ + AbpClaimTypes.TenantId, + AbpClaimTypes.EditionId + }); + } + protected override IEnumerable GetOptionalClaims(ClaimsPrincipal subject) { return base.GetOptionalClaims(subject) @@ -43,4 +52,4 @@ namespace Volo.Abp.IdentityServer } } } -} +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs index 5d99666183..d1f60bcb7b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/IApiResourceRepository.cs @@ -35,6 +35,11 @@ namespace Volo.Abp.IdentityServer.ApiResources CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task CheckNameExistAsync( string name, Guid? expectedId = null, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs index a0aba8fe2a..a6736bdda6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiScopes/IApiScopeRepository.cs @@ -29,6 +29,11 @@ namespace Volo.Abp.IdentityServer.ApiScopes CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task CheckNameExistAsync( string name, Guid? expectedId = null, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpUserClaimsFactory.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpUserClaimsFactory.cs index e18e6a219b..982e52cfab 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpUserClaimsFactory.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpUserClaimsFactory.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using IdentityModel; using Microsoft.AspNetCore.Identity; using Volo.Abp.DependencyInjection; -using Volo.Abp.Identity; +using Volo.Abp.Security.Claims; using IdentityUser = Volo.Abp.Identity.IdentityUser; namespace Volo.Abp.IdentityServer.AspNetIdentity diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs index 059882eb47..55d15a8c83 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs @@ -24,6 +24,11 @@ namespace Volo.Abp.IdentityServer.Clients CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task> GetAllDistinctAllowedCorsOriginsAsync(CancellationToken cancellationToken = default); Task CheckClientIdExistAsync( diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs index 4dd5472ea9..0ddf31e58e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs @@ -23,6 +23,11 @@ namespace Volo.Abp.IdentityServer.IdentityResources CancellationToken cancellationToken = default ); + Task GetCountAsync( + string filter = null, + CancellationToken cancellationToken = default + ); + Task FindByNameAsync( string name, bool includeDetails = true, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index af155190f3..697050e292 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -88,7 +88,6 @@ namespace Volo.Abp.IdentityServer .ForMember(dest => dest.Type, opt => opt.Condition(srs => srs != null)) .ReverseMap(); - CreateMap(); CreateMap(); } @@ -104,6 +103,9 @@ namespace Volo.Abp.IdentityServer .ReverseMap() .ForMember(dest => dest.Scope, opt => opt.MapFrom(src => src)); + CreateMap>() + .ReverseMap(); + CreateMap(); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index 16a789048d..eb3ecc2884 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -68,6 +68,16 @@ namespace Volo.Abp.IdentityServer.ApiResources .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .WhereIf(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).AnyAsync(ar => ar.Id != expectedId && ar.Name == name, GetCancellationToken(cancellationToken)); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs index 4cece3209e..6bea5a742f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs @@ -48,6 +48,16 @@ namespace Volo.Abp.IdentityServer.ApiScopes .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .WhereIf(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).AnyAsync(x => x.Id != expectedId && x.Name == name, GetCancellationToken(cancellationToken)); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 7607a189ca..9fbbc8195f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -41,6 +41,13 @@ namespace Volo.Abp.IdentityServer.Clients .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetAllDistinctAllowedCorsOriginsAsync(CancellationToken cancellationToken = default) { return await (await GetDbContextAsync()).ClientCorsOrigins diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 75343419a8..41845c432b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -7,9 +7,11 @@ using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.IdentityServer.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public interface IIdentityServerDbContext : IEfCoreDbContext { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index 9bff7f13a1..236c6f8e66 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -7,9 +7,11 @@ using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.IdentityServer.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public class IdentityServerDbContext : AbpDbContext, IIdentityServerDbContext { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 1759ce5855..d3d08dca15 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -19,6 +19,11 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); + if (builder.IsTenantOnlyDatabase()) + { + return; + } + var options = new IdentityServerModelBuilderConfigurationOptions( AbpIdentityServerDbProperties.DbTablePrefix, AbpIdentityServerDbProperties.DbSchema diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs index 1b83b46158..22e68fca31 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs @@ -55,6 +55,16 @@ namespace Volo.Abp.IdentityServer.IdentityResources .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .WhereIf(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task FindByNameAsync( string name, bool includeDetails = true, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index 7db1bba8da..e5f7186440 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -56,6 +56,16 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetMongoQueryableAsync(cancellationToken)) + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs index 69faed9dc3..f1372dd6c0 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs @@ -53,6 +53,16 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetMongoQueryableAsync(cancellationToken)) + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs index bd99461997..22cc7b6388 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs @@ -48,6 +48,14 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetMongoQueryableAsync(cancellationToken)) + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.ClientId.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task> GetAllDistinctAllowedCorsOriginsAsync( CancellationToken cancellationToken = default) { diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs index 84cc5cca0f..f8ccb9dd97 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs @@ -30,6 +30,16 @@ namespace Volo.Abp.IdentityServer.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + { + return await (await GetMongoQueryableAsync(cancellationToken)) + .WhereIf>(!filter.IsNullOrWhiteSpace(), + x => x.Name.Contains(filter) || + x.Description.Contains(filter) || + x.DisplayName.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + public virtual async Task FindByNameAsync( string name, bool includeDetails = true, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs index 2d4728a7e1..9dd4f24af6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.IdentityServer.MongoDB public async Task> GetListAsync(string subjectId, string sessionId, string clientId, string type, bool includeDetails = false, CancellationToken cancellationToken = default) { - return await (await FilterAsync(subjectId, sessionId, clientId, type)) + return await (await FilterAsync(subjectId, sessionId, clientId, type, cancellationToken)) .ToListAsync(GetCancellationToken(cancellationToken)); } @@ -57,7 +57,7 @@ namespace Volo.Abp.IdentityServer.MongoDB string type = null, CancellationToken cancellationToken = default) { - var persistedGrants = await (await FilterAsync(subjectId, sessionId, clientId, type)) + var persistedGrants = await (await FilterAsync(subjectId, sessionId, clientId, type, cancellationToken)) .ToListAsync(GetCancellationToken(cancellationToken)); foreach (var persistedGrant in persistedGrants) @@ -86,9 +86,10 @@ namespace Volo.Abp.IdentityServer.MongoDB string subjectId, string sessionId, string clientId, - string type) + string type, + CancellationToken cancellationToken = default) { - return (await GetMongoQueryableAsync()) + return (await GetMongoQueryableAsync(cancellationToken)) .WhereIf>(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId) .WhereIf>(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) .WhereIf>(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId) diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs deleted file mode 100644 index 4b16d7de65..0000000000 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System.Threading.Tasks; -using IdentityServer4.Models; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Guids; -using Volo.Abp.IdentityServer.ApiResources; -using Volo.Abp.IdentityServer.ApiScopes; -using Volo.Abp.IdentityServer.Clients; -using Volo.Abp.IdentityServer.Grants; -using Volo.Abp.IdentityServer.IdentityResources; -using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; -using ApiScope = Volo.Abp.IdentityServer.ApiScopes.ApiScope; -using Client = Volo.Abp.IdentityServer.Clients.Client; -using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; -using PersistedGrant = Volo.Abp.IdentityServer.Grants.PersistedGrant; - -namespace Volo.Abp.IdentityServer -{ - //TODO: There are two data builders (see AbpIdentityServerTestDataBuilder in Volo.Abp.IdentityServer.TestBase). It should be somehow unified! - - public class AbpIdentityServerTestDataBuilder : ITransientDependency - { - private readonly IGuidGenerator _guidGenerator; - private readonly IClientRepository _clientRepository; - private readonly IPersistentGrantRepository _persistentGrantRepository; - private readonly IApiResourceRepository _apiResourceRepository; - private readonly IApiScopeRepository _apiScopeRepository; - private readonly IIdentityResourceRepository _identityResourceRepository; - - public AbpIdentityServerTestDataBuilder( - IClientRepository clientRepository, - IGuidGenerator guidGenerator, - IPersistentGrantRepository persistentGrantRepository, - IApiResourceRepository apiResourceRepository, - IIdentityResourceRepository identityResourceRepository, - IApiScopeRepository apiScopeRepository) - { - _clientRepository = clientRepository; - _guidGenerator = guidGenerator; - _persistentGrantRepository = persistentGrantRepository; - _apiResourceRepository = apiResourceRepository; - _identityResourceRepository = identityResourceRepository; - _apiScopeRepository = apiScopeRepository; - } - - public async Task BuildAsync() - { - await AddApiResources(); - await AddApiScopes(); - await AddIdentityResources(); - await AddClients(); - await AddPersistentGrants(); - } - - private async Task AddApiResources() - { - var apiResource = new ApiResource(_guidGenerator.Create(), "Test-ApiResource-Name-1") - { - Enabled = true, - Description = "Test-ApiResource-Description-1", - DisplayName = "Test-ApiResource-DisplayName-1" - }; - - apiResource.AddSecret("secret".Sha256()); - apiResource.AddScope("Test-ApiResource-ApiScope-Name-1"); - apiResource.AddScope("Test-ApiResource-ApiScope-DisplayName-1"); - apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1"); - - await _apiResourceRepository.InsertAsync(apiResource); - } - - private async Task AddApiScopes() - { - var apiScope = new ApiScope(_guidGenerator.Create(), "Test-ApiScope-Name-1"); - - apiScope.AddUserClaim("Test-ApiScope-Claim-Type-1"); - await _apiScopeRepository.InsertAsync(apiScope); - } - - private async Task AddIdentityResources() - { - var identityResource = new IdentityResource(_guidGenerator.Create(), "Test-Identity-Resource-Name-1") - { - Description = "Test-Identity-Resource-Description-1", - DisplayName = "Test-Identity-Resource-DisplayName-1", - Required = true, - Emphasize = true - }; - - identityResource.AddUserClaim("Test-Identity-Resource-1-IdentityClaim-Type-1"); - - await _identityResourceRepository.InsertAsync(identityResource); - } - - private async Task AddClients() - { - var client42 = new Client(_guidGenerator.Create(), "42") - { - ProtocolType = "TestProtocol-42" - }; - - client42.AddCorsOrigin("Origin1"); - - client42.AddScope("Test-ApiScope-Name-1"); - - await _clientRepository.InsertAsync(client42); - } - - private async Task AddPersistentGrants() - { - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) - { - Key = "38", - ClientId = "TestClientId-38", - Type = "TestType-38", - SubjectId = "TestSubject", - Data = "TestData-38" - }); - - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) - { - Key = "37", - ClientId = "TestClientId-37", - Type = "TestType-37", - SubjectId = "TestSubject", - Data = "TestData-37" - }); - - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) - { - Key = "36", - ClientId = "TestClientId-X", - Type = "TestType-36", - SubjectId = "TestSubject-X", - Data = "TestData-36" - }); - - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) - { - Key = "35", - ClientId = "TestClientId-X", - Type = "TestType-35", - SubjectId = "TestSubject-X", - Data = "TestData-35" - }); - } - - } -} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestEntityFrameworkCoreModule.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestEntityFrameworkCoreModule.cs index 5abc8ad2a2..0c3dd27e53 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestEntityFrameworkCoreModule.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestEntityFrameworkCoreModule.cs @@ -1,4 +1,4 @@ -using Microsoft.Data.Sqlite; +using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; @@ -33,11 +33,6 @@ namespace Volo.Abp.IdentityServer }); } - public override void OnApplicationInitialization(ApplicationInitializationContext context) - { - SeedTestData(context); - } - private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); @@ -53,15 +48,5 @@ namespace Volo.Abp.IdentityServer return connection; } - - private static void SeedTestData(ApplicationInitializationContext context) - { - using (var scope = context.ServiceProvider.CreateScope()) - { - AsyncHelper.RunSync(() => scope.ServiceProvider - .GetRequiredService() - .BuildAsync()); - } - } } -} \ No newline at end of file +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index 436bef1246..721caa1a7f 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; @@ -11,6 +10,13 @@ using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.Timing; +using IdentityServer4.Models; +using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; +using ApiScope = Volo.Abp.IdentityServer.ApiScopes.ApiScope; +using Client = Volo.Abp.IdentityServer.Clients.Client; +using ClientClaim = Volo.Abp.IdentityServer.Clients.ClientClaim; +using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; +using PersistedGrant = Volo.Abp.IdentityServer.Grants.PersistedGrant; namespace Volo.Abp.IdentityServer { @@ -18,6 +24,7 @@ namespace Volo.Abp.IdentityServer { private readonly IGuidGenerator _guidGenerator; private readonly IApiResourceRepository _apiResourceRepository; + private readonly IApiScopeRepository _apiScopeRepository; private readonly IClientRepository _clientRepository; private readonly IIdentityResourceRepository _identityResourceRepository; private readonly IIdentityClaimTypeRepository _identityClaimTypeRepository; @@ -29,6 +36,7 @@ namespace Volo.Abp.IdentityServer public AbpIdentityServerTestDataBuilder( IGuidGenerator guidGenerator, IApiResourceRepository apiResourceRepository, + IApiScopeRepository apiScopeRepository, IClientRepository clientRepository, IIdentityResourceRepository identityResourceRepository, IIdentityClaimTypeRepository identityClaimTypeRepository, @@ -40,125 +48,91 @@ namespace Volo.Abp.IdentityServer _testData = testData; _guidGenerator = guidGenerator; _apiResourceRepository = apiResourceRepository; + _apiScopeRepository = apiScopeRepository; _clientRepository = clientRepository; _identityResourceRepository = identityResourceRepository; _identityClaimTypeRepository = identityClaimTypeRepository; _persistentGrantRepository = persistentGrantRepository; - _clock = clock; _deviceFlowCodesRepository = deviceFlowCodesRepository; + _clock = clock; } public async Task BuildAsync() { - await AddDeviceFlowCodes(); - await AddPersistedGrants(); - await AddIdentityResources(); + await AddApiScopes(); await AddApiResources(); + await AddIdentityResources(); await AddClients(); + await AddPersistentGrants(); + await AddDeviceFlowCodes(); + await AddPersistedGrants(); await AddClaimTypes(); } - private async Task AddDeviceFlowCodes() + private async Task AddApiScopes() { - await _deviceFlowCodesRepository.InsertAsync( - new DeviceFlowCodes(_guidGenerator.Create()) - { - ClientId = "c1", - DeviceCode = "DeviceCode1", - Expiration = _clock.Now.AddDays(1), - Data = "{\"Lifetime\":\"42\"}", - UserCode = "DeviceFlowCodesUserCode1", - SubjectId = "DeviceFlowCodesSubjectId1" - } - ); - - await _deviceFlowCodesRepository.InsertAsync( - new DeviceFlowCodes(_guidGenerator.Create()) - { - ClientId = "c1", - DeviceCode = "DeviceCode2", - Expiration = _clock.Now.AddDays(-1), - Data = "", - UserCode = "DeviceFlowCodesUserCode2", - SubjectId = "DeviceFlowCodesSubjectId2" - } - ); + var apiScope = new ApiScope(_guidGenerator.Create(), "Test-ApiScope-Name-1"); + apiScope.AddUserClaim("Test-ApiScope-Claim-Type-1"); + await _apiScopeRepository.InsertAsync(apiScope); } - private async Task AddPersistedGrants() + private async Task AddApiResources() { - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) - { - Key = "PersistedGrantKey1", - SubjectId = "PersistedGrantSubjectId1", - SessionId = "PersistedGrantSessionId1", - ClientId = "PersistedGrantClientId1", - Type = "PersistedGrantType1", - Data = "" - }); + var apiResource = new ApiResource(_testData.ApiResource1Id, "NewApiResource1"); + apiResource.Description = nameof(apiResource.Description); + apiResource.DisplayName = nameof(apiResource.DisplayName); - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) - { - Key = "PersistedGrantKey2", - SubjectId = "PersistedGrantSubjectId2", - ClientId = "c1", - Type = "c1type", - Data = "" - }); + apiResource.AddScope(nameof(ApiResourceScope.Scope)); + apiResource.AddUserClaim(nameof(ApiResourceClaim.Type)); + apiResource.AddSecret(nameof(ApiResourceSecret.Value)); - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) - { - Key = "PersistedGrantKey3", - SubjectId = "PersistedGrantSubjectId3", - ClientId = "c1", - Type = "c1type", - Data = "", - Expiration = _clock.Now.AddDays(1), - }); + await _apiResourceRepository.InsertAsync(apiResource); + await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2")); + await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource3")); - await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + var apiResource2 = new ApiResource(_guidGenerator.Create(), "Test-ApiResource-Name-1") { - Key = "PersistedGrantKey_Expired1", - SubjectId = "PersistedGrantSubjectId_Expired1", - ClientId = "c1", - Type = "c1type", - Data = "", - Expiration = _clock.Now.AddDays(-1) - }); + Enabled = true, + Description = "Test-ApiResource-Description-1", + DisplayName = "Test-ApiResource-DisplayName-1" + }; + + apiResource2.AddSecret("secret".Sha256()); + apiResource2.AddScope("Test-ApiResource-ApiScope-Name-1"); + apiResource2.AddScope("Test-ApiResource-ApiScope-DisplayName-1"); + apiResource2.AddUserClaim("Test-ApiResource-Claim-Type-1"); + + await _apiResourceRepository.InsertAsync(apiResource2); } private async Task AddIdentityResources() { - var identityResource = new IdentityResource(_testData.IdentityResource1Id, "NewIdentityResource1") + var identityResource1 = new IdentityResource(_testData.IdentityResource1Id, "NewIdentityResource1") { Description = nameof(Client.Description), DisplayName = nameof(IdentityResource.DisplayName) }; - identityResource.AddUserClaim(nameof(ApiResourceClaim.Type)); + identityResource1.AddUserClaim(nameof(ApiResourceClaim.Type)); - await _identityResourceRepository.InsertAsync(identityResource); + await _identityResourceRepository.InsertAsync(identityResource1); await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource2")); await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource3")); - } - private async Task AddApiResources() - { - var apiResource = new ApiResource(_testData.ApiResource1Id, "NewApiResource1"); - apiResource.Description = nameof(apiResource.Description); - apiResource.DisplayName = nameof(apiResource.DisplayName); - - apiResource.AddScope(nameof(ApiResourceScope.Scope)); - apiResource.AddUserClaim(nameof(ApiResourceClaim.Type)); - apiResource.AddSecret(nameof(ApiResourceSecret.Value)); + var identityResource2 = new IdentityResource(_guidGenerator.Create(), "Test-Identity-Resource-Name-1") + { + Description = "Test-Identity-Resource-Description-1", + DisplayName = "Test-Identity-Resource-DisplayName-1", + Required = true, + Emphasize = true + }; - await _apiResourceRepository.InsertAsync(apiResource); - await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2")); - await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource3")); + identityResource2.AddUserClaim("Test-Identity-Resource-1-IdentityClaim-Type-1"); + await _identityResourceRepository.InsertAsync(identityResource2); } - private async Task AddClients() + private async Task AddClients() { var client = new Client(_testData.Client1Id, "ClientId1") { @@ -184,6 +158,125 @@ namespace Volo.Abp.IdentityServer await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId2")); await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId3")); + + + var client42 = new Client(_guidGenerator.Create(), "42") + { + ProtocolType = "TestProtocol-42" + }; + + client42.AddCorsOrigin("Origin1"); + client42.AddScope("Test-ApiScope-Name-1"); + await _clientRepository.InsertAsync(client42); + } + + private async Task AddPersistentGrants() + { + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "38", + ClientId = "TestClientId-38", + Type = "TestType-38", + SubjectId = "TestSubject", + Data = "TestData-38" + }); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "37", + ClientId = "TestClientId-37", + Type = "TestType-37", + SubjectId = "TestSubject", + Data = "TestData-37" + }); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "36", + ClientId = "TestClientId-X", + Type = "TestType-36", + SubjectId = "TestSubject-X", + Data = "TestData-36" + }); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "35", + ClientId = "TestClientId-X", + Type = "TestType-35", + SubjectId = "TestSubject-X", + Data = "TestData-35" + }); + } + + private async Task AddPersistedGrants() + { + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "PersistedGrantKey1", + SubjectId = "PersistedGrantSubjectId1", + SessionId = "PersistedGrantSessionId1", + ClientId = "PersistedGrantClientId1", + Type = "PersistedGrantType1", + Data = "" + }); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "PersistedGrantKey2", + SubjectId = "PersistedGrantSubjectId2", + ClientId = "c1", + Type = "c1type", + Data = "" + }); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "PersistedGrantKey3", + SubjectId = "PersistedGrantSubjectId3", + ClientId = "c1", + Type = "c1type", + Data = "", + Expiration = _clock.Now.AddDays(1), + }); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "PersistedGrantKey_Expired1", + SubjectId = "PersistedGrantSubjectId_Expired1", + ClientId = "c1", + Type = "c1type", + Data = "", + Expiration = _clock.Now.AddDays(-1) + }); + } + + private async Task AddDeviceFlowCodes() + { + await _deviceFlowCodesRepository.InsertAsync( + new DeviceFlowCodes(_guidGenerator.Create()) + { + ClientId = "c1", + DeviceCode = "DeviceCode1", + Expiration = _clock.Now.AddDays(1), + Data = "{\"Lifetime\":\"42\"}", + UserCode = "DeviceFlowCodesUserCode1", + SubjectId = "DeviceFlowCodesSubjectId1" + } + ); + + await _deviceFlowCodesRepository.InsertAsync( + new DeviceFlowCodes(_guidGenerator.Create()) + { + ClientId = "c1", + DeviceCode = "DeviceCode2", + Expiration = _clock.Now.AddDays(-1), + Data = "", + UserCode = "DeviceFlowCodesUserCode2", + SubjectId = "DeviceFlowCodesSubjectId2" + } + ); + } private async Task AddClaimTypes() diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/ISettingRepository.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/ISettingRepository.cs index a1e40f3a14..ee8cfa64a8 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/ISettingRepository.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/ISettingRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -7,10 +8,21 @@ namespace Volo.Abp.SettingManagement { public interface ISettingRepository : IBasicRepository { - Task FindAsync(string name, string providerName, string providerKey); + Task FindAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default); - Task> GetListAsync(string providerName, string providerKey); + Task> GetListAsync( + string providerName, + string providerKey, + CancellationToken cancellationToken = default); - Task> GetListAsync(string[] names, string providerName, string providerKey); + Task> GetListAsync( + string[] names, + string providerName, + string providerKey, + CancellationToken cancellationToken = default); } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs index e90d2fc63a..4bab46315a 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; @@ -8,36 +9,48 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.SettingManagement.EntityFrameworkCore { - public class EfCoreSettingRepository : EfCoreRepository, ISettingRepository + public class EfCoreSettingRepository : EfCoreRepository, + ISettingRepository { public EfCoreSettingRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } - public virtual async Task FindAsync(string name, string providerName, string providerKey) + public virtual async Task FindAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .OrderBy(x => x.Id) .FirstOrDefaultAsync( - s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey - ); + s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, + GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListAsync(string providerName, string providerKey) + public virtual async Task> GetListAsync( + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where( s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(); + ).ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListAsync(string[] names, string providerName, string providerKey) + public virtual async Task> GetListAsync( + string[] names, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where( s => names.Contains(s.Name) && s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(); + ).ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs index fea486a163..eca448f732 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs @@ -1,12 +1,14 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.SettingManagement.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public interface ISettingManagementDbContext : IEfCoreDbContext { DbSet Settings { get; set; } } -} \ No newline at end of file +} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs index e85bcd21cc..23a9773912 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs @@ -1,9 +1,11 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.SettingManagement.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public class SettingManagementDbContext : AbpDbContext, ISettingManagementDbContext { diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs index 6f0bd5c3f8..0758cc9957 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs @@ -27,6 +27,11 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); + if (builder.IsTenantOnlyDatabase()) + { + return; + } + var options = new SettingManagementModelBuilderConfigurationOptions( AbpSettingManagementDbProperties.DbTablePrefix, AbpSettingManagementDbProperties.DbSchema @@ -44,7 +49,7 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore if (builder.IsUsingOracle()) { SettingConsts.MaxValueLengthValue = 2000; } b.Property(x => x.Value).HasMaxLength(SettingConsts.MaxValueLengthValue).IsRequired(); - + b.Property(x => x.ProviderName).HasMaxLength(SettingConsts.MaxProviderNameLength); b.Property(x => x.ProviderKey).HasMaxLength(SettingConsts.MaxProviderKeyLength); @@ -52,4 +57,4 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore }); } } -} \ No newline at end of file +} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs index 357ab0bfe3..609e940b63 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs @@ -1,12 +1,14 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.SettingManagement.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public interface ISettingManagementMongoDbContext : IAbpMongoDbContext { IMongoCollection Settings { get; } } -} \ No newline at end of file +} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs index e81e76dfcc..aef9624a4d 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; @@ -9,33 +10,46 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.SettingManagement.MongoDB { - public class MongoSettingRepository : MongoDbRepository, ISettingRepository + public class MongoSettingRepository : MongoDbRepository, + ISettingRepository { public MongoSettingRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) { - } - public virtual async Task FindAsync(string name, string providerName, string providerKey) + public virtual async Task FindAsync( + string name, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(cancellationToken)) .OrderBy(x => x.Id) - .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey); + .FirstOrDefaultAsync( + s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, + GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListAsync(string providerName, string providerKey) + public virtual async Task> GetListAsync( + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(cancellationToken)) .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task> GetListAsync(string[] names, string providerName, string providerKey) + public virtual async Task> GetListAsync( + string[] names, + string providerName, + string providerKey, + CancellationToken cancellationToken = default) { - return await (await GetMongoQueryableAsync()) + return await (await GetMongoQueryableAsync(cancellationToken)) .Where(s => names.Contains(s.Name) && s.ProviderName == providerName && s.ProviderKey == providerKey) - .ToListAsync(); + .ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs index ada3a8100f..003e1a4b46 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs @@ -1,9 +1,11 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.SettingManagement.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public class SettingManagementMongoDbContext : AbpMongoDbContext, ISettingManagementMongoDbContext { @@ -16,4 +18,4 @@ namespace Volo.Abp.SettingManagement.MongoDB modelBuilder.ConfigureSettingManagement(); } } -} \ No newline at end of file +} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/nl.json b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/nl.json index 1aeb208560..d4c45b8aad 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/nl.json +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/nl.json @@ -10,6 +10,7 @@ "ConnectionStrings": "Connection Strings", "DisplayName:DefaultConnectionString": "Standaard Connection String", "DisplayName:UseSharedDatabase": "Gebruik de gedeelde database", + "ManageHostFeatures": "Beheer host functies", "Permission:TenantManagement": "Klanten beheer", "Permission:Create": "Maak aan", "Permission:Edit": "Bewerk", diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/tr.json b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/tr.json index 7315cccc3f..a2e4ee5257 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/tr.json +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/tr.json @@ -10,7 +10,7 @@ "ConnectionStrings": "Bağlantı cümlesi", "DisplayName:DefaultConnectionString": "Varsayılan bağlantı cümlesi", "DisplayName:UseSharedDatabase": "Paylaşılan veritabanını kullan", - "ManageHostFeatures": "Toplantı Sahibi özelliklerini yönetin", + "ManageHostFeatures": "Host özelliklerini yönetin", "Permission:TenantManagement": "Müşteri yönetimi", "Permission:Create": "Oluşturma", "Permission:Edit": "Düzenleme", diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj index dc168af444..5de64b7a1d 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj @@ -21,6 +21,7 @@ + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs index 764e9f7209..076c8b7a67 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AutoMapper; +using Volo.Abp.Caching; using Volo.Abp.Data; using Volo.Abp.Domain; using Volo.Abp.Domain.Entities.Events.Distributed; @@ -16,6 +17,7 @@ namespace Volo.Abp.TenantManagement [DependsOn(typeof(AbpDataModule))] [DependsOn(typeof(AbpDddDomainModule))] [DependsOn(typeof(AbpAutoMapperModule))] + [DependsOn(typeof(AbpCachingModule))] public class AbpTenantManagementDomainModule : AbpModule { private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantCacheItem.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantCacheItem.cs new file mode 100644 index 0000000000..94f898bbe5 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantCacheItem.cs @@ -0,0 +1,36 @@ +using System; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.TenantManagement +{ + [Serializable] + [IgnoreMultiTenancy] + public class TenantCacheItem + { + private const string CacheKeyFormat = "i:{0},n:{1}"; + + public TenantConfiguration Value { get; set; } + + public TenantCacheItem() + { + + } + + public TenantCacheItem(TenantConfiguration value) + { + Value = value; + } + + public static string CalculateCacheKey(Guid? id, string name) + { + if (id == null && name.IsNullOrWhiteSpace()) + { + throw new AbpException("Both id and name can't be invalid."); + } + + return string.Format(CacheKeyFormat, + id?.ToString() ?? "null", + (name.IsNullOrWhiteSpace() ? "null" : name)); + } + } +} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantCacheItemInvalidator.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantCacheItemInvalidator.cs new file mode 100644 index 0000000000..0416dd8df2 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantCacheItemInvalidator.cs @@ -0,0 +1,24 @@ +using System.Threading.Tasks; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; + +namespace Volo.Abp.TenantManagement +{ + public class TenantCacheItemInvalidator : ILocalEventHandler>, ITransientDependency + { + protected IDistributedCache Cache { get; } + + public TenantCacheItemInvalidator(IDistributedCache cache) + { + Cache = cache; + } + + public virtual async Task HandleEventAsync(EntityChangedEventData eventData) + { + await Cache.RemoveAsync(TenantCacheItem.CalculateCacheKey(eventData.Entity.Id, null)); + await Cache.RemoveAsync(TenantCacheItem.CalculateCacheKey(null, eventData.Entity.Name)); + } + } +} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs index 00b9ef0963..e43e8a86fa 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs @@ -1,85 +1,137 @@ using System; using System.Threading.Tasks; +using JetBrains.Annotations; +using Volo.Abp.Caching; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; namespace Volo.Abp.TenantManagement { - //TODO: This class should use caching instead of querying everytime! - public class TenantStore : ITenantStore, ITransientDependency { protected ITenantRepository TenantRepository { get; } protected IObjectMapper ObjectMapper { get; } protected ICurrentTenant CurrentTenant { get; } + protected IDistributedCache Cache { get; } public TenantStore( ITenantRepository tenantRepository, IObjectMapper objectMapper, - ICurrentTenant currentTenant) + ICurrentTenant currentTenant, + IDistributedCache cache) { TenantRepository = tenantRepository; ObjectMapper = objectMapper; CurrentTenant = currentTenant; + Cache = cache; } public virtual async Task FindAsync(string name) { - using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! - { - var tenant = await TenantRepository.FindByNameAsync(name); - if (tenant == null) - { - return null; - } - - return ObjectMapper.Map(tenant); - } + return (await GetCacheItemAsync(null, name)).Value; } public virtual async Task FindAsync(Guid id) { - using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! - { - var tenant = await TenantRepository.FindAsync(id); - if (tenant == null) - { - return null; - } - - return ObjectMapper.Map(tenant); - } + return (await GetCacheItemAsync(id, null)).Value; } [Obsolete("Use FindAsync method.")] public virtual TenantConfiguration Find(string name) { - using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! + return (GetCacheItem(null, name)).Value; + } + + [Obsolete("Use FindAsync method.")] + public virtual TenantConfiguration Find(Guid id) + { + return (GetCacheItem(id, null)).Value; + } + + protected virtual async Task GetCacheItemAsync(Guid? id, string name) + { + var cacheKey = CalculateCacheKey(id, name); + + var cacheItem = await Cache.GetAsync(cacheKey, considerUow: true); + if (cacheItem != null) + { + return cacheItem; + } + + if (id.HasValue) { - var tenant = TenantRepository.FindByName(name); - if (tenant == null) + using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { - return null; + var tenant = await TenantRepository.FindAsync(id.Value); + return await SetCacheAsync(cacheKey, tenant); } + } - return ObjectMapper.Map(tenant); + if (!name.IsNullOrWhiteSpace()) + { + using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! + { + var tenant = await TenantRepository.FindByNameAsync(name); + return await SetCacheAsync(cacheKey, tenant); + } } + + throw new AbpException("Both id and name can't be invalid."); } - [Obsolete("Use FindAsync method.")] - public virtual TenantConfiguration Find(Guid id) + protected virtual async Task SetCacheAsync(string cacheKey, [CanBeNull]Tenant tenant) { - using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! + var tenantConfiguration = tenant != null ? ObjectMapper.Map(tenant) : null; + var cacheItem = new TenantCacheItem(tenantConfiguration); + await Cache.SetAsync(cacheKey, cacheItem, considerUow: true); + return cacheItem; + } + + [Obsolete("Use GetCacheItemAsync method.")] + protected virtual TenantCacheItem GetCacheItem(Guid? id, string name) + { + var cacheKey = CalculateCacheKey(id, name); + + var cacheItem = Cache.Get(cacheKey, considerUow: true); + if (cacheItem != null) + { + return cacheItem; + } + + if (id.HasValue) { - var tenant = TenantRepository.FindById(id); - if (tenant == null) + using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { - return null; + var tenant = TenantRepository.FindById(id.Value); + return SetCache(cacheKey, tenant); } + } - return ObjectMapper.Map(tenant); + if (!name.IsNullOrWhiteSpace()) + { + using (CurrentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! + { + var tenant = TenantRepository.FindByName(name); + return SetCache(cacheKey, tenant); + } } + + throw new AbpException("Both id and name can't be invalid."); + } + + [Obsolete("Use SetCacheAsync method.")] + protected virtual TenantCacheItem SetCache(string cacheKey, [CanBeNull]Tenant tenant) + { + var tenantConfiguration = tenant != null ? ObjectMapper.Map(tenant) : null; + var cacheItem = new TenantCacheItem(tenantConfiguration); + Cache.Set(cacheKey, cacheItem, considerUow: true); + return cacheItem; + } + + protected virtual string CalculateCacheKey(Guid? id, string name) + { + return TenantCacheItem.CalculateCacheKey(id, name); } } } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs index 03858df202..04c97046cf 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs @@ -13,6 +13,11 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); + if (builder.IsTenantOnlyDatabase()) + { + return; + } + var options = new AbpTenantManagementModelBuilderConfigurationOptions( AbpTenantManagementDbProperties.DbTablePrefix, AbpTenantManagementDbProperties.DbSchema @@ -46,4 +51,4 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore }); } } -} \ No newline at end of file +} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs index 4b6208e232..18b82bb8be 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs @@ -25,6 +25,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) + .OrderBy(t => t.Id) .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)); } @@ -33,6 +34,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { return DbSet .IncludeDetails(includeDetails) + .OrderBy(t => t.Id) .FirstOrDefault(t => t.Name == name); } @@ -41,6 +43,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { return DbSet .IncludeDetails(includeDetails) + .OrderBy(t => t.Id) .FirstOrDefault(t => t.Id == id); } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs index 20eb5128da..0000e2827c 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs @@ -1,9 +1,11 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.TenantManagement.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public interface ITenantManagementDbContext : IEfCoreDbContext { @@ -11,4 +13,4 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore DbSet TenantConnectionStrings { get; set; } } -} \ No newline at end of file +} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs index f75dbd0562..8a359dcde8 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs @@ -1,9 +1,11 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.TenantManagement.EntityFrameworkCore { + [IgnoreMultiTenancy] [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public class TenantManagementDbContext : AbpDbContext, ITenantManagementDbContext { diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs index d3c3fcbb62..211aabf1d4 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs @@ -1,12 +1,14 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.TenantManagement.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public interface ITenantManagementMongoDbContext : IAbpMongoDbContext { IMongoCollection Tenants { get; } } -} \ No newline at end of file +} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs index 56327952d0..f35cdec78a 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs @@ -1,9 +1,11 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.TenantManagement.MongoDB { + [IgnoreMultiTenancy] [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public class TenantManagementMongoDbContext : AbpMongoDbContext, ITenantManagementMongoDbContext { @@ -16,4 +18,4 @@ namespace Volo.Abp.TenantManagement.MongoDB modelBuilder.ConfigureTenantManagement(); } } -} \ No newline at end of file +} diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Localization_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Localization_Tests.cs index 2718512641..4a856b958c 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Localization_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Localization_Tests.cs @@ -1,5 +1,7 @@ -using Microsoft.Extensions.Localization; +using System.Globalization; +using Microsoft.Extensions.Localization; using Shouldly; +using Volo.Abp.Localization; using Volo.Abp.TenantManagement.Localization; using Xunit; @@ -17,8 +19,23 @@ namespace Volo.Abp.TenantManagement [Fact] public void Test() { - _stringLocalizer["TenantDeletionConfirmationMessage"].Value - .ShouldBe("Tenant '{0}' will be deleted. Do you confirm that?"); + using (CultureHelper.Use("en")) + { + _stringLocalizer["TenantDeletionConfirmationMessage"].Value + .ShouldBe("Tenant '{0}' will be deleted. Do you confirm that?"); + } + + using (CultureHelper.Use("en-gb")) + { + _stringLocalizer["TenantDeletionConfirmationMessage"].Value + .ShouldBe("Tenant '{0}' will be deleted. Is that OK?"); + } + + using (CultureHelper.Use("tr")) + { + _stringLocalizer["TenantDeletionConfirmationMessage"].Value + .ShouldBe("'{0}' isimli müşteri silinecektir. Onaylıyor musunuz?"); + } } } } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantCacheItemInvalidator_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantCacheItemInvalidator_Tests.cs new file mode 100644 index 0000000000..4c2a8e3c3f --- /dev/null +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantCacheItemInvalidator_Tests.cs @@ -0,0 +1,86 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Caching; +using Volo.Abp.MultiTenancy; +using Xunit; + +namespace Volo.Abp.TenantManagement +{ + public class TenantCacheItemInvalidator_Tests : AbpTenantManagementDomainTestBase + { + private readonly IDistributedCache _cache; + private readonly ITenantStore _tenantStore; + private readonly ITenantRepository _tenantRepository; + + public TenantCacheItemInvalidator_Tests() + { + _cache = GetRequiredService>(); + _tenantStore = GetRequiredService(); + _tenantRepository = GetRequiredService(); + } + + [Fact] + public async Task Get_Tenant_Should_Cached() + { + var acme = await _tenantRepository.FindByNameAsync("acme"); + acme.ShouldNotBeNull(); + + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(acme.Id, null))).ShouldBeNull(); + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(null, acme.Name))).ShouldBeNull(); + + await _tenantStore.FindAsync(acme.Id); + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(acme.Id, null))).ShouldNotBeNull(); + + await _tenantStore.FindAsync(acme.Name); + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(null, acme.Name))).ShouldNotBeNull(); + + + var volosoft = _tenantRepository.FindByName("volosoft"); + volosoft.ShouldNotBeNull(); + + (_cache.Get(TenantCacheItem.CalculateCacheKey(volosoft.Id, null))).ShouldBeNull(); + (_cache.Get(TenantCacheItem.CalculateCacheKey(null, volosoft.Name))).ShouldBeNull(); + + _tenantStore.Find(volosoft.Id); + (_cache.Get(TenantCacheItem.CalculateCacheKey(volosoft.Id, null))).ShouldNotBeNull(); + + _tenantStore.Find(volosoft.Name); + (_cache.Get(TenantCacheItem.CalculateCacheKey(null, volosoft.Name))).ShouldNotBeNull(); + } + + [Fact] + public async Task Cache_Should_Invalidator_When_Tenant_Changed() + { + var acme = await _tenantRepository.FindByNameAsync("acme"); + acme.ShouldNotBeNull(); + + // FindAsync will cache tenant. + await _tenantStore.FindAsync(acme.Id); + await _tenantStore.FindAsync(acme.Name); + + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(acme.Id, null))).ShouldNotBeNull(); + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(null, acme.Name))).ShouldNotBeNull(); + + await _tenantRepository.DeleteAsync(acme); + + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(acme.Id, null))).ShouldBeNull(); + (await _cache.GetAsync(TenantCacheItem.CalculateCacheKey(null, acme.Name))).ShouldBeNull(); + + + var volosoft = await _tenantRepository.FindByNameAsync("volosoft"); + volosoft.ShouldNotBeNull(); + + // Find will cache tenant. + _tenantStore.Find(volosoft.Id); + _tenantStore.Find(volosoft.Name); + + (_cache.Get(TenantCacheItem.CalculateCacheKey(volosoft.Id, null))).ShouldNotBeNull(); + (_cache.Get(TenantCacheItem.CalculateCacheKey(null, volosoft.Name))).ShouldNotBeNull(); + + await _tenantRepository.DeleteAsync(volosoft); + + (_cache.Get(TenantCacheItem.CalculateCacheKey(volosoft.Id, null))).ShouldBeNull(); + (_cache.Get(TenantCacheItem.CalculateCacheKey(null, volosoft.Name))).ShouldBeNull(); + } + } +} diff --git a/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Localization/Resources/nl.json b/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Localization/Resources/nl.json new file mode 100644 index 0000000000..4f00849893 --- /dev/null +++ b/modules/virtual-file-explorer/src/Volo.Abp.VirtualFileExplorer.Web/Localization/Resources/nl.json @@ -0,0 +1,14 @@ +{ + "culture": "nl", + "texts": { + "VirtualFileExplorer": "Virtuele bestandsverkenner", + "VirtualFileType": "Virtueel bestandstype", + "Menu:VirtualFileExplorer": "Virtuele bestandsverkenner", + "LastUpdateTime": "Tijdstip laatste update", + "VirtualFileName": "Virtuele bestandsnaam", + "FileContent": "Bestandsinhoud", + "Size": "Grootte", + "BackToRoot": "Terug naar hoofdmap", + "EmptyFileInfoList": "Er zijn geen virtuele bestanden" + } +} \ No newline at end of file diff --git a/npm/lerna.json b/npm/lerna.json index 650b0f02be..3d7e74f3b4 100644 --- a/npm/lerna.json +++ b/npm/lerna.json @@ -1,5 +1,5 @@ { - "version": "4.1.0", + "version": "4.2.0", "packages": [ "packs/*" ], diff --git a/npm/ng-packs/lerna.version.json b/npm/ng-packs/lerna.version.json index a9be1097c6..7834fe2f02 100644 --- a/npm/ng-packs/lerna.version.json +++ b/npm/ng-packs/lerna.version.json @@ -1,5 +1,5 @@ { - "version": "4.1.0", + "version": "4.2.0", "packages": [ "packages/*" ], diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index d604dd533b..08ee05862e 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -26,32 +26,32 @@ "postinstall": "npm run compile:ivy" }, "devDependencies": { - "@abp/ng.core": "~4.1.0", - "@abp/ng.feature-management": "~4.1.0", - "@abp/ng.identity": "~4.1.0", - "@abp/ng.permission-management": "~4.1.0", - "@abp/ng.schematics": "~4.1.0", - "@abp/ng.setting-management": "~4.1.0", - "@abp/ng.tenant-management": "~4.1.0", - "@abp/ng.theme.basic": "~4.1.0", - "@abp/ng.theme.shared": "~4.1.0", - "@abp/utils": "^4.1.0", + "@abp/ng.core": "~4.2.0", + "@abp/ng.feature-management": "~4.2.0", + "@abp/ng.identity": "~4.2.0", + "@abp/ng.permission-management": "~4.2.0", + "@abp/ng.schematics": "~4.2.0", + "@abp/ng.setting-management": "~4.2.0", + "@abp/ng.tenant-management": "~4.2.0", + "@abp/ng.theme.basic": "~4.2.0", + "@abp/ng.theme.shared": "~4.2.0", + "@abp/utils": "^4.2.0", "@angular-builders/jest": "^10.0.0", - "@angular-devkit/build-angular": "~0.1100.0", + "@angular-devkit/build-angular": "~0.1101.0", "@angular-devkit/build-ng-packagr": "~0.1001.2", "@angular-devkit/schematics-cli": "^0.1001.1", - "@angular/animations": "~11.0.0", - "@angular/cli": "~11.0.0", - "@angular/common": "~11.0.0", - "@angular/compiler": "11.0.0", - "@angular/compiler-cli": "11.0.0", - "@angular/core": "~11.0.0", - "@angular/forms": "~11.0.0", - "@angular/language-service": "~11.0.0", - "@angular/localize": "~11.0.0", - "@angular/platform-browser": "~11.0.0", - "@angular/platform-browser-dynamic": "~11.0.0", - "@angular/router": "~11.0.0", + "@angular/animations": "~11.1.0", + "@angular/cli": "~11.1.0", + "@angular/common": "~11.1.0", + "@angular/compiler": "11.1.0", + "@angular/compiler-cli": "11.1.0", + "@angular/core": "~11.1.0", + "@angular/forms": "~11.1.0", + "@angular/language-service": "~11.1.0", + "@angular/localize": "~11.1.0", + "@angular/platform-browser": "~11.1.0", + "@angular/platform-browser-dynamic": "~11.1.0", + "@angular/router": "~11.1.0", "@fortawesome/fontawesome-free": "^5.14.0", "@ng-bootstrap/ng-bootstrap": "^7.0.0", "@ngneat/inspector": "^1.0.0", @@ -80,7 +80,7 @@ "just-compare": "^1.3.0", "lerna": "^3.19.0", "ng-packagr": "^11.0.1", - "ng-zorro-antd": "^10.1.1", + "ng-zorro-antd": "^11.0.1", "ngxs-schematic": "^1.1.9", "prettier": "^2.2.0", "protractor": "~7.0.0", @@ -91,7 +91,7 @@ "ts-toolbelt": "6.15.4", "tsickle": "^0.39.1", "tslint": "~6.1.0", - "typescript": "~4.0.3", + "typescript": "~4.1.3", "zone.js": "~0.10.2" }, "dependencies": { @@ -102,4 +102,4 @@ "path": "cz-conventional-changelog" } } -} +} \ No newline at end of file diff --git a/npm/ng-packs/packages/components/package.json b/npm/ng-packs/packages/components/package.json index 68b26abf8c..6e2c67f134 100644 --- a/npm/ng-packs/packages/components/package.json +++ b/npm/ng-packs/packages/components/package.json @@ -1,17 +1,17 @@ { "name": "@abp/ng.components", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "peerDependencies": { - "@abp/ng.core": ">=4.1.0", + "@abp/ng.core": ">=4.2.0", "@ng-bootstrap/ng-bootstrap": ">=6.0.0" }, "dependencies": { - "ng-zorro-antd": "^9.3.0", + "ng-zorro-antd": "^11.0.0", "tslib": "^2.0.0" }, "publishConfig": { diff --git a/npm/ng-packs/packages/core/locale/src/utils/register-locale.ts b/npm/ng-packs/packages/core/locale/src/utils/register-locale.ts index 26003bf1c4..a8762be419 100644 --- a/npm/ng-packs/packages/core/locale/src/utils/register-locale.ts +++ b/npm/ng-packs/packages/core/locale/src/utils/register-locale.ts @@ -28,7 +28,7 @@ export function registerLocale( return new Promise((resolve, reject) => { return import( /* webpackChunkName: "_locale-[request]"*/ - /* webpackInclude: /[/\\](ar|cs|en|fr|pt|tr|ru|hu|sl|zh-Hans|zh-Hant).js/ */ + /* webpackInclude: /[/\\](ar|cs|en|en-GB|fr|pt|tr|ru|hu|sl|zh-Hans|zh-Hant).js/ */ /* webpackExclude: /[/\\]global|extra/ */ `@angular/common/locales/${localeMap[locale] || locale}.js` ) diff --git a/npm/ng-packs/packages/core/package.json b/npm/ng-packs/packages/core/package.json index b12fbc6295..588ee4777f 100644 --- a/npm/ng-packs/packages/core/package.json +++ b/npm/ng-packs/packages/core/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.core", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/utils": "^4.1.0", + "@abp/utils": "^4.2.0", "@angular/localize": "~10.0.10", "@ngxs/store": "^3.7.0", "angular-oauth2-oidc": "^10.0.0", diff --git a/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts b/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts index 387437cc04..c9a852ae08 100644 --- a/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts +++ b/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts @@ -1,10 +1,11 @@ import { Component, Injector, Optional, SkipSelf, Type } from '@angular/core'; -import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { eLayoutType } from '../enums/common'; import { ABP } from '../models'; import { ReplaceableComponents } from '../models/replaceable-components'; import { LocalizationService } from '../services/localization.service'; import { ReplaceableComponentsService } from '../services/replaceable-components.service'; +import { RouterEvents } from '../services/router-events.service'; import { RoutesService } from '../services/routes.service'; import { SubscriptionService } from '../services/subscription.service'; import { findRoute, getRoutePath } from '../utils/route-utils'; @@ -23,6 +24,7 @@ import { TreeNode } from '../utils/tree-utils'; }) export class DynamicLayoutComponent { layout: Type; + layoutKey: eLayoutType; // TODO: Consider a shared enum (eThemeSharedComponents) for known layouts readonly layouts = new Map([ @@ -33,44 +35,58 @@ export class DynamicLayoutComponent { isLayoutVisible = true; + private router: Router; + private route: ActivatedRoute; + private routes: RoutesService; + constructor( injector: Injector, private localizationService: LocalizationService, private replaceableComponents: ReplaceableComponentsService, private subscription: SubscriptionService, + private routerEvents: RouterEvents, @Optional() @SkipSelf() dynamicLayoutComponent: DynamicLayoutComponent, ) { if (dynamicLayoutComponent) return; - const route = injector.get(ActivatedRoute); - const router = injector.get(Router); - const routes = injector.get(RoutesService); - - this.subscription.addOne(router.events, event => { - if (event instanceof NavigationEnd) { - let expectedLayout = (route.snapshot.data || {}).layout; - - if (!expectedLayout) { - let node = findRoute(routes, getRoutePath(router)); - node = { parent: node } as TreeNode; - - while (node.parent) { - node = node.parent; - - if (node.layout) { - expectedLayout = node.layout; - break; - } - } - } + this.route = injector.get(ActivatedRoute); + this.router = injector.get(Router); + this.routes = injector.get(RoutesService); + + this.getLayout(); + this.checkLayoutOnNavigationEnd(); + + this.listenToLanguageChange(); + } + + private checkLayoutOnNavigationEnd() { + const navigationEnd$ = this.routerEvents.getNavigationEvents('End'); + this.subscription.addOne(navigationEnd$, () => this.getLayout()); + } - if (!expectedLayout) expectedLayout = eLayoutType.empty; + private getLayout() { + let expectedLayout = (this.route.snapshot.data || {}).layout; - const key = this.layouts.get(expectedLayout); - this.layout = this.getComponent(key)?.component; + if (!expectedLayout) { + let node = findRoute(this.routes, getRoutePath(this.router)); + node = { parent: node } as TreeNode; + + while (node.parent) { + node = node.parent; + + if (node.layout) { + expectedLayout = node.layout; + break; + } } - }); + } - this.listenToLanguageChange(); + if (!expectedLayout) expectedLayout = eLayoutType.empty; + + if (this.layoutKey === expectedLayout) return; + + const key = this.layouts.get(expectedLayout); + this.layout = this.getComponent(key)?.component; + this.layoutKey = expectedLayout; } private listenToLanguageChange() { diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index 260cffd4d3..36d59c929b 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -11,7 +11,6 @@ import { ReplaceableRouteContainerComponent } from './components/replaceable-rou import { RouterOutletComponent } from './components/router-outlet.component'; import { AutofocusDirective } from './directives/autofocus.directive'; import { InputEventDebounceDirective } from './directives/debounce.directive'; -import { EllipsisDirective } from './directives/ellipsis.directive'; import { ForDirective } from './directives/for.directive'; import { FormSubmitDirective } from './directives/form-submit.directive'; import { InitDirective } from './directives/init.directive'; @@ -53,11 +52,9 @@ export function storageFactory(): OAuthStorage { ReactiveFormsModule, RouterModule, LocalizationModule, - AbstractNgModelComponent, AutofocusDirective, DynamicLayoutComponent, - EllipsisDirective, ForDirective, FormSubmitDirective, InitDirective, @@ -83,7 +80,6 @@ export function storageFactory(): OAuthStorage { AbstractNgModelComponent, AutofocusDirective, DynamicLayoutComponent, - EllipsisDirective, ForDirective, FormSubmitDirective, InitDirective, diff --git a/npm/ng-packs/packages/core/src/lib/directives/index.ts b/npm/ng-packs/packages/core/src/lib/directives/index.ts index a297faa14b..3322b14257 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/index.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/index.ts @@ -1,6 +1,5 @@ export * from './autofocus.directive'; export * from './debounce.directive'; -export * from './ellipsis.directive'; export * from './for.directive'; export * from './form-submit.directive'; export * from './init.directive'; diff --git a/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts b/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts index acd7417560..c95b890239 100644 --- a/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts +++ b/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts @@ -17,6 +17,6 @@ export class AuthGuard implements CanActivate { } this.authService.initLogin(); - return true; + return false; } } diff --git a/npm/ng-packs/packages/core/src/lib/services/index.ts b/npm/ng-packs/packages/core/src/lib/services/index.ts index 37bc78d606..55000edde1 100644 --- a/npm/ng-packs/packages/core/src/lib/services/index.ts +++ b/npm/ng-packs/packages/core/src/lib/services/index.ts @@ -15,6 +15,7 @@ export * from './profile.service'; export * from './replaceable-components.service'; export * from './resource-wait.service'; export * from './rest.service'; +export * from './router-events.service'; export * from './router-wait.service'; export * from './routes.service'; export * from './session-state.service'; diff --git a/npm/ng-packs/packages/core/src/lib/services/router-events.service.ts b/npm/ng-packs/packages/core/src/lib/services/router-events.service.ts new file mode 100644 index 0000000000..9acee09aa7 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/services/router-events.service.ts @@ -0,0 +1,61 @@ +import { Injectable, Type } from '@angular/core'; +import { + NavigationCancel, + NavigationEnd, + NavigationError, + NavigationStart, + Router, + RouterEvent, +} from '@angular/router'; +import { filter } from 'rxjs/operators'; + +export const NavigationEvent = { + Cancel: NavigationCancel, + End: NavigationEnd, + Error: NavigationError, + Start: NavigationStart, +}; + +@Injectable({ providedIn: 'root' }) +export class RouterEvents { + constructor(private router: Router) {} + + getEvents(...eventTypes: T) { + type FilteredRouterEvent = T extends Type[] ? Ctor : never; + + const filterRouterEvents = (event: RouterEvent): event is FilteredRouterEvent => + eventTypes.some(type => event instanceof type); + + return this.router.events.pipe(filter(filterRouterEvents)); + } + + getNavigationEvents(...navigationEventKeys: T) { + type FilteredNavigationEvent = T extends (infer Key)[] + ? Key extends NavigationEventKey + ? InstanceType + : never + : never; + + const filterNavigationEvents = (event: RouterEvent): event is FilteredNavigationEvent => + navigationEventKeys.some(key => event instanceof NavigationEvent[key]); + + return this.router.events.pipe(filter(filterNavigationEvents)); + } + + getAllEvents() { + return this.router.events; + } + + getAllNavigationEvents() { + const keys = Object.keys(NavigationEvent) as NavigationEventKeys; + return this.getNavigationEvents(...keys); + } +} + +type RouterEventConstructors = [Type, ...Type[]]; + +type NavigationEventKeys = [NavigationEventKey, ...NavigationEventKey[]]; + +type NavigationEventType = typeof NavigationEvent; + +export type NavigationEventKey = keyof NavigationEventType; diff --git a/npm/ng-packs/packages/core/src/lib/services/router-wait.service.ts b/npm/ng-packs/packages/core/src/lib/services/router-wait.service.ts index 56240d8ca2..e53ca3a1b1 100644 --- a/npm/ng-packs/packages/core/src/lib/services/router-wait.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/router-wait.service.ts @@ -1,9 +1,10 @@ import { Injectable, Injector } from '@angular/core'; -import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router } from '@angular/router'; -import { filter, map, mapTo, switchMap, takeUntil, tap } from 'rxjs/operators'; -import { InternalStore } from '../utils/internal-store-utils'; +import { NavigationStart } from '@angular/router'; import { of, Subject, timer } from 'rxjs'; +import { map, mapTo, switchMap, takeUntil, tap } from 'rxjs/operators'; import { LOADER_DELAY } from '../tokens/lodaer-delay.token'; +import { InternalStore } from '../utils/internal-store-utils'; +import { RouterEvents } from './router-events.service'; export interface RouterWaitState { loading: boolean; @@ -16,17 +17,15 @@ export class RouterWaitService { private store = new InternalStore({ loading: false }); private destroy$ = new Subject(); private delay: number; - constructor(private router: Router, injector: Injector) { + constructor(private routerEvents: RouterEvents, injector: Injector) { this.delay = injector.get(LOADER_DELAY, 500); - this.router.events + this.updateLoadingStatusOnNavigationEvents(); + } + + private updateLoadingStatusOnNavigationEvents() { + this.routerEvents + .getAllNavigationEvents() .pipe( - filter( - event => - event instanceof NavigationStart || - event instanceof NavigationEnd || - event instanceof NavigationError || - event instanceof NavigationCancel, - ), map(event => event instanceof NavigationStart), switchMap(condition => condition diff --git a/npm/ng-packs/packages/core/src/lib/strategies/auth-flow.strategy.ts b/npm/ng-packs/packages/core/src/lib/strategies/auth-flow.strategy.ts index 31e004be6d..d3d4c9f70f 100644 --- a/npm/ng-packs/packages/core/src/lib/strategies/auth-flow.strategy.ts +++ b/npm/ng-packs/packages/core/src/lib/strategies/auth-flow.strategy.ts @@ -70,7 +70,8 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy { } logout() { - this.oAuthService.logOut(); + this.oAuthService.revokeTokenAndLogout(); + // TODO: no need to return of(null). It may be removed in v5.0. return of(null); } diff --git a/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts index 18bf53ede8..f34f503227 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts @@ -26,7 +26,7 @@ describe('AuthGuard', () => { spectator.inject(OAuthService).hasValidAccessToken.andReturn(false); const initLoginSpy = jest.spyOn(authService, 'initLogin'); - expect(guard.canActivate()).toBe(true); + expect(guard.canActivate()).toBe(false); expect(initLoginSpy).toHaveBeenCalled(); }); }); diff --git a/npm/ng-packs/packages/core/src/lib/tests/multi-tenancy-utils.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/multi-tenancy-utils.spec.ts index 5af037b7d0..66188f0bb3 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/multi-tenancy-utils.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/multi-tenancy-utils.spec.ts @@ -20,11 +20,10 @@ const environment = { }, oAuthConfig: { issuer: 'https://{0}.api.volosoft.com', + redirectUri: 'https://{0}.volosoft.com', clientId: 'MyProjectName_App', - dummyClientSecret: '1q2w3e*', - scope: 'MyProjectName', - oidc: false, - requireHttps: true, + responseType: 'code', + scope: 'offline_access MyProjectName', }, apis: { default: { @@ -91,7 +90,11 @@ describe('MultiTenancyUtils', () => { const replacedEnv = { ...environment, application: { ...environment.application, baseUrl: 'https://abp.volosoft.com' }, - oAuthConfig: { ...environment.oAuthConfig, issuer: 'https://abp.api.volosoft.com' }, + oAuthConfig: { + ...environment.oAuthConfig, + issuer: 'https://abp.api.volosoft.com', + redirectUri: 'https://abp.volosoft.com', + }, apis: { default: { url: 'https://abp.api.volosoft.com', diff --git a/npm/ng-packs/packages/core/src/lib/tests/router-events.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/router-events.service.spec.ts new file mode 100644 index 0000000000..0226c09d1e --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/router-events.service.spec.ts @@ -0,0 +1,111 @@ +import { + NavigationCancel, + NavigationEnd, + NavigationError, + NavigationStart, + ResolveEnd, + ResolveStart, + Router, + RouterEvent, +} from '@angular/router'; +import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { Subject } from 'rxjs'; +import { take } from 'rxjs/operators'; +import { NavigationEventKey, RouterEvents } from '../services/router-events.service'; + +describe('RouterEvents', () => { + let spectator: SpectatorService; + let service: RouterEvents; + const events = new Subject(); + const emitRouterEvents = () => { + events.next(new RouterEvent(0, null)); + events.next(new NavigationStart(1, null, null)); + events.next(new ResolveStart(2, null, null, null)); + events.next(new RouterEvent(3, null)); + events.next(new NavigationError(4, null, null)); + events.next(new NavigationEnd(5, null, null)); + events.next(new ResolveEnd(6, null, null, null)); + events.next(new NavigationCancel(7, null, null)); + }; + + const createService = createServiceFactory({ + service: RouterEvents, + providers: [ + { + provide: Router, + useValue: { events }, + }, + ], + }); + + beforeEach(() => { + spectator = createService(); + service = spectator.service; + }); + + describe('getNavigationEvents', () => { + test.each` + filtered | expected + ${['Start', 'Cancel']} | ${[1, 7]} + ${['Error', 'Cancel']} | ${[4, 7]} + ${['Start', 'End']} | ${[1, 5]} + ${['Error', 'End']} | ${[4, 5]} + `( + 'should return a stream of given navigation events', + ({ filtered, expected }: NavigationEventTest) => { + const stream = service.getNavigationEvents(...filtered); + const collected: number[] = []; + + stream.pipe(take(2)).subscribe(event => collected.push(event.id)); + + emitRouterEvents(); + + expect(collected).toEqual(expected); + }, + ); + }); + + describe('getAnyNavigationEvent', () => { + it('should return a stream of any navigation event', () => { + const stream = service.getAllNavigationEvents(); + const collected: number[] = []; + + stream.pipe(take(4)).subscribe(event => collected.push(event.id)); + + emitRouterEvents(); + + expect(collected).toEqual([1, 4, 5, 7]); + }); + }); + + describe('getEvents', () => { + it('should return a stream of given router events', () => { + const stream = service.getEvents(ResolveEnd, ResolveStart); + const collected: number[] = []; + + stream.pipe(take(2)).subscribe(event => collected.push(event.id)); + + emitRouterEvents(); + + expect(collected).toEqual([2, 6]); + }); + }); + + describe('getAnyEvent', () => { + it('should return a stream of any router event', () => { + const stream = service.getAllEvents(); + const collected: number[] = []; + + stream.pipe(take(8)).subscribe((event: RouterEvent) => collected.push(event.id)); + + emitRouterEvents(); + + expect(collected).toEqual([0, 1, 2, 3, 4, 5, 6, 7]); + }); + }); +}); + +interface NavigationEventTest { + filtered: [NavigationEventKey, ...NavigationEventKey[]]; + expected: number[]; +} diff --git a/npm/ng-packs/packages/core/src/lib/tests/tree-utils.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/tree-utils.spec.ts index 6115114872..b4f8721f47 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/tree-utils.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/tree-utils.spec.ts @@ -1,4 +1,9 @@ -import { BaseTreeNode, createTreeFromList, TreeNode } from '../utils/tree-utils'; +import { + BaseTreeNode, + createTreeFromList, + createTreeNodeFilterCreator, + TreeNode, +} from '../utils/tree-utils'; const LIST_1 = [ { id: 1, pid: null }, @@ -38,6 +43,42 @@ const TREE_3 = [ ], }, ]; +const SOURCE_TREE: TreeNode[] = [ + { + id: 1, + pid: null, + isLeaf: false, + name: 'foo', + children: [ + { + id: 2, + pid: 1, + name: 'bar', + isLeaf: false, + children: [{ id: 3, pid: 2, name: 'qux', isLeaf: true, children: [] }], + }, + { id: 4, pid: 1, name: 'baz', isLeaf: true, children: [] }, + { id: 5, pid: 1, name: 'quux', isLeaf: true, children: [] }, + ], + }, +]; +const RESULT_TREE_1 = [ + { id: 3, pid: 2, name: 'qux', isLeaf: true, children: [] }, + { id: 5, pid: 1, name: 'quux', isLeaf: true, children: [] }, +]; +const RESULT_TREE_2 = [{ id: 5, pid: 1, name: 'quux', isLeaf: true, children: [] }]; +const RESULT_TREE_3 = [ + { + id: 2, + pid: 1, + name: 'bar', + isLeaf: false, + children: [{ id: 3, pid: 2, name: 'qux', isLeaf: true, children: [] }], + }, + { id: 4, pid: 1, name: 'baz', isLeaf: true, children: [] }, +]; +const RESULT_TREE_4 = [{ id: 4, pid: 1, name: 'baz', isLeaf: true, children: [] }]; + describe('Tree Utils', () => { describe('createTreeFromList', () => { test.each` @@ -56,6 +97,23 @@ describe('Tree Utils', () => { expect(removeParents(tree)).toEqual(expected); }); }); + + describe('createTreeNodeFilterCreator', () => { + test.each` + search | expected + ${'qu'} | ${RESULT_TREE_1} + ${'quu'} | ${RESULT_TREE_2} + ${'ba'} | ${RESULT_TREE_3} + ${'baz'} | ${RESULT_TREE_4} + `( + 'should return $expected when $search is searched', + ({ search, expected }: TestCreateTreeNodeFilter) => { + const filter = createTreeNodeFilterCreator('name', String)(search); + + expect(filter(SOURCE_TREE)).toEqual(expected); + }, + ); + }); }); function removeParents(tree: TreeNode[]) { @@ -72,6 +130,17 @@ interface TestCreateTreeFromList { } interface Model { - id: 1; - pid: null; + id: number; + pid?: number; +} + +interface TestCreateTreeNodeFilter { + search: string; + expected: TreeNode[]; +} + +interface SearchModel { + id: number; + pid?: number; + name: string; } diff --git a/npm/ng-packs/packages/core/src/lib/utils/multi-tenancy-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/multi-tenancy-utils.ts index abfc33d723..390a46db8e 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/multi-tenancy-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/multi-tenancy-utils.ts @@ -58,6 +58,13 @@ function setEnvironment(injector: Injector, tenancyName: string) { ); } + if (environment.oAuthConfig.redirectUri) { + environment.oAuthConfig.redirectUri = environment.oAuthConfig.redirectUri.replace( + tenancyPlaceholder, + tenancyName, + ); + } + environment.oAuthConfig.issuer = environment.oAuthConfig.issuer.replace( tenancyPlaceholder, tenancyName, diff --git a/npm/ng-packs/packages/core/src/lib/utils/tree-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/tree-utils.ts index ba6e3a5b90..235820abd6 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/tree-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/tree-utils.ts @@ -54,6 +54,25 @@ export function createMapFromList( return map; } +export function createTreeNodeFilterCreator( + key: keyof T, + mapperFn: (value: any) => string, +) { + return (search: string) => { + const regex = new RegExp('.*' + search + '.*', 'i'); + + return function collectNodes(nodes: TreeNode[], matches = []) { + for (const node of nodes) { + if (regex.test(mapperFn(node[key]))) matches.push(node); + + if (node.children.length) collectNodes(node.children, matches); + } + + return matches; + }; + }; +} + export type TreeNode = { [K in keyof T]: T[K]; } & { diff --git a/npm/ng-packs/packages/feature-management/package.json b/npm/ng-packs/packages/feature-management/package.json index 95d0658fef..4177796777 100644 --- a/npm/ng-packs/packages/feature-management/package.json +++ b/npm/ng-packs/packages/feature-management/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.feature-management", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.theme.shared": "~4.1.0", + "@abp/ng.theme.shared": "~4.2.0", "tslib": "^2.0.0" }, "publishConfig": { diff --git a/npm/ng-packs/packages/identity/package.json b/npm/ng-packs/packages/identity/package.json index 615d24e83a..7e00ecbe7e 100644 --- a/npm/ng-packs/packages/identity/package.json +++ b/npm/ng-packs/packages/identity/package.json @@ -1,14 +1,14 @@ { "name": "@abp/ng.identity", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.permission-management": "~4.1.0", - "@abp/ng.theme.shared": "~4.1.0", + "@abp/ng.permission-management": "~4.2.0", + "@abp/ng.theme.shared": "~4.2.0", "tslib": "^2.0.0" }, "publishConfig": { diff --git a/npm/ng-packs/packages/permission-management/package.json b/npm/ng-packs/packages/permission-management/package.json index b31ad19972..2484edc6fb 100644 --- a/npm/ng-packs/packages/permission-management/package.json +++ b/npm/ng-packs/packages/permission-management/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.permission-management", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.theme.shared": "~4.1.0", + "@abp/ng.theme.shared": "~4.2.0", "tslib": "^2.0.0" }, "publishConfig": { diff --git a/npm/ng-packs/packages/schematics/package.json b/npm/ng-packs/packages/schematics/package.json index ec2d3e8305..d403030597 100644 --- a/npm/ng-packs/packages/schematics/package.json +++ b/npm/ng-packs/packages/schematics/package.json @@ -1,6 +1,6 @@ { "name": "@abp/ng.schematics", - "version": "4.1.0", + "version": "4.2.0", "description": "Schematics that works with ABP Backend", "keywords": [ "schematics" diff --git a/npm/ng-packs/packages/schematics/src/models/method.ts b/npm/ng-packs/packages/schematics/src/models/method.ts index c2833a7bfd..7dca1668f5 100644 --- a/npm/ng-packs/packages/schematics/src/models/method.ts +++ b/npm/ng-packs/packages/schematics/src/models/method.ts @@ -54,7 +54,7 @@ export class Body { this.body = value; break; case eBindingSourceId.Path: - const regex = new RegExp('{' + camelName + '}', 'g'); + const regex = new RegExp('{(' + camelName + '|' + name + ')}', 'g'); this.url = this.url.replace(regex, '${' + value + '}'); break; default: diff --git a/npm/ng-packs/packages/schematics/src/utils/type.ts b/npm/ng-packs/packages/schematics/src/utils/type.ts index a087392d40..dbae0c55db 100644 --- a/npm/ng-packs/packages/schematics/src/utils/type.ts +++ b/npm/ng-packs/packages/schematics/src/utils/type.ts @@ -9,7 +9,7 @@ import { parseGenerics } from './tree'; export function createTypeSimplifier() { const parseType = createTypeParser(t => { let type = t.replace( - /System\.([0-9A-Za-z.]+)/g, + /(? SYSTEM_TYPES.get(match) ?? 'any', ); diff --git a/npm/ng-packs/packages/setting-management/package.json b/npm/ng-packs/packages/setting-management/package.json index 7a1ca8e557..b29029fc4f 100644 --- a/npm/ng-packs/packages/setting-management/package.json +++ b/npm/ng-packs/packages/setting-management/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.setting-management", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.theme.shared": "~4.1.0", + "@abp/ng.theme.shared": "~4.2.0", "tslib": "^2.0.0" }, "publishConfig": { diff --git a/npm/ng-packs/packages/tenant-management/package.json b/npm/ng-packs/packages/tenant-management/package.json index 05b92478ea..396a41a160 100644 --- a/npm/ng-packs/packages/tenant-management/package.json +++ b/npm/ng-packs/packages/tenant-management/package.json @@ -1,14 +1,14 @@ { "name": "@abp/ng.tenant-management", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.feature-management": "~4.1.0", - "@abp/ng.theme.shared": "~4.1.0", + "@abp/ng.feature-management": "~4.2.0", + "@abp/ng.theme.shared": "~4.2.0", "tslib": "^2.0.0" }, "publishConfig": { diff --git a/npm/ng-packs/packages/theme-basic/package.json b/npm/ng-packs/packages/theme-basic/package.json index f55b3eeffc..fa60d130ff 100644 --- a/npm/ng-packs/packages/theme-basic/package.json +++ b/npm/ng-packs/packages/theme-basic/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.theme.basic", - "version": "4.1.0", + "version": "4.2.0", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.theme.shared": "~4.1.0", + "@abp/ng.theme.shared": "~4.2.0", "tslib": "^2.0.0" }, "publishConfig": { diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html index eb68dc7df0..7892d43a00 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html @@ -1,7 +1,7 @@