MCAkbayir.XFramework.Extensions
1.0.17
dotnet add package MCAkbayir.XFramework.Extensions --version 1.0.17
NuGet\Install-Package MCAkbayir.XFramework.Extensions -Version 1.0.17
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MCAkbayir.XFramework.Extensions" Version="1.0.17" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MCAkbayir.XFramework.Extensions" Version="1.0.17" />
<PackageReference Include="MCAkbayir.XFramework.Extensions" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MCAkbayir.XFramework.Extensions --version 1.0.17
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MCAkbayir.XFramework.Extensions, 1.0.17"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MCAkbayir.XFramework.Extensions@1.0.17
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MCAkbayir.XFramework.Extensions&version=1.0.17
#tool nuget:?package=MCAkbayir.XFramework.Extensions&version=1.0.17
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MCAkbayir.XFramework.Extensions
One-line infrastructure setup for your XFramework projects. Configures everything you need to get a ASP.NET Core Web API up and running.
✨ Features
| Feature | Description |
|---|---|
| JWT Authentication | Automatic JWT Bearer configuration via appsettings.json |
| CORS | Flexible CORS policy management |
| Serilog | Console + MSSQL logging (UserId, IPAddress, ActionName, TraceIdentifier) |
| Rate Limiter | Request rate limiting support |
| Swagger | JWT-enabled SwaggerUI (Development environment) |
| EF Core | Dual DbContext setup (Main + Log) |
| AutoMapper | Assembly-based automatic profile scanning |
| FluentValidation | Assembly-based automatic validator discovery |
| Exception Middleware | Global error handling |
| Logging Middleware | Request/response logging |
🚀 Installation
dotnet add package MCAkbayir.XFramework.Extensions
📖 Usage
In your Program.cs:
// Register services
builder.Services.AddXFramework<MainDbContext, LogDbContext>(builder.Configuration);
// Configure pipeline
app.UseXFramework(app.Environment);
appsettings.json configuration:
{
"ConnectionStrings": {
"DefaultConnection": "Server=...;Database=MainDb;...",
"LogConnection": "Server=...;Database=LogDb;..."
},
"Jwt": {
"Issuer": "MyAPI",
"Audience": "MyClient",
"Key": "SuperSecretKey-AtLeast32Characters!!",
"ExpireInMinutes": 60
},
"Cors": {
"PolicyName": "AllowSpecificOrigins",
"AllowedOrigins": ["http://localhost:3000"],
"AllowCredentials": true
},
"Cache": {
"UserPageCacheMinutes": 5,
"UserEndpointCacheMinutes": 10,
"UseDistributed": false
},
"RateLimit": {
"IpPermitLimit": 100,
"IpWindowMinutes": 1,
"UserPermitLimit": 50,
"UserWindowMinutes": 1,
"EnableRateLimiting": true
},
"Encryption": {
"Key": "32-Character-Encryption-Key-Here!",
"IV": "16CharacterIV!!!"
},
"RabbitMQ": {
"Hostname": "localhost",
"Username": "guest",
"Password": "guest",
"ExchangeName": "my_exchange",
"QueueName": "my_queue",
"RoutingKey": "my_routing_key"
}
}
⚠️ Important Notes
- Both
DefaultConnectionandLogConnectionare required — The app throwsInvalidOperationExceptionat startup if either is missing. - Jwt, Cors, Cache, RateLimit, and Encryption configs are validated on startup — Invalid or missing values will prevent the app from starting. RabbitMQ is the only optional section.
- Swagger is only enabled in Development —
UseSwaggerandUseSwaggerUIare skipped in production. - The
Logstable is created via EF migration —AutoCreateSqlTableis disabled. Rundotnet ef migrations addanddotnet ef database updateon theLogContextto create the table. - SQL Server is required — Both DbContexts use
UseSqlServer. Other providers are not supported out of the box. - Exception middleware maps specific exceptions —
KeyNotFoundException→ 404,UnauthorizedAccessException→ 403,InvalidOperationExceptionwith[CONFLICT]prefix → 409. Everything else → 500. - Rate limiter skips unauthenticated users for user-based limiting — Anonymous requests are only limited by IP, not by user policy.
📄 License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- AutoMapper (>= 15.0.1)
- FluentValidation (>= 12.0.0)
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 9.0.11)
- Microsoft.EntityFrameworkCore (>= 9.0.11)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.11)
- Microsoft.Extensions.Configuration (>= 9.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.11)
- Microsoft.OpenApi (>= 1.6.22)
- Serilog.Sinks.Console (>= 6.1.1)
- Serilog.Sinks.MSSqlServer (>= 9.0.1)
- Swashbuckle.AspNetCore.Swagger (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.2)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.