Enigmatry.Entry.AspNetCore
9.1.1-preview.4
dotnet add package Enigmatry.Entry.AspNetCore --version 9.1.1-preview.4
NuGet\Install-Package Enigmatry.Entry.AspNetCore -Version 9.1.1-preview.4
<PackageReference Include="Enigmatry.Entry.AspNetCore" Version="9.1.1-preview.4" />
<PackageVersion Include="Enigmatry.Entry.AspNetCore" Version="9.1.1-preview.4" />
<PackageReference Include="Enigmatry.Entry.AspNetCore" />
paket add Enigmatry.Entry.AspNetCore --version 9.1.1-preview.4
#r "nuget: Enigmatry.Entry.AspNetCore, 9.1.1-preview.4"
#addin nuget:?package=Enigmatry.Entry.AspNetCore&version=9.1.1-preview.4&prerelease
#tool nuget:?package=Enigmatry.Entry.AspNetCore&version=9.1.1-preview.4&prerelease
ASP.NET Core Extensions
A library that provides extensions and utilities for ASP.NET Core applications, enhancing the framework with additional features and patterns.
Intended Usage
Use this library to extend your ASP.NET Core applications with features such as enhanced exception handling, HTTPS security configuration, action result extensions, and transaction handling.
Installation
Add the package to your project:
dotnet add package Enigmatry.Entry.AspNetCore
Usage Examples
Using the Exception Handling Extensions
using Enigmatry.Entry.AspNetCore.Exceptions;
using Microsoft.AspNetCore.Builder;
public class Startup
{
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Add global exception handling middleware
app.UseEntryExceptionHandler();
// Other middleware
//...
}
}
Using HTTPS Configuration Extensions
using Enigmatry.Entry.AspNetCore.Security;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Setup HTTPS with appropriate settings based on environment
services.AddEntryHttps(Environment);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Configure HTTPS middleware with appropriate settings for the environment
app.UseEntryHttps(env);
// Other middleware...
}
}
Using Action Result Extensions
using Enigmatry.Entry.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using AutoMapper;
[ApiController]
[Route("api/products")]
public class ProductController : ControllerBase
{
private readonly ProductService _productService;
private readonly IMapper _mapper;
public ProductController(ProductService productService, IMapper mapper)
{
_productService = productService;
_mapper = mapper;
}
[HttpGet("{id}")]
public ActionResult<ProductDto> GetProduct(int id)
{
// Use extension method to automatically return NotFound if null
var product = _productService.GetProductById(id);
return product.ToActionResult();
}
[HttpGet("{id}/details")]
public ActionResult<ProductDetailsDto> GetProductDetails(int id)
{
// Use extension method to map and handle not found in one call
var product = _productService.GetProductById(id);
return _mapper.MapToActionResult<ProductDetailsDto>(product);
}
}
Using Transaction Filter Attributes
using Enigmatry.Entry.AspNetCore.Filters;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("api/orders")]
public class OrdersController : ControllerBase
{
private readonly OrderService _orderService;
public OrdersController(OrderService orderService)
{
_orderService = orderService;
}
[HttpPost]
[TransactionFilter] // Automatically starts and commits a transaction
public async Task<ActionResult<OrderDto>> CreateOrder(CreateOrderRequest request)
{
var order = await _orderService.CreateOrderAsync(request);
return Created($"api/orders/{order.Id}", order);
}
[HttpDelete("{id}")]
[CancelSavingTransaction] // Prevents transaction from being saved when needed
public async Task<IActionResult> CancelOrder(int id)
{
await _orderService.CancelOrderAsync(id);
return NoContent();
}
}
Summary of Available Features
The Enigmatry.Entry.AspNetCore package provides several utilities and extensions:
Exception Handling:
UseEntryExceptionHandler()
- Configures global exception handling
HTTPS Security:
AddEntryHttps()
- Configures HTTPS services with environment-specific settingsUseEntryHttps()
- Adds HTTPS middleware with environment-specific settings
Action Result Extensions:
ToActionResult()
- Converts models to ActionResult, handling null casesMapToActionResult<T>()
- Maps and converts models to ActionResult in one call
Transaction Handling:
[TransactionFilter]
- Filter attribute for transaction management[CancelSavingTransaction]
- Prevents saving in a transaction
Validation Extensions:
CamelCasePropertyNameResolver
- Helps with FluentValidation integration
Integration Example
Here's how to integrate multiple features from the package:
using Enigmatry.Entry.AspNetCore.Exceptions;
using Enigmatry.Entry.AspNetCore.Security;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Add HTTPS services
services.AddEntryHttps(Environment);
// Add other services
services.AddControllers();
services.AddAutoMapper(typeof(Startup).Assembly);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Add exception handling
app.UseEntryExceptionHandler();
// Add HTTPS middleware
app.UseEntryHttps(env);
// Other middleware
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
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. |
-
net9.0
- AutoMapper (>= 14.0.0)
- Ben.Demystifier (>= 0.4.1)
- Enigmatry.Entry.Core (>= 9.1.1-preview.4)
- FluentValidation (>= 12.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Enigmatry.Entry.AspNetCore:
Package | Downloads |
---|---|
Enigmatry.Entry.AspNetCore.Authorization
Building Block for adding authorization to AspNet Core applications based on Entry |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
9.1.1-preview.4 | 54 | 6/27/2025 |
9.1.1-preview.3 | 118 | 6/4/2025 |
9.1.0 | 231 | 6/3/2025 |
9.0.1-preview.8 | 118 | 5/26/2025 |
9.0.1-preview.7 | 203 | 5/13/2025 |
9.0.1-preview.6 | 166 | 5/9/2025 |
9.0.1-preview.5 | 141 | 5/7/2025 |
9.0.1-preview.4 | 113 | 4/30/2025 |
9.0.1-preview.2 | 127 | 4/1/2025 |
9.0.0 | 877 | 2/26/2025 |
8.1.1-preview.3 | 118 | 5/7/2025 |
8.1.1-preview.1 | 123 | 4/1/2025 |
8.1.0 | 589 | 2/19/2025 |
8.0.1-preview.4 | 66 | 2/7/2025 |
8.0.1-preview.2 | 56 | 1/15/2025 |
8.0.0 | 1,374 | 11/27/2024 |
3.4.6-preview.10 | 72 | 11/27/2024 |
3.4.3 | 1,972 | 10/22/2024 |
3.4.2 | 746 | 10/11/2024 |
3.4.1 | 143 | 10/9/2024 |
3.4.0 | 128 | 10/9/2024 |
3.3.2 | 492 | 8/28/2024 |
3.3.2-preview.7 | 91 | 8/27/2024 |
3.3.1 | 443 | 7/16/2024 |
3.3.1-preview.4 | 71 | 7/12/2024 |
3.3.0 | 1,139 | 6/20/2024 |
3.2.1-preview.4 | 61 | 6/17/2024 |
3.2.1-preview.1 | 79 | 5/23/2024 |
3.2.0 | 4,307 | 4/3/2024 |
3.1.1-preview.1 | 1,015 | 3/13/2024 |
3.1.0 | 332 | 3/8/2024 |
3.1.0-preview.2 | 432 | 2/19/2024 |
3.0.1-preview.2 | 1,137 | 2/9/2024 |
3.0.1-preview.1 | 80 | 1/24/2024 |
3.0.0 | 1,345 | 1/15/2024 |
3.0.0-preview.14 | 131 | 1/9/2024 |
3.0.0-preview.12 | 89 | 1/9/2024 |
3.0.0-preview.5 | 82 | 1/10/2024 |
3.0.0-preview.2 | 132 | 12/28/2023 |
3.0.0-preview | 162 | 12/20/2023 |
2.1.0 | 191 | 12/28/2023 |
2.0.1-preview.3 | 108 | 12/1/2023 |
2.0.1-preview.2 | 85 | 11/29/2023 |
2.0.1-preview.1 | 80 | 11/28/2023 |
2.0.0 | 472 | 11/8/2023 |
2.0.0-preview.3 | 462 | 10/27/2023 |
2.0.0-preview.2 | 81 | 10/27/2023 |
2.0.0-preview.1 | 82 | 10/27/2023 |
2.0.0-preview | 142 | 10/27/2023 |
1.1.500 | 175 | 10/27/2023 |
1.1.495 | 907 | 9/24/2023 |
1.1.486 | 471 | 9/13/2023 |
1.1.484 | 253 | 9/7/2023 |
1.1.482 | 183 | 9/6/2023 |
1.1.480 | 279 | 8/24/2023 |
1.1.477 | 500 | 8/2/2023 |
1.1.464 | 245 | 7/5/2023 |
1.1.447 | 220 | 5/26/2023 |
1.1.396 | 304 | 4/11/2023 |
1.1.383 | 285 | 4/3/2023 |
1.1.377 | 286 | 3/13/2023 |
1.1.376 | 272 | 3/13/2023 |
1.1.365 | 982 | 2/15/2023 |