title: Automapper 4.2.1 LINQ projections work only with static Mapper.CreateMap?
body: <p>I'm trying to use Automapper projections on Entity Framework IQueryables.</p>
  
  <p>On application start, I create and add all my mapping profiles which create maps with the non-static CreateMap method. </p>
  
  <p>All those profiles are registered within my IoC container.</p>
  
  <p>I get the missing mapping exception although I see the mapping profile in the instance of my mappingConfiguration. </p>
  
  <p>What could be the problem? Am I missing something? I'm using Automapper 4.2.1</p>
  
  <p>I've noticed that when adding a static Mapper.CreateMap, it works fine. Do projections work only with static API? I want to avoid the static API.</p>
  
  <p>Full code:</p>
  
  <pre><code>public class ItemEntityToItemView : Profile
  {
      public override void Configure()
      {
          CreateMap&lt;ItemEntity, ItemView&gt;();
  
          // Without this line, I get missing Map type configuration.
          Mapper.CreateMap&lt;ItemEntity, ItemView&gt;();
      }
  }
  
  
  public interface IEntitiesProjector
  {
      IQueryable&lt;T&gt; SelectTo&lt;T&gt;(IQueryable source);
  }
  
  public class EntitiesProjector : IEntitiesProjector
  {
      private readonly IMapperConfiguration _mapperConfig;
  
      public EntitiesProject(IMapperConfiguration mapperConfig)
      {
          _mapperConfig = mapperConfig;
      }
  
      public IQueryable&lt;T&gt; SelectTo&lt;T&gt;(IQueryable source)
      {
          return source.ProjectTo&lt;T&gt;(_mapperConfig);
      }
  }
  
  public class ItemsRepository : IITemsRepository
  {
      public IQueryable&lt;ItemEntity&gt; GetById(int id)
      {
          return _dbSet.Where(x =&gt; x.Id == id);
      }
  }
  
  public class Service
  {
      private readonly IEntitiesProjector _projector;
  
      public Service(IEntitiesProject entitiesProjector)
      {
          _projector = entitiesProjector;
      }
  
      public List&lt;T&gt; GetItem(int id)
      {
          IQueryable&lt;ItemEntity&gt; itemsQueryable = ItemsRepository.GetById(id);
  
          return _projector.SelectTo&lt;ItemView&gt;(itemsQueryable);
      }
  }
  
  My Autofac registration :
  
  builder.RegisterAssemblyTypes().AssignableTo(typeof(Profile)).As&lt;Profile&gt;();
  
  builder.Register(c =&gt; new MapperConfiguration(cfg =&gt;
  {
      cfg.CreateMap&lt;IdentityUser, AspNetUser&gt;().ReverseMap();
  })).AsSelf().As&lt;IMapperConfiguration&gt;().SingleInstance();
  
  builder.Register(c =&gt; c.Resolve&lt;MapperConfiguration&gt;().CreateMapper(c.Resolve)).As&lt;IMapper&gt;().InstancePerLifetimeScope();
  
  builder.Register&lt;EntitiesProjector&gt;().As&lt;IEntitiesProjector&gt;().SingleInstance();
  </code></pre>