1

I'm trying to load multiple grandchild collections to my object.

    using (var context = GetContext())
    {
        return await context.Collection.Where(c => c.Id == id)
            .Include(a => a.Child.Select(b => b.GrandChildCollection1))
            .Include(a => a.Child.Select(b => b.GrandChildCollection2))
            .FirstOrDefaultAsync();
    }

According to EF eager load multiple child child collections and https://stackoverflow.com/a/44604899/5903172 my code should work but I'm getting the following error:

"Unknown column 'Extent1.Id' in 'on clause'"

This guy seem to have had the same issue MySQL Unknown column 'Extent1.ID' in 'on clause' with EF6

Anybody got any ideas? Thanks!

  • 1
    The question you linked to doesn't have basic information like the table schemas, context configuration and the generated query. The query is generated by the database provider. MySQL's own Connector/.NET has several issues and people use other providers like [Pomelo.EntityFrameworkCore.MySQL](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/). Depending on the EF version you use you can log the generated SQL statements. In EF 6.2 you can do it by assigning a stream object to `DbContext.Database.Log`, eg `context.Database.Log=Console.Out`. – Panagiotis Kanavos Jan 16 '19 at 14:20

0 Answers0