Код: Выделить всё
using ProjectDash.Application;
using ProjectDash.Application.Common.Mappings;
using ProjectDash.Domain.Interfaces;
using ProjectDash.Persistence;
using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddApplication();
builder.Services.AddPersistence(builder.Configuration);
builder.Services.AddCors();
builder.Services.AddAutoMapper(config =>
{
config.AddProfile(new AssemblyMappingProfile(Assembly.GetExecutingAssembly()));
config.AddProfile(new AssemblyMappingProfile(typeof(IProjectDashDbContext).Assembly));
});
var app = builder.Build();
using (var scope = app.Services.CreateScope()) {
var serviceProvider = scope.ServiceProvider;
try {
var context = serviceProvider.GetRequiredService
();
DbInitializer.Initialize(context);
} catch (Exception exception) {
}
}
app.MapGet("/", () => "Hello World!");
app.Run();

Я пытался установить AutoMapper/AutoMapper.Extensions.Microsoft.DependencyInjection, но мне это не помогло
Подробнее здесь: https://stackoverflow.com/questions/782 ... oes-not-co