Add AutoMapper profile for entity self-mappings

Introduce `EntitySelfMappingProfile` to enable self-mappings (T -> T) for domain entities (`EmailAccount`, `ReceivedEmail`, `EmailAttachment`). This ensures uniform AutoMapper usage in the generic repository, regardless of whether the target type is a DTO or the entity itself. Added necessary `using` directives for `AutoMapper` and domain entities.
This commit is contained in:
2026-08-13 09:37:14 +02:00
parent 00ae8e1ba0
commit 893addb45d
2 changed files with 22 additions and 0 deletions

View File

@@ -64,6 +64,9 @@ public static class DependencyInjection
services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
// AutoMapper - Register entity self-mappings (T -> T) for generic repository
services.AddAutoMapper(config => config.AddMaps(typeof(EntitySelfMappingProfile).Assembly));
return services;
}
}