AutoMapper / AutoMapper.Extensions.Microsoft.DependencyInjection

MIT License
258 stars 79 forks source link

AutoMap attribute is not triggered #168

Closed Danielovich closed 1 year ago

Danielovich commented 1 year ago

AutoMapper.Extensions.Microsoft.DependencyInjection 12.0.0.0 .NET 6

First and foremost a big appreciation for your dedication and time spent on these things.

We use this services.AddAutoMapper(assemblies) which calls

public static IServiceCollection AddAutoMapper(this IServiceCollection services, IEnumerable<Assembly> assemblies, ServiceLifetime serviceLifetime = ServiceLifetime.Transient) 
              => AddAutoMapperClasses(services, null, assemblies, serviceLifetime);

And further down the chain

if (assembliesToScan != null)
{
....
    services.Configure<MapperConfigurationExpression>(options => options.AddMaps(assembliesToScan));
...

But none of my AutoMap types are being mapped accordingly.

[AutoMap(typeof(AnotherFkingDomainBlah))]
public class AnotherFkingDto
{....

The runtime error when trying to do a Mapper.Map<X, Y> is along the lines of the infamous "there is no map between X and Y".

Known issue ?

lbargaoanu commented 1 year ago

I think this is better suited for StackOverflow.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.