title: Entity Framework exception from query. Only primitive types or enumeration types are supported in this contex
body: <p>No sure why I'm getting this error running this query below</p>
  
  <blockquote>
    <p>Unable to create a constant value of type 'YogaBandy2017.Models.Profile.YogaProfile'. Only primitive types or enumeration types are supported in this context.</p>
  </blockquote>
  
  <pre><code>var requestedEvents = dbContext.YogaSpaceEvents
    .Where(i =&gt; i.RequestedInstructor == yogaProfile)
    .OrderByDescending(i =&gt; i.EventDateTime)
    .Select(i =&gt; new PendingEvent
    {
        SpaceName = i.YogaSpace.Overview.Title,
        SpaceImage = i.YogaSpace.YogaSpaceImages
                        .Where(j =&gt; j.IsMainImage)
                        .Select(j =&gt; j.ImageThumbnailCropped11)
                        .FirstOrDefault(),
  
        SpaceId = i.YogaSpace.YogaSpaceId,
        SpaceEventsHosted = i.YogaSpace.ClassesHosted,
        SpaceReviewNumber = i.YogaSpace.ReviewNumber,
        SpaceReviewPercent = i.YogaSpace.ReviewPercentage,
        SpaceNumberOfReviews = i.YogaSpace.NumberOfReviews,
  
        HostImage = i.YogaSpace.YogaProfile.YogaProfileImages
                      .Where(k =&gt; k.IsMainImage)
                      .Select(k =&gt; k.ImageThumbnailCropped)
                      .FirstOrDefault(),
  
        HostId = i.YogaSpace.YogaProfile.YogaProfileId,
        HostName = i.YogaSpace.YogaProfile.FirstName,
  
        EventDateTime = i.EventDateTime,
        Style = i.StyleMain.ToString(),
        Duration = i.Duration,
  
        EventId = i.YogaSpaceEventId
    })
    .ToList();
  </code></pre>