Add Blog Post Using Automapper After Migrating to Mapperly - #369
Add Blog Post Using Automapper After Migrating to Mapperly#369oguzhanagir wants to merge 2 commits into
Conversation
ismcagdas
left a comment
There was a problem hiding this comment.
1. Hybrid section can't compile as written (~L633–648)
Two problems in the "If the Full Revert Is Too Much" snippet:
- The comment says
AbpZeroTemplateCoreModule.PostInitialize, butCustomDtoMapperis declaredinternal staticin the.Applicationproject (per the post's own Step 3)..Corecannot reference.Application— the dependency runs the other way, andinternalblocks it regardless. Should beAbpZeroTemplateApplicationModule. new MapperConfiguration(cfg => CustomDtoMapper.CreateMappings(cfg))uses the single-argument constructor that the post itself says was removed in AutoMapper 15 (Prerequisite 2, Step 4). Readers on the licensed path hit a compile error. Add a note, or show the two-arg form.
2. Licensed-path patch silently drops AbpEmulateAutoMapper (~L182–208)
Upstream CreateMappings ends with:
#pragma warning disable CS0618
AbpEmulateAutoMapper.Mapper = mapper;
#pragma warning restore CS0618The rewritten version omits it without comment. That field backs the legacy .MapTo<T>() extension methods in AutoMapExtensions — which older ASP.NET Zero solutions, exactly this post's audience, commonly use. Dropping it turns into a NullReferenceException at runtime.
Fix: keep the line, or call out the removal explicitly.
3. git show > file corrupts the file on Windows PowerShell 5.1 (~L290–291)
git show <commit>:.../CustomDtoMapper.cs > .../CustomDtoMapper.cs> in PS 5.1 writes UTF-16LE, producing a file the C# compiler chokes on. Step 5 already uses the right idiom — use it here too:
git checkout <commit> -- aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application/CustomDtoMapper.cs4. Abp.* on nuget.org goes to 10.5.0, not 10.4.0 (~L79)
nuget.org lists Abp.AutoMapper 10.5.0 as latest (versions: 10.1.0 … 10.5.0). Change "stop at the 10.4.0 line" → "10.5.0 line".
Must fix — internal consistency
5. "five distinct things" but only four are listed (L16–21)
Either add the fifth — the common.props NoWarn suppressions from Step 7 would be the natural one — or change to "four".
6. Attribute file counts contradict each other three ways
- L474 header says
.Web.Mvc(13 files) but the table has 14 rows. - Step 5 opener (L430) and the Conclusion both say 24 files, but the tables total 29 (1 + 1 + 3 + 10 + 14).
7. Likely copy-paste error causing the 14th row (~L478)
Areas/AppAreaName/Models/Editions/CreateOrEditRoleModalViewModel.cs with [AutoMapFrom(typeof(GetEditionEditOutput))] — an Edition output on a Role view model, under the Editions folder, duplicating the real Roles/CreateOrEditRoleModalViewModel.cs row.
Should almost certainly be CreateOrEditEditionModalViewModel.cs. Fixing this reconciles 14 → 13.
8. "The migration commit … touched 44 files" (L16)
Doesn't survive the post's own arithmetic: 37 new mapper files + ~29 attribute files + 2 CustomDtoMapper.cs + 2 modules + 4 .csproj + common.props ≈ 75. Recheck or drop the number.
Should fix — editorial
9. ~22 sentences are missing their punctuation
This reads like an em-dash-removal pass that deleted the dashes without substituting anything. Representative cases:
| ~Line | Text |
|---|---|
| 35 | "Nothing changes on the frontend Angular, React and MVC client code is untouched." |
| 50 | "AutoMapper.Collection which Abp.AutoMapper needs at runtime, pins you to one line or the other:" |
| 60 | "Free path AutoMapper 14.0.0 + AutoMapper.Collection 11.0.0." |
| 63 | "…wire up EqualityComparison dropping the package turns that into a runtime failure" |
| 75 | "…no guarantee it survives a future major not removed." |
| 87 | "…you are done with this prerequisite skip to" |
| 110 | "Pack just that one project there is no need to build the whole solution" |
| 230 | "Keeping the key out of the package matters a license key baked into a NuGet artifact…" |
| 281 | "You do not write this from scratch it is in your own git history." |
| 402 | "Going through IObjectMapper is equivalent AutoMapperObjectMapper.ProjectTo simply delegates" |
| 426 | "This one is best practice leaving the .ToList() in place works fine" |
| 430 | "Recover each from your pre-upgrade branch the fastest route is a targeted checkout" |
| 495 | "Functionally identical pick one approach" |
| 572 | "Those were Mapperly diagnostics source member is not mapped to any target member (RMG020)…" |
| 595 | "Qualify the type name AutoMapper.IConfigurationProvider collides with" |
| 606 | "Manual verification checklist these exercise the mappings" |
| 616 | "(FriendCacheItem the cache path only exercises after a cache miss)" |
| 625 | "…but the mapping will not be registered AbpAutoMapperModule is what is running" |
| 650 | "…your code genuinely depends on AutoMapper semantics ITypeConverter, …" |
| 654 | "still functional deprecated, not deleted" |
| 663 | "open a ticket on [support.aspnetzero.com] we are happy to work through it" |
| 667–672 | All six Further Reading bullets, e.g. "…Migrating from AutoMapper to Mapperly] the forward migration guide" |
A colon, comma, or dash restores each. This is the single most visible issue for a published post.
10. Cover image filename typo
using-automapper-after-migrating-t0-mapperly-cover.png — t0 should be to.
The repo convention is <post-slug>-cover.png (cf. react-custom-hooks-when-to-use-cover.png ↔ react-custom-hooks-when-to-use.md); the typo breaks slug matching.
Fix: rename to using-automapper-after-migrating-to-mapperly-cover.png.
A blog post has been added explaining how to switch to Automapper for users who are still using the Automapper package instead of Mapperly.