- Home /
Question by
SMathew · Mar 08, 2019 at 05:22 PM ·
constructor
How to register an interface using constructor,Equivalent of container.RegisterInstance(new AutoMapperServiceConfiguration().Configure()); in unity config file
Below is the configuration class , i need to register in the unity config file The equivalent in unity container is var config = new MapperConfiguration(); container.RegisterInstance(config.Configure());
public class AutoMapperServiceConfiguration { public void Configure() { Mapper.Initialize(cfg => { cfg.AddProfile(new DomainMappingProfile()); }); } } ,This is how AutoMapperServiceConfiguration looks like
public class AutoMapperServiceConfiguration { public void Configure() { Mapper.Initialize(cfg => { cfg.AddProfile(new DomainMappingProfile()); }); } }
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612193217im_/https://answers.unity.com/themes/thub/images/avi.jpg)