Description:
When using .NET Connector version 8, calling SqlQuery gets an error
System.Data.Entity.Core.EntityCommandExecutionException: 'The data reader has more than one field. Multiple fields are not valid for EDM primitive or enumeration types.'
This worked on prior versions of the connector (Currently using version 6.8.3.0).
This can be reproduced targeting at least MySQL Server versions 5.5,5.6 and 8.0
How to repeat:
//Here is an example simple .NET console program to reproduce the error
using MySql.Data.MySqlClient;
using System;
using System.Data.Common;
using System.Data.Entity;
using System.Linq;
class Program
{
static void Main(string[] args)
{
using (MySqlConnection cn = new MySqlConnection("Server=localhost;Database=test;Uid=root;Pwd=;SslMode=none"))
{
cn.Open();
using (var dbContext = new TestContext(cn, false))
{
long x = dbContext.Database.SqlQuery<long>("SELECT 1").Single();
Console.WriteLine(x);
}
}
}
}
// for prior connector version:
// [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))] [DbConfigurationType(typeof(MySql.Data.EntityFramework.MySqlEFConfiguration))]
class TestContext : DbContext
{
public TestContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection)
{
}
}
Description: When using .NET Connector version 8, calling SqlQuery gets an error System.Data.Entity.Core.EntityCommandExecutionException: 'The data reader has more than one field. Multiple fields are not valid for EDM primitive or enumeration types.' This worked on prior versions of the connector (Currently using version 6.8.3.0). This can be reproduced targeting at least MySQL Server versions 5.5,5.6 and 8.0 How to repeat: //Here is an example simple .NET console program to reproduce the error using MySql.Data.MySqlClient; using System; using System.Data.Common; using System.Data.Entity; using System.Linq; class Program { static void Main(string[] args) { using (MySqlConnection cn = new MySqlConnection("Server=localhost;Database=test;Uid=root;Pwd=;SslMode=none")) { cn.Open(); using (var dbContext = new TestContext(cn, false)) { long x = dbContext.Database.SqlQuery<long>("SELECT 1").Single(); Console.WriteLine(x); } } } } // for prior connector version: // [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))] [DbConfigurationType(typeof(MySql.Data.EntityFramework.MySqlEFConfiguration))] class TestContext : DbContext { public TestContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) { } }