I am currently connecting an instance of IMapper Automapper with StructureMap.
public class DefaultRegistry : Registry { public DefaultRegistry() { Scan(o => { o.AddAllTypesOf<Profile>(); }); For<IMapper>().Use(() => Mapper.Instance); } }
At the start of the network kernel:
var container = new Container(new DefaultRegistry()); container.Populate(services); services.AddAutoMapper(cfg => cfg.ConstructServicesUsing(container.GetInstance)); Mapper.AssertConfigurationIsValid();
Since Mapper.Instance creates statics, how can I register it as an instance? Or how to connect it to StructureMap?
source share