Say I have a source and destination class that is mapped using AutoMapper. The destination has a logger service injected into the constructor.

However, I don't know how to get the service injected into the constructor through StructureMap?

I've tried the following:

Mapper.Initialize(m =>
 {                
    m.ConstructServicesUsing(ObjectFactory.GetInstance);
 });

which didn't prevent me having the exception on the mapping call, I guess because the service isn't being injected in properly.

I also tried the following:

CreateMap<Source, Dest>()
 .ConstructUsing(x=> ObjectFactory.GetInstance<ILoggerService>());

But I get the error: cannot convert Lamda expression to delegate type, yet all the examples I have seen use this method?

Edit
Report