Replace AutoMapper with Riok.Mapperly in TeachingRecordSystem.Api#3308
Draft
Replace AutoMapper with Riok.Mapperly in TeachingRecordSystem.Api#3308
Conversation
…rs, fix Extensions/GlobalUsings, delete old files Agent-Logs-Url: https://github.com/DFE-Digital/teaching-record-system/sessions/8b6ce974-583c-4911-8066-c0443ea8a848 Co-authored-by: gunndabad <2041280+gunndabad@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
gunndabad
April 20, 2026 16:13
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces runtime reflection-based AutoMapper with source-generator-based Riok.Mapperly (4.3.1) across all 12 API version namespaces, eliminating the
IMapperabstraction in favour of strongly-typed per-versionApiMapperclasses.Package changes
Directory.Packages.props: swapAutoMapper→Riok.Mapperly 4.3.1TeachingRecordSystem.Api.csproj: update<PackageReference>accordinglyPer-version ApiMapper classes (×12)
One
ApiMapperper version namespace (V20240101–V20250627). Complex mappings involvingOption<T>/OneOf<>are written manually; flat mappings use Mapperly[Mapper]partial methods with[MapProperty]for renames. Key notes:DqtInductionStatusenum conversion is name-based (not value-based) — values differ by 1 betweenImplementation.DtosandV20240101.DtosMapFindPersonResponseResult/MapFindPersonsResponseResultmethods per version where both response shapes existTrainingAgeSpecialismTypecast uses(int)intermediary since values are identical across namespacesControllers (all affected versions)
IMapper mapper→ typedApiMapper mapperin primary constructors;mapper.Map<T>(x)→mapper.MapX(x).Infrastructure
Extensions.cs: removeAddAutoMapper()+ITypeConverter<,>Scrutor scan; addAddSingleton<VXX.ApiMapper>()for all 12 versionsGlobalUsings.cs: removeglobal using AutoMapper;MapperProfile.csfiles,Infrastructure/Mapping/OptionMapper.cs[AutoMap]/[SourceMember]attributes and theirusing AutoMapper.Configuration.Annotations;directives (~23 files)Checklist