Bug #91902 DbContext.Database.SqlQuery runtime exception with Connector/NET 8.0.*
| Submitted: | 6 Aug 2018 2:11 | Modified: | 29 Jun 2019 0:42 |
|---|---|---|---|
| Reporter: | ncoda harmless | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / NET | Severity: | S1 (Critical) |
| Version: | 8.0.12.0 | OS: | Windows (10) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | DbContext, SqlQuery | ||
[9 Aug 2018 1:48]
ncoda harmless
NOTE: This is using EntityFramework version 6.1.1
[29 Jun 2019 0:42]
Roberto Ezequiel Garcia Ballesteros
Posted by developer: The fix was done in the EntityFramework6 code since 6.1.2 version.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
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.
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) { } }