FortiCore 1.0.1
See the version list below for details.
dotnet add package FortiCore --version 1.0.1
NuGet\Install-Package FortiCore -Version 1.0.1
<PackageReference Include="FortiCore" Version="1.0.1" />
<PackageVersion Include="FortiCore" Version="1.0.1" />
<PackageReference Include="FortiCore" />
paket add FortiCore --version 1.0.1
#r "nuget: FortiCore, 1.0.1"
#:package FortiCore@1.0.1
#addin nuget:?package=FortiCore&version=1.0.1
#tool nuget:?package=FortiCore&version=1.0.1
FortiCore Library
FortiCore is a .NET library that provides core functionality for building robust web applications with features like logging, validation, and exception handling. This solution includes both the core library and a test API project.
🚀 Features
Core Library Features
- MediatR Integration - Built-in CQRS pattern support
- Logging System
- Elasticsearch integration
- Request/Response logging
- Exception logging
- Reference ID tracking
- Validation Framework - FluentValidation integration
- Exception Handling - Centralized error management
- Response Standardization - Consistent API responses
- Core Controllers
- Base controller implementation
- Standardized HTTP response handling
- Common controller functionality
🛠 Technology Stack
- .NET 8.0
- MediatR 12.4.1
- FluentValidation
- Elasticsearch
- NEST 7.17.5
- Serilog 4.0
- Docker & Docker Compose
📦 Installation
- Clone the repository
- Build the solution:
dotnet build
- Run the Elasticsearch and Kibana containers:
docker-compose up -d
🔧 Configuration
Elasticsearch Setup
The default configuration connects to:
- Elasticsearch: http://localhost:9200
- Kibana: http://localhost:5601
Logging Configuration
Logs are automatically sent to Elasticsearch with the following information:
- Timestamp
- Log Level
- Method Information
- Request/Response Data
- Execution Time
- Reference ID
💡 Usage Examples
Adding FortiCore to Your Project
builder.Services.AddCustomLogging(typeof(Program).Assembly);
Creating a Query Handler
public class UserInformationQueryHandler : IRequestHandler<UserInformationQuery, UserInformationQueryResult>
{
public async Task<UserInformationQueryResult> Handle(UserInformationQuery request,
CancellationToken cancellationToken)
{
return new UserInformationQueryResult() { Users = list }.ToSuccessResult();
}
}
Using BaseController
The BaseController
is located in FortiCore.Core.Controllers
namespace and provides a standardized way to handle HTTP responses in your API controllers.
using FortiCore.Core.Controllers;
public class YourController : BaseController
{
public IActionResult YourAction()
{
var response = new ApiResponse<YourData>();
// ... your logic here ...
return CreateResponse(response);
}
}
The BaseController provides:
- Standardized response handling through
CreateResponse<T>
method - Automatic HTTP status code mapping (200 for success, 400 for failure)
- Integration with FortiCore's response models
🔐 License
This project is licensed under the MIT License - see the LICENSE.txt file for details.
👥 Contributors
- Cuneyt Serdaroglu
📫 Support
For support, please open an issue in the repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0-preview1)
- MediatR (>= 12.4.1)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Microsoft.Extensions.Logging (>= 8.0.1)
- NEST (>= 7.17.5)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 4.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.