'AutoMapper .NET6 C#10 Blazor WASM PWA
I had a problem that the AutoMapper worked in .NET5 with in Program.cs ->
services.AddAutoMapper(typeof(Startup));
New Blazored WASM PWA do not have a Startup class. So the AutoMapper failed.
Solution 1:[1]
.NET6 C#10
in Program.cs ->
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
AutoMapper is working fine with C#10 EF6 .NET6.
Solution 2:[2]
I encountered this problem in .NET6
and resolved it by adding the package
AutoMapper.Extensions.Microsoft.DependencyInjection
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ivan Rakitin |
Solution 2 | Dmitry Pavlov |