Bug #46142 Problema connector.net 6.0 entity framework
Submitted: 13 Jul 2009 7:39 Modified: 7 Aug 2009 14:24
Reporter: Junior Gasparotto Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.0.4 OS:Microsoft Windows (Vista)
Assigned to: CPU Architecture:Any
Tags: EntityFramework EF

[13 Jul 2009 7:39] Junior Gasparotto
Description:
Hello, 

I have a problem with the connector.net 6.0.4. 

When using LOAD Eager to load several relationships "include" I have the following problem. 

Add includes several 

IQueryable <UsuarioModel> query = DataBase.UsuariosModels 
query = query.Include ( "FuncaoModel"); 
query = query.Include ( "ItemsNovos"); 
query = query.Include ( "ItemsVelhos"); 
query = query.Include ( "Reports"); 
query = query.Include ( "Grupos.Permissoes"); 

var result = (from row in query 
               where 
                    == row.login login 
                & & Password == row.senha 
              select row). FirstOrDefault (); 

THE ERROR: 

--------------------------------------------------------------
"You can not convert an object of type 'System.Byte []' in type 'System.IConvertible'. "
--------------------------------------------------------------

I believe this is a mistake. 

I look back

How to repeat:
Hello, 

I have a problem with the connector.net 6.0.4. 

When using LOAD Eager to load several relationships "include" I have the following problem. 

Add includes several 

IQueryable <UsuarioModel> query = DataBase.UsuariosModels 
query = query.Include ( "FuncaoModel"); 
query = query.Include ( "ItemsNovos"); 
query = query.Include ( "ItemsVelhos"); 
query = query.Include ( "Reports"); 
query = query.Include ( "Grupos.Permissoes"); 

var result = (from row in query 
               where 
                    == row.login login 
                & & Password == row.senha 
              select row). FirstOrDefault (); 

THE ERROR: 

--------------------------------------------------------------
"You can not convert an object of type 'System.Byte []' in type 'System.IConvertible'. "
--------------------------------------------------------------

I believe this is a mistake. 

I look back
[15 Jul 2009 4:45] Junior Gasparotto
project with problema. execute file script.sql to create end add tables e datas.

Attachment: ClassLibrary1.rar (application/octet-stream, text), 123.95 KiB.

[7 Aug 2009 12:13] Tonci Grgin
Hi Junior and thanks for your report.

