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" />
                    
Directory.Packages.props
<PackageReference Include="MCAkbayir.XFramework.Extensions" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=MCAkbayir.XFramework.Extensions&version=1.0.17
                    
Install as a Cake Tool

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 DefaultConnection and LogConnection are required — The app throws InvalidOperationException at 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 — UseSwagger and UseSwaggerUI are skipped in production.
  • The Logs table is created via EF migration — AutoCreateSqlTable is disabled. Run dotnet ef migrations add and dotnet ef database update on the LogContext to 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, InvalidOperationException with [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 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.17 143 2/19/2026
1.0.16 118 2/18/2026