title: AutoMapper don't work with entity EF Core
body: <p>I'm trying to get view from entity with fields that I specify at expandProperties with .ProjectTo(). Using .Net Core 2 + Ef Core + AutoMapper</p>
  
  <p>There is entities:</p>
  
  <pre><code>public class LessonCatalog {
      public string Name { get; set; }
      public int? ImageId { get; set; }
      public virtual Image Image { get; set; }
      public virtual ICollection&lt;Lesson&gt; Lessons { get; set; }
  }
  
  public class Lesson {
      public string Name { get; set; }
      public string Description { get; set; }
      public int? ImageId { get; set; }
      public virtual Image Image { get; set; }
      public int LessonCatalogId { get; set; }
      public virtual LessonCatalog LessonCatalog { get; set; }
  }
  </code></pre>
  
  <p>Views:</p>
  
  <pre><code>public class LessonView {
      public string Name { get; set; }
      public string Description { get; set; }
      public int? ImageId { get; set; }
      public ImageView Image { get; set; }
      public int LessonCatalogId { get; set; }
      public LessonCatalogView LessonCatalog { get; set; }
  }
  
  public class LessonCatalogView {
      public string Name { get; set; }
      public int? ImageId { get; set; }
      public ImageView Image { get; set; }
      public IEnumerable&lt;LessonView&gt; Lessons { get; set; }
  }
  </code></pre>
  
  <p>My maps:</p>
  
  <pre><code>CreateMap&lt;LessonCatalog, LessonCatalogView&gt;()
              .ForMember(dest =&gt; dest.Image, map =&gt; map.ExplicitExpansion())
              .ForMember(dest =&gt; dest.Lessons, map =&gt; map.ExplicitExpansion());
  
  CreateMap&lt;Lesson, LessonView&gt;()
               .ForMember(dest =&gt; dest.LessonCatalog, map =&gt; map.ExplicitExpansion());
  </code></pre>
  
  <p>In my repository:</p>
  
  <pre><code>protected readonly DbContext _context;
  protected readonly DbSet&lt;TEntity&gt; _entities;
  
      public Repository(DbContext context) {
          _context = context;
          _entities = context.Set&lt;TEntity&gt;();
      }
  
  public IEnumerable&lt;TView&gt; GetOData&lt;TView&gt;(ODataQueryOptions&lt;TView&gt; query,
          Expression&lt;Func&lt;TEntity, bool&gt;&gt; predicate = null) {
  
          IQueryable&lt;TEntity&gt; repQuery = _entities.AsQueryable();
          IQueryable res;
          if (predicate != null) repQuery = _entities.Where(predicate);
  
          if (query != null) {
              string[] expandProperties = GetExpands(query);
              //!!!
              res = repQuery.ProjectTo&lt;TView&gt;(Mapper.Configuration, expandProperties);
              //!!!
              var settings = new ODataQuerySettings();
              var ofilter = query.Filter;
              var orderBy = query.OrderBy;
              var skip = query.Skip;
              var top = query.Top;
  
              if (ofilter != null) res = ofilter.ApplyTo(res, settings);
              if (orderBy != null) res = orderBy.ApplyTo(res, settings);
              if (skip != null) res = skip.ApplyTo(res, settings);
              if (top != null) res = top.ApplyTo(res, settings);
          } else {
              res = repQuery.ProjectTo&lt;TView&gt;(Mapper.Configuration);
          }
  
          return (res as IQueryable&lt;TView&gt;).AsEnumerable();
      }
  </code></pre>
  
  <p><code>expandProperties</code> consist "Lessons" string, but after <code>.ProjectTo()</code> I have null at Lessons field, and it's the same for all other entities at my project.</p>
  
  <p>In the same ASP .Net 4.5 project with Entity FrameWork it's works fine.
  I feel I missing something important, at this case.
  There is may be a better way to get View with properties that I specify at odata expand query.</p>
  
  <p>My packages: AutoMapper 6.2.2, Microsoft.EntityFrameworkCore 2.0, Microsoft.AspNetCore.OData 7.0.0-beta 1</p>