Accepted answer

I think what is happening is that, EFCore expects a Collection Or IEnumerable To be able to map to the Collection Property of My Parent Entity

Looks like this is a bug with EF-Core. Maybe I'm overlooking the spec and only Collections should map to collections? As a work around I resolved this with SelectMany and Take.

var messages =  query.SelectMany(x => x.Messages.OrderBy(m => m.Created).Take(1))
                     .OrderBy(x => x.ConversationId)


You can force includes with this syntax

var query = this._context.Conversations.Include("Messages").OrderBy(x => x.Id);

Related Articles