![]() |
VOOZH | about |
dotnet add package Eaf.Middleware.Web.Core --version 9.1.0
NuGet\Install-Package Eaf.Middleware.Web.Core -Version 9.1.0
<PackageReference Include="Eaf.Middleware.Web.Core" Version="9.1.0" />
<PackageVersion Include="Eaf.Middleware.Web.Core" Version="9.1.0" />Directory.Packages.props
<PackageReference Include="Eaf.Middleware.Web.Core" />Project file
paket add Eaf.Middleware.Web.Core --version 9.1.0
#r "nuget: Eaf.Middleware.Web.Core, 9.1.0"
#:package Eaf.Middleware.Web.Core@9.1.0
#addin nuget:?package=Eaf.Middleware.Web.Core&version=9.1.0Install as a Cake Addin
#tool nuget:?package=Eaf.Middleware.Web.Core&version=9.1.0Install as a Cake Tool
O Eaf.Middleware.Web.Core é o módulo web do Enterprise Application Foundation (EAF). Este módulo fornece componentes web para ASP.NET Core incluindo configuração de startup, middleware, filtros, controllers, SignalR, Swagger, health checks e integração HTTP.
Este módulo serve como a camada de apresentação web, integrando todos os componentes do EAF com ASP.NET Core e fornecendo funcionalidades prontas para uso em aplicações web.
dotnet add package Eaf.Middleware.Web.Core --version 10.4.0
Adicione a referência ao seu arquivo .csproj:
<ProjectReference Include="..\Eaf.Middleware.Web.Core\Eaf.Middleware.Web.Core.csproj" />
No Startup.cs ou Program.cs:
[DependsOn(
typeof(MiddlewareWebCoreModule),
typeof(MiddlewareApplicationModule)
)]
public class MyWebModule : AbpModule
{
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
}
}
public class Startup
{
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddEafWebCore(options =>
{
options.ConnectionString = Configuration.GetConnectionString("Default");
});
}
public void Configure(IApplicationBuilder app)
{
app.UseEafWebCore();
}
}
public class TaskController : EafControllerBase
{
private readonly ITaskAppService _taskAppService;
public TaskController(ITaskAppService taskAppService)
{
_taskAppService = taskAppService;
}
[HttpGet]
public async Task<PagedResultDto<TaskDto>> GetAll(GetAllTasksInput input)
{
return await _taskAppService.GetAll(input);
}
[HttpPost]
public async Task<TaskDto> Create(CreateTaskInput input)
{
return await _taskAppService.Create(input);
}
[HttpPut]
public async Task<TaskDto> Update(UpdateTaskInput input)
{
return await _taskAppService.Update(input);
}
[HttpDelete]
public async Task Delete(EntityDto input)
{
await _taskAppService.Delete(input);
}
}
No Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "My API",
Version = "v1",
Description = "API documentation"
});
});
}
public void Configure(IApplicationBuilder app)
{
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
}
public class MyHub : AbpHub
{
public async Task SendMessage(string message)
{
await Clients.All.SendAsync("ReceiveMessage", message);
}
}
// No Startup.cs
public void Configure(IApplicationBuilder app)
{
app.UseSignalR(routes =>
{
routes.MapHub<MyHub>("/myHub");
});
}
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddCheck("database", new SqlConnectionHealthCheck(Configuration.GetConnectionString("Default")))
.AddCheck("redis", new RedisHealthCheck(Configuration.GetConnectionString("Redis")));
}
public void Configure(IApplicationBuilder app)
{
app.UseHealthChecks("/health");
app.UseHealthChecks("/health/ready", new HealthCheckOptions
{
Predicate = check => check.Name == "database"
});
}
Eaf.Middleware.Web.Core/
├── Authentication/ # Configurações de autenticação
├── Configuration/ # Configuração de startup e middleware
├── Controllers/ # Controllers base
├── Features/ # Features específicas
├── HealthChecks/ # Health checks
├── Helpers/ # Helpers utilitários
├── Models/ # Models DTOs
├── Notifications/ # Notificações
├── Security/ # Configurações de segurança
├── Serilog/ # Configuração do Serilog
├── Session/ # Gerenciamento de sessão
├── SignalR/ # Hubs SignalR
├── Swagger/ # Configuração Swagger
├── UiCustomization/ # Customização de UI
├── Url/ # Helpers de URL
└── WebHooks/ # WebHooks
public void ConfigureServices(IServiceCollection services)
{
services.AddSerilog(options =>
{
options.WriteTo.Elasticsearch(Configuration.GetConnectionString("Elasticsearch"));
options.WriteTo.Seq(Configuration.GetConnectionString("Seq"));
});
}
{
"Redis": {
"ConnectionString": "localhost:6379",
"InstanceName": "MyApp"
}
}
O Hangfire seleciona automaticamente o tipo de armazenamento com base no provider de banco de dados e configurações de Redis:
Database:Provider = SqlServer/MSSQL): Usa SQL Server storageRedisCache:IsEnabled = true): Usa Redis storage via Hangfire.Redis.StackExchange// A configuração é feita automaticamente pelo HangFireConfigurer.Configure()
// O tipo de storage é resolvido por HangFireConfigurer.ResolveStorageType()
public void ConfigureServices(IServiceCollection services)
{
HangFireConfigurer.Configure(services, Configuration);
}
{
"Hangfire": {
"IsEnabled": "true",
"IsInMemoryDatabase": "false"
},
"RedisCache": {
"IsEnabled": "true",
"ConnectionString": "localhost:6379",
"DatabaseId": 0
}
}
Os testes para este módulo devem ser criados seguindo o padrão dos outros módulos do EAF.
Este projeto faz parte do Enterprise Application Foundation (EAF) e está licenciado sob os mesmos termos do projeto principal.
Para issues e perguntas, consulte o repositório principal do EAF: https://github.com/afonsoft/EAF
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.1.0 | 92 | 6/12/2026 |