mirror of https://github.com/abpframework/abp
Merge branch 'dev' of https://github.com/abpframework/abp into feat/confirmation-dismiss
commit
49046a3ba8
@ -0,0 +1,227 @@
|
||||
# SignalR Integration
|
||||
|
||||
> It is already possible to follow [the standard Microsoft tutorial](https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr) to add [SignalR](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction) to your application. However, ABP provides a SignalR integration packages that simplify the integration and usage.
|
||||
|
||||
## Installation
|
||||
|
||||
### Server Side
|
||||
|
||||
It is suggested to use the [ABP CLI](CLI.md) to install this package.
|
||||
|
||||
#### Using the ABP CLI
|
||||
|
||||
Open a command line window in the folder of your project (.csproj file) and type the following command:
|
||||
|
||||
```bash
|
||||
abp add-package Volo.Abp.AspNetCore.SignalR
|
||||
```
|
||||
|
||||
> You typically want to add this package to the web or API layer of your application, depending on your architecture.
|
||||
|
||||
#### Manual Installation
|
||||
|
||||
If you want to manually install;
|
||||
|
||||
1. Add the [Volo.Abp.AspNetCore.SignalR](https://www.nuget.org/packages/Volo.Abp.AspNetCore.SignalR) NuGet package to your project:
|
||||
|
||||
```
|
||||
Install-Package Volo.Abp.BackgroundJobs.HangFire
|
||||
```
|
||||
|
||||
Or use the Visual Studio NuGet package management UI to install it.
|
||||
|
||||
2. Add the `AbpAspNetCoreSignalRModule` to the dependency list of your module:
|
||||
|
||||
```csharp
|
||||
[DependsOn(
|
||||
//...other dependencies
|
||||
typeof(AbpAspNetCoreSignalRModule) //Add the new module dependency
|
||||
)]
|
||||
public class YourModule : AbpModule
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
> You don't need to use the `services.AddSignalR()` and the `app.UseEndpoints(...)`, it's done by the `AbpAspNetCoreSignalRModule`.
|
||||
|
||||
### Client Side
|
||||
|
||||
Client side installation depends on your UI framework / client type.
|
||||
|
||||
#### ASP.NET Core MVC / Razor Pages UI
|
||||
|
||||
Run the following command in the root folder of your web project:
|
||||
|
||||
````bash
|
||||
yarn add @abp/signalr
|
||||
````
|
||||
|
||||
> This requires to [install yarn](https://yarnpkg.com/) if you haven't install before.
|
||||
|
||||
This will add the `@abp/signalr` to the dependencies in the `package.json` of your project:
|
||||
|
||||
````json
|
||||
{
|
||||
...
|
||||
"dependencies": {
|
||||
...
|
||||
"@abp/signalr": "~2.7.0"
|
||||
}
|
||||
}
|
||||
````
|
||||
|
||||
Run the `gulp` in the root folder of your web project:
|
||||
|
||||
````bash
|
||||
gulp
|
||||
````
|
||||
|
||||
This will copy the SignalR JavaScript files into your project:
|
||||
|
||||
![signal-js-file](images/signal-js-file.png)
|
||||
|
||||
Finally, add the following code to your page/view to include the `signalr.js` file
|
||||
|
||||
````xml
|
||||
@section scripts {
|
||||
<abp-script type="typeof(SignalRBrowserScriptContributor)" />
|
||||
}
|
||||
````
|
||||
|
||||
It requires to add `@using Volo.Abp.AspNetCore.Mvc.UI.Packages.SignalR` to your page/view.
|
||||
|
||||
> You could add the `signalr.js` file in a standard way. But using the `SignalRBrowserScriptContributor` has additional benefits. See the [Client Side Package Management](UI/AspNetCore/Client-Side-Package-Management.md) and [Bundling & Minification](UI/AspNetCore/Bundling-Minification.md) documents for details.
|
||||
|
||||
That's all. you can use the [SignalR JavaScript API](https://docs.microsoft.com/en-us/aspnet/core/signalr/javascript-client) in your page.
|
||||
|
||||
#### Other UI Frameworks / Clients
|
||||
|
||||
Please refer to [Microsoft's documentation](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction) for other type of clients.
|
||||
|
||||
## The ABP Framework Integration
|
||||
|
||||
This section covers the additional benefits when you use the ABP Framework integration packages.
|
||||
|
||||
### Hub Route & Mapping
|
||||
|
||||
ABP automatically registers all the hubs to the [dependency injection](Dependency-Injection.md) (as transient) and maps the hub endpoint. So, you don't have to use the ` app.UseEndpoints(...)` to map your hubs. Hub route (URL) is determined conventionally based on your hub name.
|
||||
|
||||
Example:
|
||||
|
||||
````csharp
|
||||
public class MessagingHub : Hub
|
||||
{
|
||||
//...
|
||||
}
|
||||
````
|
||||
|
||||
The hub route will be `/signalr-hubs/messasing` for the `MessasingHub`:
|
||||
|
||||
* Adding a standard `/signalr-hubs/` prefix
|
||||
* Continue with the **camel case** hub name, without the `Hub` suffix.
|
||||
|
||||
If you want to specify the route, you can use the `HubRoute` attribute:
|
||||
|
||||
````csharp
|
||||
[HubRoute("/my-messasing-hub")]
|
||||
public class MessagingHub : Hub
|
||||
{
|
||||
//...
|
||||
}
|
||||
````
|
||||
|
||||
### AbpHub Base Classes
|
||||
|
||||
Instead of the standard `Hub` and `Hub<T>` classes, you can inherit from the `AbpHub` or `AbpHub<T>` which hve useful base properties like `CurrentUser`.
|
||||
|
||||
Example:
|
||||
|
||||
````csharp
|
||||
public class MessagingHub : AbpHub
|
||||
{
|
||||
public async Task SendMessage(string targetUserName, string message)
|
||||
{
|
||||
var currentUserName = CurrentUser.UserName; //Access to the current user info
|
||||
var txt = L["MyText"]; //Localization
|
||||
}
|
||||
}
|
||||
````
|
||||
|
||||
> While you could inject the same properties into your hub constructor, this way simplifies your hub class.
|
||||
|
||||
### Manual Registration / Mapping
|
||||
|
||||
ABP automatically registers all the hubs to the [dependency injection](Dependency-Injection.md) as a **transient service**. If you want to **disable auto dependency injection** registration for your hub class, just add a `DisableConventionalRegistration` attribute. You can still register your hub class to dependency injection in the `ConfigureServices` method of your module if you like:
|
||||
|
||||
````csharp
|
||||
context.Services.AddTransient<MessagingHub>();
|
||||
````
|
||||
|
||||
When **you or ABP** register the class to the dependency injection, it is automatically mapped to the endpoint route configuration just as described in the previous sections. You can use `DisableAutoHubMap` attribute if you want to manually map your hub class.
|
||||
|
||||
For manual mapping, you have two options:
|
||||
|
||||
1. Use the `AbpSignalROptions` to add your map configuration (in the `ConfigureServices` method of your [module](Module-Development-Basics.md)), so ABP still performs the endpoint mapping for your hub:
|
||||
|
||||
````csharp
|
||||
Configure<AbpSignalROptions>(options =>
|
||||
{
|
||||
options.Hubs.Add(
|
||||
new HubConfig(
|
||||
typeof(MessagingHub), //Hub type
|
||||
"/my-messaging/route", //Hub route (URL)
|
||||
hubOptions =>
|
||||
{
|
||||
//Additional options
|
||||
hubOptions.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
````
|
||||
|
||||
This is a good way to provide additional SignalR options.
|
||||
|
||||
If you don't want to disable auto hub map, but still want to perform additional SignalR configuration, use the `options.Hubs.AddOrUpdate(...)` method:
|
||||
|
||||
````csharp
|
||||
Configure<AbpSignalROptions>(options =>
|
||||
{
|
||||
options.Hubs.AddOrUpdate(
|
||||
typeof(MessagingHub), //Hub type
|
||||
config => //Additional configuration
|
||||
{
|
||||
config.RoutePattern = "/my-messaging-hub"; //override the default route
|
||||
config.ConfigureActions.Add(hubOptions =>
|
||||
{
|
||||
//Additional options
|
||||
hubOptions.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
````
|
||||
|
||||
This is the way you can modify the options of a hub class defined in a depended module (where you don't have the source code access).
|
||||
|
||||
2. Change `app.UseConfiguredEndpoints` in the `OnApplicationInitialization` method of your [module](Module-Development-Basics.md) as shown below (added a lambda method as the parameter).
|
||||
|
||||
````csharp
|
||||
app.UseConfiguredEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHub<MessagingHub>("/my-messaging-hub", options =>
|
||||
{
|
||||
options.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
|
||||
});
|
||||
});
|
||||
````
|
||||
|
||||
### UserIdProvider
|
||||
|
||||
ABP implements SignalR's `IUserIdProvider` interface to provide the current user id from the `ICurrentUser` service of the ABP framework (see [the current user service](CurrentUser.md)), so it will be integrated to the authentication system of your application. The implementing class is the `AbpSignalRUserIdProvider`, if you want to change/override it.
|
||||
|
||||
## Example Application
|
||||
|
||||
See the [SignalR Integration Demo](https://github.com/abpframework/abp-samples/tree/master/SignalRDemo) as a sample application. It has a simple Chat page to send messages between (authenticated) users.
|
||||
|
||||
![signalr-demo-chat](images/signalr-demo-chat.png)
|
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 45 KiB |
@ -0,0 +1,56 @@
|
||||
# 示例应用
|
||||
|
||||
这些是ABP框架创建的官方示例. 这些示例大部分在[abpframework/abp-samples](https://github.com/abpframework/abp-samples) GitHub 仓库.
|
||||
|
||||
### 微服务示例
|
||||
|
||||
演示如何基于微服务体系结构构建系统的完整解决方案.
|
||||
|
||||
* [示例的文档](Microservice-Demo.md)
|
||||
* [源码](https://github.com/abpframework/abp/tree/dev/samples/MicroserviceDemo)
|
||||
* [微服务架构文档](../Microservice-Architecture.md)
|
||||
|
||||
### Book Store
|
||||
|
||||
一个简单的CRUD应用程序,展示了使用ABP框架开发应用程序的基本原理. 使用不同的技术实现了相同的示例:
|
||||
|
||||
* **Book Store: Razor Pages UI & Entity Framework Core**
|
||||
|
||||
* [教程](https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC)
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/BookStore)
|
||||
|
||||
* **Book Store: Angular UI & MongoDB**
|
||||
|
||||
* [教程](https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=NG)
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/BookStore-Angular-MongoDb)
|
||||
|
||||
* **Book Store: Modular application (Razor Pages UI & EF Core)**
|
||||
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/BookStore-Modular)
|
||||
|
||||
如果没有Razor Pages & MongoDB 结合,但你可以检查两个文档来理解它,因为DB和UI不会互相影响.
|
||||
|
||||
### 其他示例
|
||||
|
||||
* **Entity Framework 迁移**: 演示如何将应用程序拆分为多个数据库的解决方案. 每个数据库包含不同的模块.
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/DashboardDemo)
|
||||
* [EF Core数据库迁移文档](../Entity-Framework-Core-Migrations.md)
|
||||
* **Dashboard Demo**: 一个简单的应用程序,展示了如何在ASP.NET Core MVC UI中使用widget系统.
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/DashboardDemo)
|
||||
* [Widget 文档](../UI/AspNetCore/Widgets.md)
|
||||
* **RabbitMQ 事件总线 Demo**: 由两个通过RabbitMQ集成的分布式事件相互通信的应用程序组成的解决方案.
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/RabbitMqEventBus)
|
||||
* [分布式事件总线文档](../Distributed-Event-Bus.md)
|
||||
* [RabbitMQ 分布式事件总线集成文档](../Distributed-Event-Bus-RabbitMQ-Integration.md)
|
||||
* **自定义认证**: 如何为ASP.NET Core MVC / Razor Pages应用程序自定义身份验证的解决方案.
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/aspnet-core/Authentication-Customization)
|
||||
* 相关 "[How To](../How-To/Index.md)" 文档:
|
||||
* [Azure Active Directory 认证](../How-To/Azure-Active-Directory-Authentication-MVC.md)
|
||||
* [自定义登录页面](../How-To/Customize-Login-Page-MVC.md)
|
||||
* [自定义 SignIn Manager](../How-To/Customize-SignIn-Manager.md)
|
||||
* **空的ASP.NET Core应用程序**: 从基本的ASP.NET Core应用程序使用ABP框架.
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/BasicAspNetCoreApplication)
|
||||
* [文档](../Getting-Started-AspNetCore-Application.md)
|
||||
* **空的控制台应用程序**: 从基本的控制台应用程序安装ABP框架.
|
||||
* [源码](https://github.com/abpframework/abp-samples/tree/master/BasicConsoleApplication)
|
||||
* [文档](../Getting-Started-Console-Application.md)
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"culture": "es",
|
||||
"texts": {
|
||||
"DisplayName:Abp.Mailing.DefaultFromAddress": "Dirección de envío",
|
||||
"DisplayName:Abp.Mailing.DefaultFromDisplayName": "Nombre de envío",
|
||||
"DisplayName:Abp.Mailing.Smtp.Host": "Host",
|
||||
"DisplayName:Abp.Mailing.Smtp.Port": "Puerto",
|
||||
"DisplayName:Abp.Mailing.Smtp.UserName": "Nombre de usuario",
|
||||
"DisplayName:Abp.Mailing.Smtp.Password": "Contraseña",
|
||||
"DisplayName:Abp.Mailing.Smtp.Domain": "Dominio",
|
||||
"DisplayName:Abp.Mailing.Smtp.EnableSsl": "Habilitar SSL",
|
||||
"DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "Usar las credenciales por defecto",
|
||||
"Description:Abp.Mailing.DefaultFromAddress": "La dirección de envío por defecto",
|
||||
"Description:Abp.Mailing.DefaultFromDisplayName": "El nombre de envío por defecto",
|
||||
"Description:Abp.Mailing.Smtp.Host": "El nombre o dirección del host para transacciones SMTP.",
|
||||
"Description:Abp.Mailing.Smtp.Port": "El puerto usado para transacciones SMTP.",
|
||||
"Description:Abp.Mailing.Smtp.UserName": "Nombre de usuario asociado a las credenciales.",
|
||||
"Description:Abp.Mailing.Smtp.Password": "La contraseña del ususario asociado a las credenciales.",
|
||||
"Description:Abp.Mailing.Smtp.Domain": "El dominio o equipo que valida las credenciales.",
|
||||
"Description:Abp.Mailing.Smtp.EnableSsl": "Si SmtpClient usa Secure Sockets Layer (SSL) para encriptar la conección.",
|
||||
"Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Si las credenciales por defecto se envían con los request."
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"culture": "es",
|
||||
"texts": {
|
||||
"Menu:Administration": "Administración"
|
||||
"Menu:Administration": "Administración"
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
{
|
||||
"culture": "es",
|
||||
"texts": {
|
||||
"UserName": "Nombre de usuario",
|
||||
"EmailAddress": "Dirección de correo electrónico",
|
||||
"UserNameOrEmailAddress": "Nombre de usuario o dirección de correo electrónico",
|
||||
"Password": "Contraseña",
|
||||
"RememberMe": "Recuérdame",
|
||||
"UseAnotherServiceToLogin": "Usar otro servicio para iniciar sesión",
|
||||
"UserLockedOutMessage": "La cuenta de usuario ha sido bloqueada debido a los intentos de inicio de sesión no válidos. Por favor, espere unos minutos y vuelve a intentarlo.",
|
||||
"InvalidUserNameOrPassword": "El nombre de usuario o la contraseña no son válidos",
|
||||
"LoginIsNotAllowed": "No está permitido el inicio de sesión! Usted tendrá que confirmar su correo electrónico o número de teléfono.",
|
||||
"SelfRegistrationDisabledMessage": "El autoregistro de usuario está deshabilitado para esta aplicación. Póngase en contacto con el administrador de la aplicación para registrar un nuevo usuario.",
|
||||
"LocalLoginDisabledMessage": "No está habilitado el login local para esta aplicación.",
|
||||
"Login": "Iniciar sesión",
|
||||
"Cancel": "Cancelar",
|
||||
"Register": "Registrarse",
|
||||
"AreYouANewUser": "¿Usted es un usuario nuevo?",
|
||||
"AlreadyRegistered": "¿Está registrado en esta aplicación?",
|
||||
"InvalidLoginRequest": "Solicitud de inicio de sesión no válido",
|
||||
"ThereAreNoLoginSchemesConfiguredForThisClient": "No hay ningún esquema de inicio de sesión configurado para este cliente.",
|
||||
"LogInUsingYourProviderAccount": "Inicia sesión con tu cuenta de {0} ",
|
||||
"DisplayName:CurrentPassword": "Contraseña actual",
|
||||
"DisplayName:NewPassword": "Nueva contraseña",
|
||||
"DisplayName:NewPasswordConfirm": "Confirmar nueva contraseña",
|
||||
"PasswordChangedMessage": "Su contraseña ha sido cambiada con éxito.",
|
||||
"DisplayName:UserName": "Nombre de usuario",
|
||||
"DisplayName:Email": "Correo electrónico",
|
||||
"DisplayName:Name": "Nombre",
|
||||
"DisplayName:Surname": "Apellido",
|
||||
"DisplayName:Password": "Contraseña",
|
||||
"DisplayName:EmailAddress": "Dirección de correo electrónico",
|
||||
"DisplayName:PhoneNumber": "Número de teléfono",
|
||||
"PersonalSettings": "Configuración Personal",
|
||||
"PersonalSettingsSaved": "Ajustes personales guardados",
|
||||
"PasswordChanged": "Cambiar la contraseña",
|
||||
"NewPasswordConfirmFailed": "Por favor, confirme la nueva contraseña.",
|
||||
"Manage": "Administrar",
|
||||
"ManageYourProfile": "Gestionar su perfil",
|
||||
"DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Habilitar el registro de usuario",
|
||||
"Description:Abp.Account.IsSelfRegistrationEnabled": "Si está habilitado los usuarios pueden crear una cuenta mediante el registro automático.",
|
||||
"DisplayName:Abp.Account.EnableLocalLogin": "Habilitar cuenta local",
|
||||
"Description:Abp.Account.EnableLocalLogin": "Indica que el servidor permite iniciar sessión con una cuenta local."
|
||||
}
|
||||
}
|
Loading…
Reference in new issue