Table of Contents

ASP.NET Core Integration

Status: Coming Soon

Add automatic request validation to your ASP.NET Core APIs using JD.Domain middleware and endpoint filters.

Time: 45 minutes | Level: Intermediate

What You'll Learn

  • Domain validation middleware
  • Endpoint filters for Minimal APIs
  • MVC action filters
  • ProblemDetails responses (RFC 9457)
  • Custom error handling
  • DomainContext for user/tenant context

Topics Covered

Middleware Setup

builder.Services.AddDomainValidation(options =>
{
    options.AddManifest(manifest);
});

app.UseDomainValidation();

Minimal API Integration

app.MapPost("/api/customers", (Customer customer) => ...)
    .WithDomainValidation<Customer>();

MVC Integration

[HttpPost]
[DomainValidation]
public IActionResult Create(Customer customer)
{
    // Validation happens automatically
}

Error Responses

RFC 9457 ProblemDetails format:

{
  "type": "https://tools.ietf.org/html/rfc9457",
  "title": "Validation Failed",
  "status": 400,
  "errors": [...]
}

DomainContext

Access user/tenant context in rules:

.Policy("CanEdit", (entity, ctx) =>
    ctx.User.Id == entity.OwnerId)

Prerequisites

API Reference

Next Steps