
.NET 8 End of Support: How to Upgrade ASP.NET Zero to .NET 10
.NET 8 and .NET 9 are no longer supported. Learn how to upgrade ASP.NET Zero to .NET 10, choose the right framework version, and avoid migration problems.
Read more →ASP.NET Zero

Upgrading your ASP.NET Zero application can feel straightforward until you reach the object mapping layer.
Your application builds. Your entities are still there. Your DTOs look familiar. But the mapping configuration that has supported your application for years is changing.
Starting with ASP.NET Zero v15, the framework began moving away from AutoMapper and toward Mapperly. The migration was finalized in ASP.NET Zero v15.2, bringing Mapperly into the framework and its Power Tools.
For teams with older applications, this is more than replacing one NuGet package with another. You may have hundreds of mappings inside CustomDtoMapper.cs, DTOs decorated with [AutoMapFrom] and [AutoMapTo], custom conversion rules, and ObjectMapper.Map() calls throughout your AppServices.
The difficult part isn't creating new mapper classes. It's making sure the new mappings preserve the behavior your application already depends on.
This guide explains how to approach an AutoMapper to Mapperly migration in ASP.NET Zero, what to check before changing your code, and how to catch mapping problems that a successful build might not reveal. If you're planning the wider version jump too, start with our ASP.NET Zero 15.2 upgrade guide for fixing backend errors first.
ObjectMapper.Map() calls can continue working with the ASP.NET Zero Mapperly integration.IQueryable projections, but those projections have specific limitations.IObjectMapper implementations.AutoMapper has been a familiar part of many .NET applications. Developers use it to convert entities into DTOs, map incoming requests to existing objects, and manage complex mapping rules through centralized profiles.
However, the mapping ecosystem has changed.
AutoMapper's licensing model changed in newer releases, creating another consideration for commercial applications. At the same time, Mapperly offers a different approach: instead of configuring mappings that execute through runtime reflection, it generates C# mapping code during compilation.
ASP.NET Zero started this transition in v15.0 and finalized it in v15.2. The same release line also moved to .NET 10, which we cover in our guide to upgrading ASP.NET Zero to .NET 10.
The difference is important:
| Area | AutoMapper | Mapperly |
|---|---|---|
| Mapping approach | Runtime mapping configuration | Compile-time source generation |
| Configuration style | Centralized profiles | Mapper classes |
| Mapping errors | Often discovered at runtime | Many issues reported during compilation |
| Generated code | Runtime mapping behavior | Generated C# code can be inspected |
| ASP.NET Zero integration | Abp.AutoMapper |
Abp.Mapperly |
This doesn't mean every existing application should immediately rewrite every mapping. The right migration approach depends on how much custom mapping logic your application contains.
If your solution has years of development behind it, start by understanding what you have before deciding what to replace. Our guide to upgrading ASP.NET Zero without breaking your custom code shows how to take that inventory across the whole solution.
A safe migration starts with an inventory, not a package update.
Here is the order to follow.
Before changing anything, search your complete solution for existing mapping configurations and usages.
Look for:
CreateMap< inside CustomDtoMapper.cs and other profile classes.[AutoMapFrom], [AutoMapTo], and [AutoMap] on DTOs and entities.ObjectMapper.Map<TDestination>() and ObjectMapper.Map<TSource, TDestination>() inside AppServices.ProjectTo<TDestination>() in repository and database queries.ForMember, Ignore(), ConvertUsing, and AfterMap rules.ITypeConverter and IValueResolver implementations.Don't limit the search to the Application project. Mapping logic can also exist in background jobs, event handlers, MVC projects, GraphQL, and other parts of a customized solution.
Create a mapping inventory with these columns:
| Field | What to record |
|---|---|
| Source type | Entity or input DTO |
| Destination type | Output DTO or entity |
| Project/module | Where the mapping is used |
| Custom rules | Ignore, conversion, or custom logic |
| Navigation properties | Related entities accessed |
| Tenant scope | Whether the data is tenant-specific |
| Test coverage | Existing tests and missing scenarios |
This list gives you two things: a migration checklist and a testing checklist. It also helps identify unused mappings that can be removed instead of converted.
Not every AutoMapper configuration deserves the same migration effort.
Start with the mappings that have predictable behavior. Leave complex mappings until you understand their dependencies.
| Mapping type | Suggested approach | Reason |
|---|---|---|
| Same-name properties | Convert first | Usually requires minimal configuration |
| Renamed properties | Convert with attributes | Explicit property mapping is available |
| Ignored properties | Convert with ignore attributes | The intention must remain clear |
| Nested objects | Review and test carefully | Null values and navigation paths can behave differently |
ProjectTo queries |
Convert and inspect SQL | Projection expressions have limitations |
Heavy AfterMap logic |
Review separately | Business logic may belong outside the mapper |
| Custom converters | Convert individually | Their behavior may not have a direct one-to-one replacement |
| Third-party generated code | Assess before changing | You may not own or control its mapping implementation |
One important point: incremental migration does not mean registering both ABP mapper modules at the same time.
You can organize the conversion work into separate pull requests and functional areas. A clear upgrade branch strategy and conflict checklist helps keep that work manageable. However, the AutoMapper and Mapperly ABP integrations both provide IObjectMapper, so they should not be enabled together as competing implementations.
Plan the integration change carefully and follow the setup for your specific ASP.NET Zero version. If you need to retain AutoMapper for a legacy application, evaluate a supported or custom integration separately rather than assuming both modules can be registered together.
With AutoMapper, you may have managed most mappings from a centralized CustomDtoMapper.cs file.
For example:
configuration.CreateMap<Invoice, InvoiceDto>();
Mapperly uses partial mapper classes. The source generator creates the implementation during the build.
A basic mapper can look like this:
using Riok.Mapperly.Abstractions;
[Mapper]
public partial class InvoiceMapper
{
public partial InvoiceDto Map(Invoice source);
}
For a larger application, you can organize mapper classes around related functionality and source/destination types.
For example:
[Mapper]
public partial class InvoiceToInvoiceDtoMapper
{
public partial InvoiceDto Map(Invoice source);
public partial List<InvoiceDto> Map(
List<Invoice> source
);
}
The ASP.NET Zero integration also allows existing application code to continue using the ObjectMapper API:
var invoiceDto = ObjectMapper.Map<InvoiceDto>(invoice);
That means the migration does not necessarily require rewriting every mapping call inside your AppServices.
However, the mapper classes and their registration must follow the conventions of the upgraded ASP.NET Zero template. Check the generated project and the migration documentation for the exact setup.
This is where a simple conversion script can become risky.
AutoMapper profiles often contain rules that are easy to overlook. A property might be renamed, ignored, conditionally mapped, or populated through a custom converter.
Mapperly provides attributes and user-defined mapping methods for these scenarios.
AutoMapper:
configuration.CreateMap<User, UserDto>()
.ForMember(
dest => dest.Email,
opt => opt.MapFrom(src => src.EmailAddress)
);
Mapperly:
[Mapper]
public partial class UserMapper
{
[MapProperty(
nameof(User.EmailAddress),
nameof(UserDto.Email)
)]
public partial UserDto Map(User user);
}
AutoMapper:
configuration.CreateMap<User, UserDto>()
.ForMember(
dest => dest.Password,
opt => opt.Ignore()
);
Mapperly:
[Mapper]
public partial class UserMapper
{
[MapperIgnoreTarget(nameof(UserDto.Password))]
public partial UserDto Map(User user);
}
AutoMapper:
ObjectMapper.Map(input, existingInvoice);
Mapperly mapper definition:
[Mapper]
public partial class InvoiceMapper
{
public partial void Map(
EditInvoiceInput input,
Invoice target
);
}
The important part is to preserve the original behavior, not simply reproduce the old configuration syntax.
For example, if a property was intentionally excluded because it contains sensitive information, make sure it remains excluded after the conversion.
One advantage of Mapperly is that it reports mapping issues through compiler diagnostics.
Two useful examples are:
RMG012: A target member has no matching source member.RMG020: A source member is not mapped to a target member.These warnings can reveal properties that were renamed, removed, or unintentionally left out.
For converted projects, you can make them fail the build through .editorconfig:
[*.cs]
dotnet_diagnostic.RMG012.severity = error
dotnet_diagnostic.RMG020.severity = error
Don't automatically suppress every warning just to get a successful build.
For each warning, make a deliberate decision:
A clean build is useful. A clean build with intentional mapping decisions is much more valuable.
A mapper can compile successfully and still produce unexpected results when your application data is incomplete.
Consider a DTO that reads a customer's name through an invoice:
public class InvoiceDto
{
public string? CustomerName { get; set; }
}
The mapping depends on this relationship:
invoice.Customer.Name
But what happens when Customer is null?
Or when the navigation property hasn't been loaded?
Or when the related record no longer exists?
These cases need explicit tests.
For every DTO that maps through a navigation property, test at least:
For example, don't assume that a missing customer should always produce an empty string. That is a business decision. Your mapping should reflect the behavior your application expects.
Also review custom mapping methods and nullable reference types. Mapperly exposes diagnostics for some nullable mapping situations, but not every runtime data condition can be resolved at compile time.
If your application uses AutoMapper's ProjectTo(), don't replace it with a normal object mapping call without reviewing the query.
Mapperly supports IQueryable projections.
For example:
[Mapper]
public static partial class InvoiceMapper
{
public static partial IQueryable<InvoiceDto> ProjectToDto(
this IQueryable<Invoice> query
);
}
You can then use the projection with Entity Framework:
var invoices = await DbContext.Invoices
.Where(x => x.IsActive)
.ProjectToDto()
.ToListAsync();
This approach allows the projection to be translated into an expression that an ORM can use.
However, queryable projections have limitations. Some runtime mapping features, reference handling, and custom mapping behavior are not available in the same way.
After converting a projection:
This is especially important in multi-tenant applications, where a query change can affect which records are returned.
A mapping problem doesn't always produce an exception.
Sometimes the application returns a DTO with missing information or includes a record that should not be visible to the current tenant.
For tenant-scoped mappings, create test data for at least two tenants.
Then verify:
Mapping itself does not replace tenant authorization or query filtering. Those protections must remain in the application and data-access layers.
The objective is to confirm that the migration hasn't changed the behavior around tenant data. For a worked example of this kind of check, see how to catch a tenant data leak in ASP.NET Zero code.
Once your solution has moved to Mapperly, search the entire repository again.
Check for:
CreateMap configurations.[AutoMapFrom] and [AutoMapTo] attributes.Don't remove a package simply because the main Application project no longer references it. Another project may still depend on it.
Run a complete build and test suite after removing the remaining references.
If you are keeping AutoMapper for a specific legacy integration, document why it remains, which project owns it, and how its compatibility and licensing are maintained.
Here is a quick reference for developers converting existing mapping configurations.
| AutoMapper | Mapperly |
|---|---|
CreateMap<TSource, TDestination>() |
A [Mapper] class with a partial mapping method |
.ForMember(...).Ignore() |
[MapperIgnoreTarget(...)] |
.ForMember(...).MapFrom(...) |
[MapProperty(...)] |
.ReverseMap() |
Define the reverse mapping explicitly |
ProjectTo<TDestination>() |
An IQueryable projection method |
AfterMap(...) |
A suitable user-defined mapping method or application-service logic |
| Runtime configuration validation | Compile-time analyzer diagnostics |
These are conceptual equivalents, not guaranteed one-to-one replacements. Review each mapping's behavior before converting it.
A few shortcuts can make the migration look faster while creating more work later.
Removing AutoMapper before identifying every profile, converter, and project reference can leave the application in a difficult state.
Custom conversion rules and nested navigation properties often contain behavior that isn't obvious from the DTO.
A warning may represent a property that your application relies on. Suppressing it without investigation can hide a real issue.
The AutoMapper and Mapperly ABP modules both provide the object mapper integration. Don't register both as though they were independent mapping services.
A successful test using one tenant does not prove that tenant-scoped queries still behave correctly.
AI tools can help convert repetitive CreateMap configurations into Mapperly classes. But they cannot reliably infer every business rule, null-handling decision, or tenant boundary from a mapping declaration alone.
Review generated code and test AI-generated code before you merge it.
ASP.NET Zero's default mapping integration has moved to Mapperly. If your application still depends on AutoMapper, you need to assess those dependencies and choose a compatible migration or retention strategy.
Do not assume that you can register both ABP mapper modules together. Check the integration guidance for your target version.
Yes. ASP.NET Zero's Mapperly integration preserves the ObjectMapper.Map() API for supported mappings. You can therefore keep many existing mapping calls while converting the underlying mapping definitions.
Mapperly generates mapping code at compile time and avoids runtime reflection for its generated mappings. This can reduce runtime overhead.
Actual performance depends on your mapping complexity, application workload, and implementation. Benchmark important paths rather than assuming a fixed performance improvement.
Mapperly supports IQueryable projections through generated projection methods. However, these projections have limitations compared with normal object mappings, so review the supported features and inspect the generated SQL.
AI coding tools can help convert repetitive mapping configurations, generate mapper classes, and identify possible missing properties.
They should be treated as migration assistants, not as proof that the conversion is correct. Review ignored properties, custom converters, null handling, and tenant-scoped queries manually.
Start with mapping unit tests, then add integration tests for nested objects, null values, query projections, and tenant-specific records. Finally, run the complete application test suite against the upgraded ASP.NET Zero solution.
Moving from AutoMapper to Mapperly is not just a framework-level change. It affects how your application translates entities, DTOs, and query results.
The safest approach is to understand your existing mappings first, convert them in a controlled order, and test the behavior that the compiler cannot verify.
Start with simple DTOs. Review custom rules. Make important diagnostics fail the build. Test null relationships and tenant-specific queries. Then remove the old dependencies when the application is ready.
Because a mapping bug doesn't always crash your application. Sometimes it quietly returns incomplete data.
And in a multi-tenant application, that is a risk worth catching before release.
Working on an ASP.NET Zero v15 upgrade? ASP.NET Zero Developers helps teams review customized applications, identify migration risks, and plan framework upgrades without overlooking the code that makes their applications unique.
We have been building .NET and ASP.NET Zero software for clients in the US and UK since 2018. Take a look at our recent work, or book a free consultation to talk through your upgrade.
Further reading:
Get In Touch
Hire ASP.Net Zero Application Developers that will provide the perfect solution to your business issues. Our technical experts will provide you with a free consultation.

.NET 8 and .NET 9 are no longer supported. Learn how to upgrade ASP.NET Zero to .NET 10, choose the right framework version, and avoid migration problems.
Read more →
Test AI-generated ASP.NET Zero AppServices before merging. Six unit tests cover permissions, tenant isolation, Host-only methods, validation, and feature checks.
Read more →
Learn how to secure AI actions in ASP.NET Zero using AppService authorization, AbpAuthorize, and feature dependencies. Prevent AI from bypassing user permissions.
Read more →