diff --git a/docs/en/Community-Articles/2021-03-12-Simple-SignalR-Notification/POST.md b/docs/en/Community-Articles/2021-03-12-Simple-SignalR-Notification/POST.md index 7a88adde44..8aeff16612 100644 --- a/docs/en/Community-Articles/2021-03-12-Simple-SignalR-Notification/POST.md +++ b/docs/en/Community-Articles/2021-03-12-Simple-SignalR-Notification/POST.md @@ -38,8 +38,19 @@ Open `YourProjectWebModule.cs` class and add the following line to the `PreConfi #### 2- Add Client Scripts -2- In the `ConfigureServices` method of your web module add the following code to add the `signalr.js` and `notification-hub.js`. We'll add these packages in the next steps. +2- In the `ConfigureServices` method of your web module add the following code to add the `signalr.js` and `notification-hub.js`. We'll add these packages in the next steps. If you are not using Lepton Theme you can add the files to `StandardBundles.Scripts.Global`. +```csharp + Configure(options => + { + options + .ScriptBundles + .Get(LeptonThemeBundles.Scripts.Global) //or -> Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling.StandardBundles.Scripts.Global + .AddFiles("/libs/signalr/signalr.js") + .AddFiles("/Pages/notification-hub.js"); + }); + ``` + ![Script Bundles](add-script-bundles.jpg) #### 3- Add Hub Endpoint @@ -71,6 +82,11 @@ Add the following JavaScript class into your `Pages` folder in your Web project. Add [Microsoft.SignalR](https://www.npmjs.com/package/@microsoft/signalr) JavaScript package to the `package.json` which is located in your root folder of the Web project. After you add it, run `yarn` command in your Web directory to be able to install this package. +You can install the latest version (3.1.13 will be old) +``` + "@microsoft/signalr": "^3.1.13" +```` + ![Add SignalR package](signalr-package.jpg) #### 3- Add resource Mapping @@ -94,6 +110,8 @@ To do this replace the `Index.cshtml` and `Index.cshtml.cs` with the followings: #### 5- See it in action -Run your web project and in the Index page you'll see a button named as "Get Notification". Click the button and see the notification that comes from SignalR. This is a basic usage of SignalR notification system. You can implement it according to your own requirements. +Run your web project and in the Index page you'll Server Time will be updated every second. The time information comes from backend via SignalR. +This is a very basic usage of SignalR notification system. +You can implement your own SignalR notification system based on your requirements. ![Result](result.jpg) diff --git a/docs/en/Entity-Framework-Core-Migrations.md b/docs/en/Entity-Framework-Core-Migrations.md index be5968a9af..4d42d8bb97 100644 --- a/docs/en/Entity-Framework-Core-Migrations.md +++ b/docs/en/Entity-Framework-Core-Migrations.md @@ -881,6 +881,67 @@ We had a reference to the `Acme.BookStore.EntityFrameworkCore.DbMigrationsForSec You can run the `.DbMigrator` application to migrate & seed the databases. To test, you can delete both databases and run the `.DbMigrator` application again to see if it creates both of the databases. +## Separating Host & Tenant Database Schemas + +In a multi-tenant solution, you may want to separate your database schemas, so host-related tables don't locate in the tenant databases when tenants have separate databases. + +Some pre-built ABP modules are related only with the host side, like the [Tenant Management](Modules/Tenant-Management.md) module. So, in the tenant `DbContext` class you don't call `modelBuilder.ConfigureTenantManagement()` and that's all. + +However, some modules, like the [Identity](Modules/Identity.md) module, is both used in host and tenant sides. It stores tenant users in the tenant database and host users in the host database. However, it stores some entities, like `IdentityClaimType`, only in the host side. In this case, you don't want to add these tables in the tenant database, even if they are not used and will always be empty. + +ABP provides a simple way to set the multi-tenancy side for a `DbContext`, so the modules can check it and decide to map tables to the database, or not. + +````csharp +public class MyTenantDbContext : AbpDbContext +{ + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.SetMultiTenancySide(MultiTenancySides.Tenant); + + base.OnModelCreating(modelBuilder); + modelBuilder.ConfigureIdentity(); + modelBuilder.ConfigureFeatureManagement(); + modelBuilder.ConfigureAuditLogging(); + } +} +```` + +The first line in the `OnModelCreating` sets multi-tenancy side to `Tenant`. For this example, Feature management tables are not created (because all the tables are host-specific), so calling `modelBuilder.ConfigureFeatureManagement()` has no effect. Also, `ConfigureIdentity()` call respects to the multi-tenancy side and doesn't create host-specific tables for this database. + +`SetMultiTenancySide` can get the following values: + +* `MultiTenancySides.Both` (**default value**): This `DbContext` (and the related database) is shared by host and tenant. +* `MultiTenancySides.Host`: This `DbContext` (and the related database) is used only by the host side. +* `MultiTenancySides.Tenant`: This `DbContext` (and the related database) is only for tenants. + +If you create a re-usable application module or want to check that value in your application code, you can use `modelBuilder.GetMultiTenancySide()` to check the current side. + +````csharp +var side = modelBuilder.GetMultiTenancySide(); +if (!side.HasFlag(MultiTenancySides.Host)) +{ + ... +} +```` + +Or practically you can use one of the shortcut extension methods: + +````csharp +if (modelBuilder.IsTenantOnlyDatabase()) +{ + ... +} +```` + +There are four methods to check the current side: + +* `IsHostDatabase()`: Returns `true` if you should create host-related tables. It is equivalent of checking `modelBuilder.GetMultiTenancySide().HasFlag(MultiTenancySides.Host)`. +* `IsHostOnlyDatabase()`: Returns `true` if you should only create host-related tables, but should not create tenant-related tables. It is equivalent of checking `modelBuilder.GetMultiTenancySide() == MultiTenancySides.Host`. +* `IsTenantDatabase()`: Returns `true` if you should create tenant-related tables. It is equivalent of checking `modelBuilder.GetMultiTenancySide().HasFlag(MultiTenancySides.Tenant)`. +* `IsTenantOnlyDatabase()`: Returns `true` if you should only create tenant-related tables, but should not create host-related tables. It is equivalent of checking `modelBuilder.GetMultiTenancySide() == MultiTenancySides.Tenant`. + +All pre-built ABP [modules](Modules/Index.md) checks this value in their `modelBuilder.ConfigureXXX()` methods. + ## Conclusion This document explains how to split your databases and manage your database migrations of your solution for Entity Framework Core. In brief, you need to have a separate migration project per different databases. diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md index a2c0e79996..241a08790f 100644 --- a/docs/en/Entity-Framework-Core.md +++ b/docs/en/Entity-Framework-Core.md @@ -626,6 +626,24 @@ See the "*ConfigureByConvention Method*" section above for more information. ## Advanced Topics +### Controlling the Multi-Tenancy + +If your solution is [multi-tenant](Multi-Tenancy.md), tenants may have **separate databases**, you have **multiple** `DbContext` classes in your solution and some of your `DbContext` classes should be usable **only from the host side**, it is suggested to add `[IgnoreMultiTenancy]` attribute on your `DbContext` class. In this case, ABP guarantees that the related `DbContext` always uses the host [connection string](Connection-Strings.md), even if you are in a tenant context. + +**Example:** + +````csharp +[IgnoreMultiTenancy] +public class MyDbContext : AbpDbContext +{ + ... +} +```` + +Do not use the `[IgnoreMultiTenancy]` attribute if any one of your entities in your `DbContext` can be persisted in a tenant database. + +> When you use repositories, ABP already uses the host database for the entities don't implement the `IMultiTenant` interface. So, most of time you don't need to `[IgnoreMultiTenancy]` attribute if you are using the repositories to work with the database. + ### Set Default Repository Classes Default generic repositories are implemented by `EfCoreRepository` class by default. You can create your own implementation and use it for all the default repository implementations. @@ -782,4 +800,4 @@ public class MyCustomEfCoreBulkOperationProvider ## See Also * [Entities](Entities.md) -* [Repositories](Repositories.md) +* [Repositories](Repositories.md) \ No newline at end of file diff --git a/docs/en/Features.md b/docs/en/Features.md index b185eb2d74..3b1869a9a5 100644 --- a/docs/en/Features.md +++ b/docs/en/Features.md @@ -146,9 +146,9 @@ A feature should be defined to be able to check it. ### FeatureDefinitionProvider -Create a class inheriting the `FeatureDefinitionProvider` to define permissions. +Create a class inheriting the `FeatureDefinitionProvider` to define features. -**Example: Defining permissions** +**Example: Defining features** ```csharp using Volo.Abp.Features; diff --git a/docs/en/Modules/Cms-Kit.md b/docs/en/Modules/Cms-Kit.md index e13f1e585b..db35912ae6 100644 --- a/docs/en/Modules/Cms-Kit.md +++ b/docs/en/Modules/Cms-Kit.md @@ -1,3 +1,159 @@ # CMS Kit Module -TODO \ No newline at end of file +This module provides CMS(Content Management System) capabilities for your application. + +* Provides a **page** management system to manage dynamic pages. +* Provides a **blog** system to create blogs and publish posts. +* Provides a [**tag**](cms-kit/Tag-Management.md) system to tag any kind of resources, like blog posts. +* Provides a [**comment**](cms-kit/Comment-System.md) system to add comments feature to any kind of resource, like blog posts, products, etc. +* Provides a [**reaction**](cms-kit/Reaction-System.md) system to add reactions feature to any kind of resource, like blog posts or comments. +* Provides a [**rating**](cms-kit/Rating-System.md) system to add rating feature to any kind of resource. + +## How to install + +The ABP CLI allows adding a module to a solution using `add-module` command. CMS kit module can be added using the command below; + +```bash +abp add-module Volo.CmsKit +``` +Open the `GlobalFeatureConfigurator` class in the `Domain.Shared` project and place the following code to the `Configure` method to enable all features in the CMS kit module. + +```csharp +GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => +{ + cmsKit.EnableAll(); +}); + +``` + +> If you are using EntityFrameworkCore, do not forget to add a new migration and update your database. + +## Packages + +This module follows the [module development best practices guide](https://docs.abp.io/en/abp/latest/Best-Practices/Index) and consists of several NuGet and NPM packages. See the guide if you want to understand the packages and relations between them. + +CMS kit packages are designed for various usage scenarios. When you visit the [CMS kit package list page](https://www.nuget.org/packages?q=Volo.CmsKit), you will see that packages have admin, public and unified versions. +For example, + - `Volo.CmsKit.Admin.Application`: Contains functionality required by admin websites. + - `Volo.CmsKit.Public.Application`: Contains functionality required by public websites. + - `Volo.CmsKit.Application` : Unified package dependent on both public and admin packages. + +If you want to separate admin and public website codes, you can use the admin and public packages. However, if you want to keep admin and public website codes in a shared project, you can use the unified packages to include admin and public packages. + +It is recommended to use the unified packages instead of adding both admin and public packages. + +## Feature System + +CMS kit uses the [global feature](https://docs.abp.io/en/abp/latest/Global-Features) system for all implemented features. You can use the global feature system to enable all features or only enabled specific features easily. + +To enable all features in the CMS kit, open the `GlobalFeatureConfigurator` class in the `Domain.Shared` project. + +```csharp +GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => +{ + cmsKit.EnableAll(); +}); +``` + +You can only enable specific features such as pages, like below. + +```csharp +GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => +{ + cmsKit.Pages.Enable(); +}); +``` + +## User interface + +### Menu items + +CMS kit module adds the following items to the "Main" menu, under the "CMS" menu item: + +* **Pages**: Page management page. +* **Blogs**: Blog management page. +* **Blog Posts**: Blog post management page. +* **Tags**: Tag management page. +* **Comments**: Comment management page. + +`CmsKitAdminMenus` class has the constants for the menu item names. + +### Pages + +### Page Management + +Pages page is used to manage dynamic pages in the system. + +![pages-page](../images/cmskit-module-pages-page.png) + +You can create or edit an existing page on this page. + +![pages-edit](../images/cmskit-module-pages-edit.png) + +* When you create a page, you can access the created page via `pages/{slug}` URL. + +### Blog Management + +Blogs page is used to create and manage blogs in your system. + +![blogs-page](../images/cmskit-module-blogs-page.png) + +A screenshot from the new blog creation modal: + +![blogs-edit](../images/cmskit-module-blogs-edit.png) + +#### Blog Features + +You can enable or disable a specific feature for blogs by clicking the features action. + +![blogs-feature-action](../images/cmskit-module-blogs-feature-action.png) + +You can select/deselect the desired features for blog posts. + +![features-dialog](../images/cmskit-module-features-dialog.png) + +### Blog Post Management + +When you create blogs, you can manage blog posts on this page. + +![blog-posts-page](../images/cmskit-module-blog-posts-page.png) + +You can create and edit an existing blog post on this page. If you enable specific features such as tags, you can set tags for the blog post on this page. + +![blog-post-edit](../images/cmskit-module-blog-post-edit.png) + +### Tag Management + +CMS Kit provides an extensible tagging mechanism to add tagging capabilities to various places. + +![tags-page](../images/cmskit-module-tags-page.png) + +You can create or edit an existing tag on this page. + +![tag-edit](../images/cmskit-module-tag-edit.png) + +### Comment Management + +CMS Kit provides an extensible commenting mechanism to add comments to various places. You can add comment control to anywhere you want and manage the comments. + +You can view and manage comments on this page. + +![comment-page](../images/cmskit-module-comment-page.png) + +You can manage and view replies on this page. + +![comments-detail](../images/cmskit-module-comments-detail.png) + +### Reactions + +CMS Kit provides an extensible reaction component system to allow users to send reactions to your content. Here how the reactions component looks on a sample page. + +![reactions](../images/cmskit-module-reactions.png) + +You can also customize the reaction icons shown in the reaction component. + +### Ratings + +You can use the rating component to add rating a mechanism to your content. Here how the rating component looks on a sample page. + +![ratings](../images/cmskit-module-ratings.png) diff --git a/docs/en/Modules/cms-kit/Comment-System.md b/docs/en/Modules/cms-kit/Comment-System.md new file mode 100644 index 0000000000..40b9d91a96 --- /dev/null +++ b/docs/en/Modules/cms-kit/Comment-System.md @@ -0,0 +1,117 @@ +# Comment System + +CMS kit provides a **rating** system to add comments feature to any kind of resource, like blog posts, products, etc. This section describes the details of the comments system. + +## Feature + +CMS kit uses the [global feature](https://docs.abp.io/en/abp/latest/Global-Features) system for all implemented features. Commercial startup templates come with all the CMS kit related features are enabled by default, if you create the solution with public website option. If you're installing the CMS kit manually or want to enable the comment feature individually, open the `GlobalFeatureConfigurator` class in the `Domain.Shared` project and place the following code to the `Configure ` method. + +```csharp +GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => +{ + cmsKit.Comments.Enable(); +}); +``` + +# Options + +## CmsKitCommentOptions + +You can use the comment system to add comments to any kind of resources, like blog posts, products etc. Comment system provides a mechanism to group comment definitions by entity types. For example, if you want to use comment system for blog posts and products, you need to define two entity types named `BlogPosts` and `Product`, and add comments under these entity types. + +`CmsKitCommentOptions` can be configured in the domain layer, in the `ConfigureServices` method of your [module](https://docs.abp.io/en/abp/latest/Module-Development-Basics). Example: + +```csharp +Configure(options => +{ + options.EntityTypes.Add(new CommentEntityTypeDefinition("Product")); +}); +``` + +> If you're using the blog feature, the ABP framework defines an entity type for the blog feature automatically. You can easily override or remove the predefined entity types in `Configure` method like shown above. + +`CmsKitCommentOptions` properties: + +- `EntityTypes`: List of defined entity types(`CmsKitCommentOptions`) in the comment system. + +`CommentEntityTypeDefinition` properties: + +- `EntityType`: Name of the entity type. + +# Internals + +## Domain Layer + +#### Aggregates + +This module follows the [Entity Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Entities) guide. + +##### Comment + +A comment represents a written comment from a user. + +- `Comment` (aggregate root): Represents a written comment in the system. + +#### Repositories + +This module follows the [Repository Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Repositories) guide. + +Following custom repositories are defined for this feature: + +- `ICommentRepository` + +#### Domain services + +This module follows the [Domain Services Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Domain-Services) guide. + +##### Comment Manager + +`CommentManager` is used to perform some operations for the `Comment` aggregate root. + +### Application layer + +#### Application services + +- `CommentAdminAppService` (implements `ICommentAdminAppService`): Implements the use cases of comment management system, like listing or removing comments etc. +- `CommentPublicAppService` (implements `ICommentPublicAppService`): Implements the use cases of comment management on the public websites, like listing comments, adding comments etc. + +### Database providers + +#### Common + +##### Table / collection prefix & schema + +All tables/collections use the `Cms` prefix by default. Set static properties on the `CmsKitDbProperties` class if you need to change the table prefix or set a schema name (if supported by your database provider). + +##### Connection string + +This module uses `CmsKit` for the connection string name. If you don't define a connection string with this name, it fallbacks to the `Default` connection string. + +See the [connection strings](https://docs.abp.io/en/abp/latest/Connection-Strings) documentation for details. + +#### Entity Framework Core + +##### Tables + +- CmsComments + +#### MongoDB + +##### Collections + +- **CmsComments** + +### MVC UI + +The comment system provides a commenting widget to allow users to send comments to resources on public websites. You can simply place the widget on a page like below. + +```csharp +@await Component.InvokeAsync(typeof(CommentingViewComponent), new +{ + entityType = "entityType", + entityId = "entityId" +}) +``` +You need to specify entity type and entity ID parameters. Entity type represents the group name you specified while defining the comments in the domain module. Entity ID represents the unique identifier for the resource that users send comments to, such as blog post ID or product ID. + +For more information about widgets see [widgets](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Widgets) documentation. \ No newline at end of file diff --git a/docs/en/Modules/cms-kit/Rating-System.md b/docs/en/Modules/cms-kit/Rating-System.md new file mode 100644 index 0000000000..76aaaaa249 --- /dev/null +++ b/docs/en/Modules/cms-kit/Rating-System.md @@ -0,0 +1,116 @@ +# Rating System + +CMS kit provides a **rating** system to to add ratings feature to any kind of resource like blog posts, comments, etc. This section describes the details of the rating system. + +## Feature + +CMS kit uses the [global feature](https://docs.abp.io/en/abp/latest/Global-Features) system for all implemented features. Commercial startup templates come with all the CMS kit related features are enabled by default, if you create the solution with the public website option. If you're installing the CMS kit manually or want to enable the rating feature individually, open the `GlobalFeatureConfigurator` class in the `Domain.Shared` project and place the following code to the `Configure ` method. + +```csharp +GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => +{ + cmsKit.Ratings.Enable(); +}); +``` + +# Options + +## CmsKitRatingOptions + +You can use the rating system to to add ratings to any kind of resource, like blog posts, comments, etc. The rating system provides a mechanism to group ratings by entity types. For example, if you want to use the rating system for products, you need to define an entity type named `Product` and then add ratings under the defined entity type. + +`CmsKitRatingOptions` can be configured in the domain layer, in the `ConfigureServices` method of your [module](https://docs.abp.io/en/abp/latest/Module-Development-Basics). Example: + +```csharp +Configure(options => +{ + options.EntityTypes.Add(new RatingEntityTypeDefinition("Product")); +}); +``` + +> If you're using the blog feature, the ABP framework defines an entity type for the blog feature automatically. You can easily override or remove the predefined entity types in `Configure` method like shown above. + +`CmsKitRatingOptions` properties: + +- `EntityTypes`: List of defined entity types(`RatingEntityTypeDefinition`) in the rating system. + +`RatingEntityTypeDefinition` properties: + +- `EntityType`: Name of the entity type. + +# Internals + +## Domain Layer + +#### Aggregates + +This module follows the [Entity Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Entities) guide. + +##### Rating + +A rating represents a given rating from a user. + +- `Rating` (aggregate root): Represents a given rating in the system. + +#### Repositories + +This module follows the [Repository Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Repositories) guide. + +Following custom repositories are defined for this feature: + +- `IRatingRepository` + +#### Domain services + +This module follows the [Domain Services Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Domain-Services) guide. + +##### Reaction Manager + +`RatingManager` is used to perform some operations for the `Rating` aggregate root. + +### Application layer + +#### Application services + +- `RatingPublicAppService` (implements `IRatingPublicAppService`): Implements the use cases of rating system. + +### Database providers + +#### Common + +##### Table / collection prefix & schema + +All tables/collections use the `Cms` prefix by default. Set static properties on the `CmsKitDbProperties` class if you need to change the table prefix or set a schema name (if supported by your database provider). + +##### Connection string + +This module uses `CmsKit` for the connection string name. If you don't define a connection string with this name, it fallbacks to the `Default` connection string. + +See the [connection strings](https://docs.abp.io/en/abp/latest/Connection-Strings) documentation for details. + +#### Entity Framework Core + +##### Tables + +- CmsRatings + +#### MongoDB + +##### Collections + +- **CmsRatings** + +### MVC UI + +The ratings system provides a rating widget to allow users send ratings to resources in public websites. You can simply place the widget on a page like below. + +```csharp +@await Component.InvokeAsync(typeof(RatingViewComponent), new +{ + entityType = "entityType", + entityId = "entityId" +}) +``` +You need to specify entity type and entity ID parameters. Entity type represents the group name you specified while defining the reactions in the domain module. Entity ID represents the unique identifier for the resource that users give ratings to, such as blog post ID or product ID. + +For more information about widgets see [widgets](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Widgets) documentation. \ No newline at end of file diff --git a/docs/en/Modules/cms-kit/Reaction-System.md b/docs/en/Modules/cms-kit/Reaction-System.md new file mode 100644 index 0000000000..e1219e24c3 --- /dev/null +++ b/docs/en/Modules/cms-kit/Reaction-System.md @@ -0,0 +1,128 @@ +# Reaction System + +CMS kit provides a **reaction** system to add reactions feature to any kind of resource, like blog posts or comments. This section describes the details of the reaction system. + +## Feature + +CMS kit uses the [global feature](https://docs.abp.io/en/abp/latest/Global-Features) system for all implemented features. Commercial startup templates come with all the CMS kit related features are enabled by default, if you create the solution with the public website option. If you're installing the CMS kit manually or want to enable reaction feature individually, open the `GlobalFeatureConfigurator` class in the `Domain.Shared` project and place the following code to the `Configure ` method. + +```csharp +GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => +{ + cmsKit.Reactions.Enable(); +}); +``` + +# Options + +## CmsKitReactionOptions + +You can use the reaction system to to add reactions feature to any kind of resource, like blog posts or comments, etc. The reaction system provides a mechanism to group reactions by entity types. For example, if you want to use the reaction system for products, you need to define an entity type named `Product`, and then add reactions under the defined entity type. + +`CmsKitReactionOptions` can be configured in the domain layer, in the `ConfigureServices` method of your [module](https://docs.abp.io/en/abp/latest/Module-Development-Basics). Example: + +```csharp +Configure(options => +{ + options.EntityTypes.Add( + new ReactionEntityTypeDefinition( + "Product", + reactions: new[] + { + new ReactionDefinition(StandardReactions.Smile), + new ReactionDefinition(StandardReactions.ThumbsUp), + new ReactionDefinition(StandardReactions.ThumbsDown), + new ReactionDefinition(StandardReactions.Confused), + new ReactionDefinition(StandardReactions.Eyes), + new ReactionDefinition(StandardReactions.Heart) + })); +}); +``` + +> If you're using the comment or blog features, the ABP framework defines predefined reactions for these features automatically. You can easily override or remove the predefined reactions in `Configure` method like shown above. + +`CmsKitReactionOptions` properties: + +- `EntityTypes`: List of defined entity types(`CmsKitReactionOptions`) in the reaction system. + +`ReactionEntityTypeDefinition` properties:asdas + +- `EntityType`: Name of the entity type. +- `Reactions`: List of defined reactions(`ReactionDefinition`) in the entity type. + +# Internals + +## Domain Layer + +#### Aggregates + +This module follows the [Entity Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Entities) guide. + +##### UserReaction + +A user reaction represents a given reaction from a user. + +- `UserReaction` (aggregate root): Represents a given reaction in the system. + +#### Repositories + +This module follows the [Repository Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Repositories) guide. + +Following custom repositories are defined for this feature: + +- `IUserReactionRepository` + +#### Domain services + +This module follows the [Domain Services Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Domain-Services) guide. + +##### Reaction Manager + +`ReactionManager` is used to perform some operations for the `UserReaction` aggregate root. + +### Application layer + +#### Application services + +- `ReactionPublicAppService` (implements `IReactionPublicAppService`): Implements the use cases of reaction system. + +### Database providers + +#### Common + +##### Table / collection prefix & schema + +All tables/collections use the `Cms` prefix by default. Set static properties on the `CmsKitDbProperties` class if you need to change the table prefix or set a schema name (if supported by your database provider). + +##### Connection string + +This module uses `CmsKit` for the connection string name. If you don't define a connection string with this name, it fallbacks to the `Default` connection string. + +See the [connection strings](https://docs.abp.io/en/abp/latest/Connection-Strings) documentation for details. + +#### Entity Framework Core + +##### Tables + +- CmsUserReactions + +#### MongoDB + +##### Collections + +- **CmsUserReactions** + +### MVC UI + +The reaction system provides a reaction widget to allow users to send reactions to resources on public websites. You can place the widget on a page like below. + +```csharp +@await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new +{ + entityType = "entityType", + entityId = "entityId" +}) +``` +You need to specify entity type and entity ID parameters. Entity type represents the group name you specified while defining the reactions in the domain module. Entity ID represents the unique identifier for the resource that users give reactions to, such as blog post ID or product ID. + +For more information about widgets see [widgets](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Widgets) documentation. \ No newline at end of file diff --git a/docs/en/Modules/cms-kit/Tag-Management.md b/docs/en/Modules/cms-kit/Tag-Management.md new file mode 100644 index 0000000000..aa4b675dac --- /dev/null +++ b/docs/en/Modules/cms-kit/Tag-Management.md @@ -0,0 +1,135 @@ +# Tag Management + +CMS kit provides a **tag** system to tag any kind of resources, like blog posts. This section describes the details of the tag system. + +## Feature + +CMS kit uses the [global feature](https://docs.abp.io/en/abp/latest/Global-Features) system for all implemented features. Commercial startup templates come with all the CMS kit related features are enabled by default, if you create the solution with public website option. If you're installing the CMS kit manually or want to enable the tag management feature individually, open the `GlobalFeatureConfigurator` class in the `Domain.Shared` project and place the following code to the `Configure ` method. + +```csharp +GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => +{ + cmsKit.Tags.Enable(); +}); +``` + +# Options + +## CmsKitTagOptions + +You can use the tag system to tag any kind of resources, like blog posts, products, etc. The tag system provides a mechanism to group tags by entity types. For example, if you want to use the tag system for blog posts and products, you need to define two entity types named `BlogPosts` and `Product` and add tags under these entity types. + +`CmsKitTagOptions` can be configured in the domain layer, in the `ConfigureServices` method of your [module](https://docs.abp.io/en/abp/latest/Module-Development-Basics). Example: + +```csharp +Configure(options => +{ + options.EntityTypes.Add(new TagEntityTypeDefiniton("Product")); +}); +``` + +> If you're using the blog feature, the ABP framework defines an entity type for the blog feature automatically. You can easily override or remove the predefined entity types in `Configure` method like shown above. + +`CmsKitTagOptions` properties: + +- `EntityTypes`: List of defined entity types(`TagEntityTypeDefiniton`) in the tag system. + +`TagEntityTypeDefiniton` properties: + +- `EntityType`: Name of the entity type. +- `DisplayName`: Display name of the entity type. You can use a user friendly display name to show entity type definition on the admin website. +- `CreatePolicies`: List of policy names allowing users to create tags under the entity type. +- `UpdatePolicies`: List of policy names allowing users to update tags under the entity type. +- `DeletePolicies`: List of policy names allowing users to delete tags under the entity type. + +# Internals + +## Domain Layer + +#### Aggregates + +This module follows the [Entity Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Entities) guide. + +##### Tag + +A tag represents a tag under the entity type. + +- `Tag` (aggregate root): Represents a tag in the system. + +##### EntityTag + +An entity tag represents a connection between the tag and the tagged entity. + +- `EntityTag`(entity): Represents a connection between the tag and the tagged entity. + +#### Repositories + +This module follows the [Repository Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Repositories) guide. + +Following custom repositories are defined for this feature: + +- `ITagRepository` +- `IEntityTagRepository` + +#### Domain services + +This module follows the [Domain Services Best Practices & Conventions](https://docs.abp.io/en/abp/latest/Best-Practices/Domain-Services) guide. + +##### Tag Manager + +`TagManager` is used to perform some operations for the `Tag` aggregate root. + +##### Entity Tag Manager + +`EntityTagManager` is used to perform some operations for the `EntityTag` entity. + +### Application layer + +#### Application services + +- `TagAdminAppService` (implements `ITagAdminAppService`): Implements the use cases of tag management. +- `EntityTagAdminAppService` (implements `IEntityTagAdminAppService`): Implements the use cases of entity tag relationship. +- `TagAppService` (implements `ITagAppService`): Implements the use cases of entity tag relationship for public websites. + +### Database providers + +#### Common + +##### Table / collection prefix & schema + +All tables/collections use the `Cms` prefix by default. Set static properties on the `CmsKitDbProperties` class if you need to change the table prefix or set a schema name (if supported by your database provider). + +##### Connection string + +This module uses `CmsKit` for the connection string name. If you don't define a connection string with this name, it fallbacks to the `Default` connection string. + +See the [connection strings](https://docs.abp.io/en/abp/latest/Connection-Strings) documentation for details. + +#### Entity Framework Core + +##### Tables + +- CmsTags +- CmsEntityTags + - CmsTags + +#### MongoDB + +##### Collections + +- **CmsTags** +- **CmsEntityTags** + +### MVC UI + +The tag system provides a tag widget to display associated tags of the resource on public websites. You can simply place the widget on a page like below. + +```csharp +@await Component.InvokeAsync(typeof(TagViewComponent), new +{ + entityType = "entityType", + entityId = "entityId" +}) +``` + +For more information about widgets see [widgets](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Widgets) documentation. \ No newline at end of file diff --git a/docs/en/MongoDB.md b/docs/en/MongoDB.md index a12d216b3d..5bcdfe7730 100644 --- a/docs/en/MongoDB.md +++ b/docs/en/MongoDB.md @@ -292,6 +292,24 @@ Configure(options => ### Advanced Topics +### Controlling the Multi-Tenancy + +If your solution is [multi-tenant](Multi-Tenancy.md), tenants may have **separate databases**, you have **multiple** `DbContext` classes in your solution and some of your `DbContext` classes should be usable **only from the host side**, it is suggested to add `[IgnoreMultiTenancy]` attribute on your `DbContext` class. In this case, ABP guarantees that the related `DbContext` always uses the host [connection string](Connection-Strings.md), even if you are in a tenant context. + +**Example:** + +````csharp +[IgnoreMultiTenancy] +public class MyDbContext : AbpMongoDbContext +{ + ... +} +```` + +Do not use the `[IgnoreMultiTenancy]` attribute if any one of your entities in your `DbContext` can be persisted in a tenant database. + +> When you use repositories, ABP already uses the host database for the entities don't implement the `IMultiTenant` interface. So, most of time you don't need to `[IgnoreMultiTenancy]` attribute if you are using the repositories to work with the database. + #### Set Default Repository Classes Default generic repositories are implemented by `MongoDbRepository` class by default. You can create your own implementation and use it for default repository implementation. diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 0a7722de78..8aae7ac96b 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -39,31 +39,6 @@ } ] }, - { - "text": "Startup Templates", - "items": [ - { - "text": "Overall", - "path": "Startup-Templates/Index.md" - }, - { - "text": "Application", - "path": "Startup-Templates/Application.md" - }, - { - "text": "Module", - "path": "Startup-Templates/Module.md" - }, - { - "text": "Console", - "path": "Startup-Templates/Console.md" - }, - { - "text": "WPF", - "path": "Startup-Templates/WPF.md" - } - ] - }, { "text": "Tutorials", "items": [ @@ -122,6 +97,45 @@ } ] }, + { + "text": "CLI", + "path": "CLI.md", + "items": [ + { + "text": "Build Command", + "path": "CLI-BuildCommand.md" + }, + { + "text": "Create Solution Sample Commands", + "path": "CLI-New-Command-Samples.md" + } + ] + }, + { + "text": "Startup Templates", + "items": [ + { + "text": "Overall", + "path": "Startup-Templates/Index.md" + }, + { + "text": "Application", + "path": "Startup-Templates/Application.md" + }, + { + "text": "Module", + "path": "Startup-Templates/Module.md" + }, + { + "text": "Console", + "path": "Startup-Templates/Console.md" + }, + { + "text": "WPF", + "path": "Startup-Templates/WPF.md" + } + ] + }, { "text": "Fundamentals", "items": [ @@ -1292,25 +1306,6 @@ } ] }, - { - "text": "Reference", - "items": [ - { - "text": "CLI", - "path": "CLI.md", - "items": [ - { - "text": "Build Command", - "path": "CLI-BuildCommand.md" - }, - { - "text": "Create Solution Sample Commands", - "path": "CLI-New-Command-Samples.md" - } - ] - } - ] - }, { "text": "Contribution Guide", "path": "Contribution/Index.md" diff --git a/docs/en/images/cmskit-module-blog-post-edit.png b/docs/en/images/cmskit-module-blog-post-edit.png new file mode 100644 index 0000000000..528bc6b499 Binary files /dev/null and b/docs/en/images/cmskit-module-blog-post-edit.png differ diff --git a/docs/en/images/cmskit-module-blog-posts-page.png b/docs/en/images/cmskit-module-blog-posts-page.png new file mode 100644 index 0000000000..64d5d0e934 Binary files /dev/null and b/docs/en/images/cmskit-module-blog-posts-page.png differ diff --git a/docs/en/images/cmskit-module-blogs-edit.png b/docs/en/images/cmskit-module-blogs-edit.png new file mode 100644 index 0000000000..b2da4e5b5a Binary files /dev/null and b/docs/en/images/cmskit-module-blogs-edit.png differ diff --git a/docs/en/images/cmskit-module-blogs-feature-action.png b/docs/en/images/cmskit-module-blogs-feature-action.png new file mode 100644 index 0000000000..c0f0b1d3f4 Binary files /dev/null and b/docs/en/images/cmskit-module-blogs-feature-action.png differ diff --git a/docs/en/images/cmskit-module-blogs-page.png b/docs/en/images/cmskit-module-blogs-page.png new file mode 100644 index 0000000000..6c150429b7 Binary files /dev/null and b/docs/en/images/cmskit-module-blogs-page.png differ diff --git a/docs/en/images/cmskit-module-comment-page.png b/docs/en/images/cmskit-module-comment-page.png new file mode 100644 index 0000000000..6647a6dd09 Binary files /dev/null and b/docs/en/images/cmskit-module-comment-page.png differ diff --git a/docs/en/images/cmskit-module-comments-detail.png b/docs/en/images/cmskit-module-comments-detail.png new file mode 100644 index 0000000000..686a70e1f8 Binary files /dev/null and b/docs/en/images/cmskit-module-comments-detail.png differ diff --git a/docs/en/images/cmskit-module-features-dialog.png b/docs/en/images/cmskit-module-features-dialog.png new file mode 100644 index 0000000000..23aa2aa17a Binary files /dev/null and b/docs/en/images/cmskit-module-features-dialog.png differ diff --git a/docs/en/images/cmskit-module-pages-edit.png b/docs/en/images/cmskit-module-pages-edit.png new file mode 100644 index 0000000000..cca074fdac Binary files /dev/null and b/docs/en/images/cmskit-module-pages-edit.png differ diff --git a/docs/en/images/cmskit-module-pages-page.png b/docs/en/images/cmskit-module-pages-page.png new file mode 100644 index 0000000000..b64915493c Binary files /dev/null and b/docs/en/images/cmskit-module-pages-page.png differ diff --git a/docs/en/images/cmskit-module-ratings.png b/docs/en/images/cmskit-module-ratings.png new file mode 100644 index 0000000000..f97c934f15 Binary files /dev/null and b/docs/en/images/cmskit-module-ratings.png differ diff --git a/docs/en/images/cmskit-module-reactions.png b/docs/en/images/cmskit-module-reactions.png new file mode 100644 index 0000000000..b915b85f91 Binary files /dev/null and b/docs/en/images/cmskit-module-reactions.png differ diff --git a/docs/en/images/cmskit-module-tag-edit.png b/docs/en/images/cmskit-module-tag-edit.png new file mode 100644 index 0000000000..eb1ebb3a52 Binary files /dev/null and b/docs/en/images/cmskit-module-tag-edit.png differ diff --git a/docs/en/images/cmskit-module-tags-page.png b/docs/en/images/cmskit-module-tags-page.png new file mode 100644 index 0000000000..f41b6ecbd0 Binary files /dev/null and b/docs/en/images/cmskit-module-tags-page.png differ