Some of the types do get declared as BYTE... What are the field type you use? If you happen to have timestamp field, see Bug#46311.
[7 Aug 2009 12:38] Tonci Grgin
Junior, related auto-generated EF query is:
"SELECT\r\n`UnionAll3`.`C2` AS `C1`, \r\n`UnionAll3`.`C3` AS `C2`, \r\n`UnionAll3`.`C4` AS `C3`, \r\n`UnionAll3`.`C1` AS `C4`, \r\n`UnionAll3`.`C5`, \r\n`UnionAll3`.`C6`, \r\n`UnionAll3`.`C7`, \r\n`UnionAll3`.`C8`, \r\n`UnionAll3`.`C9`, \r\n`UnionAll3`.`C10`, \r\n`UnionAll3`.`C11`, \r\n`UnionAll3`.`C12`, \r\n`UnionAll3`.`C13`, \r\n`UnionAll3`.`C14`, \r\n`UnionAll3`.`C15`, \r\n`UnionAll3`.`C16`, \r\n`UnionAll3`.`C17`, \r\n`UnionAll3`.`C18`, \r\n`UnionAll3`.`C19`, \r\n`UnionAll3`.`C20`\r\nFROM ((SELECT\r\n`UnionAll2`.`C1`, \r\n`UnionAll2`.`C2`, \r\n`UnionAll2`.`C3`, \r\n`UnionAll2`.`C4`, \r\n`UnionAll2`.`C5`, \r\n`UnionAll2`.`C6`, \r\n`UnionAll2`.`C7`, \r\n`UnionAll2`.`C8`, \r\n`UnionAll2`.`C9`, \r\n`UnionAll2`.`C10`, \r\n`UnionAll2`.`C11`, \r\n`UnionAll2`.`C12`, \r\n`UnionAll2`.`C13`, \r\n`UnionAll2`.`C14`, \r\n`UnionAll2`.`C15`, \r\n`UnionAll2`.`C16`, \r\n`UnionAll2`.`C17`, \r\n`UnionAll2`.`C18`, \r\n`UnionAll2`.`C19`, \r\n`UnionAll2`.`C20`\r\nFROM ((SELECT\r\n`UnionAll1`.`C1`, \r\n`UnionAll1`.`Id` AS `C2`, \r\n`UnionAll1`.`nome` AS `C3`, \r\n`UnionAll1`.`C2` AS `C4`, \r\n`UnionAll1`.`C3` AS `C5`, \r\n`UnionAll1`.`idGrupoUsuario` AS `C6`, \r\n`UnionAll1`.`idgrupo` AS `C7`, \r\n`UnionAll1`.`idusuario` AS `C8`, \r\n`UnionAll1`.`C4` AS `C9`, \r\n`UnionAll1`.`C5` AS `C10`, \r\n`UnionAll1`.`C6` AS `C11`, \r\n`UnionAll1`.`C7` AS `C12`, \r\n`UnionAll1`.`C8` AS `C13`, \r\n`UnionAll1`.`C9` AS `C14`, \r\n`UnionAll1`.`C10` AS `C15`, \r\n`UnionAll1`.`C11` AS `C16`, \r\n`UnionAll1`.`C12` AS `C17`, \r\n`UnionAll1`.`C13` AS `C18`, \r\n`UnionAll1`.`C14` AS `C19`, \r\n`UnionAll1`.`C15` AS `C20`\r\nFROM ((SELECT\r\nCASE WHEN (`Extent2`.`idgrupo` IS  NULL) THEN (NULL)  ELSE (1) END AS `C1`, \r\n`Extent1`.`Id`, \r\n`Extent1`.`nome`, \r\n1 AS `C2`, \r\nCASE WHEN (`Extent2`.`idgrupo` IS  NULL) THEN (NULL)  ELSE (1) END AS `C3`, \r\n`Extent2`.`idGrupoUsuario`, \r\n`Extent2`.`idgrupo`, \r\n`Extent2`.`idusuario`, \r\nNULL AS `C4`, \r\nNULL AS `C5`, \r\nNULL AS `C6`, \r\nNULL AS `C7`, \r\nNULL AS `C8`, \r\nNULL AS `C9`, \r\nNULL AS `C10`, \r\nNULL AS `C11`, \r\nNULL AS `C12`, \r\nNULL AS `C13`, \r\nNULL AS `C14`, \r\nNULL AS `C15`\r\nFROM `usuario` AS `Extent1` LEFT OUTER JOIN `usuariogrupo` AS `Extent2` ON `Extent1`.`Id` = `Extent2`.`idusuario`) UNION ALL (SELECT\r\n2 AS `C1`, \r\n`Extent3`.`Id`, \r\n`Extent3`.`nome`, \r\n1 AS `C2`, \r\nNULL AS `C3`, \r\nNULL AS `C4`, \r\nNULL AS `C5`, \r\nNULL AS `C6`, \r\n1 AS `C7`, \r\n`Extent4`.`Id` AS `Id1`, \r\n`Extent4`.`nome` AS `nome1`, \r\n`Extent4`.`idusuario`, \r\nNULL AS `C8`, \r\nNULL AS `C9`, \r\nNULL AS `C10`, \r\nNULL AS `C11`, \r\nNULL AS `C12`, \r\nNULL AS `C13`, \r\nNULL AS `C14`, \r\nNULL AS `C15`\r\nFROM `usuario` AS `Extent3` INNER JOIN `relatorios` AS `Extent4` ON `Extent3`.`Id` = `Extent4`.`idusuario`)) AS `UnionAll1`) UNION ALL (SELECT\r\n3 AS `C1`, \r\n`Extent5`.`Id`, \r\n`Extent5`.`nome`, \r\n1 AS `C2`, \r\nNULL AS `C3`, \r\nNULL AS `C4`, \r\nNULL AS `C5`, \r\nNULL AS `C6`, \r\nNULL AS `C7`, \r\nNULL AS `C8`, \r\nNULL AS `C9`, \r\nNULL AS `C10`, \r\n1 AS `C11`, \r\n`Extent6`.`Id` AS `Id1`, \r\n`Extent6`.`nome` AS `nome1`, \r\n`Extent6`.`idusuario`, \r\nNULL AS `C12`, \r\nNULL AS `C13`, \r\nNULL AS `C14`, \r\nNULL AS `C15`\r\nFROM `usuario` AS `Extent5` INNER JOIN `backendassociado` AS `Extent6` ON `Extent5`.`Id` = `Extent6`.`idusuario`)) AS `UnionAll2`) UNION ALL (SELECT\r\n4 AS `C1`, \r\n`Extent7`.`Id`, \r\n`Extent7`.`nome`, \r\n1 AS `C2`, \r\nNULL AS `C3`, \r\nNULL AS `C4`, \r\nNULL AS `C5`, \r\nNULL AS `C6`, \r\nNULL AS `C7`, \r\nNULL AS `C8`, \r\nNULL AS `C9`, \r\nNULL AS `C10`, \r\nNULL AS `C11`, \r\nNULL AS `C12`, \r\nNULL AS `C13`, \r\nNULL AS `C14`, \r\n1 AS `C15`, \r\n`Extent8`.`Id` AS `Id1`, \r\n`Extent8`.`nome` AS `nome1`, \r\n`Extent8`.`idusuario`\r\nFROM `usuario` AS `Extent7` INNER JOIN `entidades` AS `Extent8` ON `Extent7`.`Id` = `Extent8`.`idusuario`)) AS `UnionAll3`\r\n ORDER BY \r\n`C2` ASC, \r\n`C1` ASC"
Starting the mysql command line client with --column-type-info reveals following:
Field  13:  `C13`
Catalog:    `def`
Database:   ``
Table:      `UnionAll3`
Org_table:  ``
Type:       STRING
Collation:  binary (63)
Length:     20
Max_length: 20
Decimals:   0
Flags:      BINARY 

