Appearance
MediatR pipeline behaviors
The shared registrar deduplicates handler scans, validators, Gryd-owned pipeline behaviors and Auth's three capability contributors per service collection. Later assemblies still scan. This guarantee covers those registrations; configure other module and infrastructure services according to their own contracts.
Composition
csharp
using Gryd.API.Extensions;
using GrydAuth.Infrastructure;
using GrydJobs.Application;
using GrydNotifications.Application;
using GrydReports.Application;
using Microsoft.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrydCore(typeof(Program).Assembly);
builder.Services.AddGrydAuthApplication();
builder.Services.AddGrydJobsApplication();
builder.Services.AddGrydNotificationsApplication();
builder.Services.AddGrydReportsApplication();This composes application handlers and pipelines on the host's existing builder.Services collection. Configure infrastructure, storage and providers using each module's setup contract: GrydAuth, GrydJobs, GrydNotifications and GrydReports. See Core API extensions for AddGrydCore.
Behaviors run in order: Logging → Telemetry → Performance → Tenant injection → Permission authorization → Auth tenant validation → Cross-tenant filter → Tenant scope → Validation → module-specific behaviors. Module-specific behaviors keep registration order. Gryd moves only its own descriptors; custom descriptors keep order and lifetime, with placement set by registration time.
Validation
Validators are scoped and deduplicated by implementation; distinct validators all run. Valid requests reach the handler. Failures return Result<T>.Failure or Result.Failure with VALIDATION_ERROR; other reference-type responses raise ValidationException.
csharp
public sealed class CreateUserValidator : AbstractValidator<CreateUserCommand>
{
public CreateUserValidator() => RuleFor(x => x.Email).NotEmpty().EmailAddress();
}