MySQL Forums
Forum List  »  MySQL for Visual Studio

Exceptions when using Multiple Includes
Posted by: Tom Rieck
Date: October 28, 2016 04:36PM


I've got these Classes:

class Family()
public int Id {get; set;}
public List<Person> members {get; set;}

class Person()
public int Id {get; set;}
public List<Items> items {get; set;}
public List<Person> friends {get; set;}

How can I get a Family with all their Persons and these persons should be populated with all their items and friends in one query?

This doesnt work:

(from f in fcontext.families
where f.Name == "Schmidt"
select f).Include("members.items").Include("members.friends").ToList();

I'm using MySQL Entity Framework Provider as the database behind is a MySQL DB. That throws this exception each time i have multiple includes:

Unknown column 'Join1.Id1' in 'on clause'.

Theres just above string in the exception, nothing else.

This is the stacktrace:

bei MySql.Data.MySqlClient.MySqlStream.ReadPacket()
bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
bei MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()
bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
bei MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
bei System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
bei System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)

Options: ReplyQuote

Written By
Exceptions when using Multiple Includes
October 28, 2016 04:36PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.