Field  14:  `C14`
Catalog:    `def`
Database:   ``
Table:      `UnionAll3`
Org_table:  ``
Type:       STRING
Collation:  binary (63)
Length:     11
Max_length: 11
Decimals:   0
Flags:      BINARY 

Field  16:  `C16`
Catalog:    `def`
Database:   ``
Table:      `UnionAll3`
Org_table:  ``
Type:       STRING
Collation:  binary (63)
Length:     11
Max_length: 11
Decimals:   0
Flags:      BINARY 

Field  17:  `C17`
Catalog:    `def`
Database:   ``
Table:      `UnionAll3`
Org_table:  ``
Type:       STRING
Collation:  binary (63)
Length:     20
Max_length: 20
Decimals:   0
Flags:      BINARY 

Field  18:  `C18`
Catalog:    `def`
Database:   ``
Table:      `UnionAll3`
Org_table:  ``
Type:       STRING
Collation:  binary (63)
Length:     11
Max_length: 11
Decimals:   0
Flags:      BINARY 

Field  20:  `C20`
Catalog:    `def`
Database:   ``
Table:      `UnionAll3`
Org_table:  ``
Type:       STRING
Collation:  binary (63)
Length:     11
Max_length: 11
Decimals:   0
Flags:      BINARY 

So, to bypass the metadata returned from MySQL server you should add "Respect Binary Flags=false" to your connection string.
[7 Aug 2009 14:24] Junior Gasparotto
Hello, 

Thanks, the error was not more:) 

But running all 'Eager load' the example 'ClassLibrary1' two associations have not been charged in the body. 

q = q.Include("usuariogrupos");
q = q.Include("relatorios");
q = q.Include("backendassociados");
q = q.Include("entidades"); 

result: 

q.usuariogrupos - OK 
q.relatorios - OK 
q.backendassociados - 0 result, more data in there: ( 
q.entidades - 0 result, more data in there: ( 

Any idea to the problem? 

Thanks
[25 Mar 2011 14:48] Matt Houser
I am having this problem using Entity Framework and Connector 6.3.6.

My issue seems to be once an entity gets to a certain size or something like that.  I have an entity with 9 fields, but once I add a 10th (regardless of type), I start getting this error.

Please increase priority and fix it.
[8 Apr 2013 8:00] Henry Zhou
I met same issue with Connector NET 6.6.5, please fixed this or give solution to walk around.

Many many thanks!!!!
[8 Apr 2013 13:58] Henry Zhou
To clarify this issue clearly, I'd like to put more words here.

I have a class named Employee which has the following definition:

    public class Employee : TraceableBaseEntity
    {
        public Employee()
        {
            Contracts = new List<Contract>();
            LongLeaves = new List<LongLeave>();
            EmployeeSettlementSettings = new List<EmployeeSettlementSetting>();
        }

        [Key]
        public string BadgeNo { get; set; }
        public string Name { get; set; }
        public List<Contract> Contracts { get; set; }
        public List<LongLeave> LongLeaves { get; set; }
        public List<EmployeeSettlementSetting> EmployeeSettlementSettings { get; set; }
    }

When I use "include" to eager load Contracts,LongLeaves and EmployeeSettlementSettings as below:

            db.Employees.AsNoTracking()
                .Include(i => i.Contracts)
                .Include(i => i.LongLeaves)
                .Include(i => i.EmployeeSettlementSettings)
                .ToList();

I got strange exception "String was not recognized as a valid Boolean.", but if I only eager load 2 of them, anything will be fine. 

These codes are working fine with Microsoft SQL Server. I try to migrate database to MtSQL. So I got this issue. Please help, thanks!