Search code examples
unity-containerautomapperioc-containerautomapper-3

'AutoMapper.Configuration' is a 'namespace' but is used like a 'type'


I am trying to upgrade AutoMapper 1.1 to AutoMapper 3.3. I have the following statement in my current code that does not work in v3.3

container.RegisterType<IConfiguration, global::AutoMapper.Configuration>(new ContainerControlledLifetimeManager());

container is a Unity container. I am getting the following error.

'AutoMapper.Configuration' is a 'namespace' but is used like a 'type'

How do i change this statement to work with AutoMapper 3.3


Solution

  • Found out that AutoMapper.Configuration is changed to

    AutoMapper.ConfigurationStore

    The following line works.

    container.RegisterType<IConfiguration, global::AutoMapper.ConfigurationStore>(new ContainerControlledLifetimeManager());