MySQL Connector/NET Release Notes

2.18 Changes in MySQL Connector/NET 8.0.20 (2020-04-27, General Availability)

Functionality Added or Changed

  • Connector/NET now supports Entity Framework Core 3.1.1 on all platforms with NET Standard 2.0 support. Microsoft Entity Framework Core 3.1.1 is not compatible with the previous versions of EF Core and those previous versions (2.1, 2.0, 1.1) are not supported by this release of Connector/NET (see Entity Framework Core Support).

    In addition, the MySql.Data.EntityFrameworkCore.Design NuGet package is deprecated and the functionality provided by that package now is merged with the MySql.Data.EntityFrameworkCore package. (WL #13793)

  • Connector/NET now provides compression of X Protocol payload data, which can be configured using the new Compression connection option. The option is set to preferred mode by default to compress the payload data if the MySQL server instance also supports compression. For a description of each option value, see Options for X Protocol Only. (WL #12980)

  • Document Store: Connector/NET now provides JSON schema validation for a collection to enforce a certain structure that documents must adhere to before they are permitted to be inserted or updated. Schema validation is performed by the server, which returns an error message if a document in a collection does not match the schema definition or if the server does not support validation.

    The existing Schema.CreateCollection method now is overloaded and can be used to pass a CreateCollectionOptions object with a schema definition to a MySQL server. The ReuseExistingObject parameter of the original method is set as an option within CreateCollectionOptions when using the new overloaded method. The level of enforcement (off or strict, strict by default) and schema definition are specified using the validation option, for example:

    var collOptions = CreateCollectionOptions() {
      reuseExistingObject = false,
      validation = Validation() {
        level = ValidationLevel.Strict,
        schema = "{\"id\": \"http://json-schema.org/geo\","
                 + "\"$schema\": \"http://json-schema.org/draft-06/schema#\","
                 + "       \"description\": \"A geographical coordinate\","
                 + "       \"type\": \"object\","
                 + "       \"properties\": {"
                 + "          \"latitude\": {"
                 + "             \"type\": \"number\""
                 + "          },"
                 + "          \"longitude\": {"
                 + "             \"type\": \"number\""
                 + "          }"
                 + "       },"
                 + "       \"required\": [\"latitude\", \"longitude\"]"
                 + "  }"
        }
    };
    
    var coll = schema.CreateCollection("longlang", collOptions);      
    

    In addition, a new method permits the schema validation of an existing collection to be reset. The Schema.ModifyCollection method passes a ModifyCollectionOptions object to the server. The validation collection option must include either a modified level value or schema value (or both), for example:

    var collOptions = ModifyCollectionOptions() {
      validation = Validation() {
        level = ValidationLevel.Off
          }
    };
    
    var coll = schema.ModifyCollection("longlang", collOptions);
    

    The ReuseExistingObject option is not supported for modifications and returns an error message if it is used. (WL #13007)

Bugs Fixed

  • A connection made to a named server with multiple DNS entries pointing to different IP addresses for the same server generated an exception. Now, only the first element is returned when multiple elements are found. (Bug #30970949, Bug #97448)

  • The MySQL.Data NuGet package for Connector/NET 8.0.19 included an unsigned version of Ubiety.Dns.Core.dll, which produced an exception when loaded. (Bug #30798305, Bug #98204)

  • Scaffolding a MySQL database with EF Core 3.0 was not implemented by Connector/NET and the connector returned an exception in response to its use. Support for EF Core 3.1.1 in this release adds scaffolding capabilities. (Bug #30677382, Bug #98011)

  • The get_info method was not included in any of the Entity Framework Core versions (1.1, 2.0, and 2.1) that Connector/NET supported. Connector/NET now supports EF Core 3.1.1 and implements the MySql.Data.EntityFrameworkCore.Infrastructure.MySQLOptionsExtension.Internal.get_info method. (Bug #30347893, Bug #96990)

  • The MySqlDbType.JSON type when used as a parameter in a prepared statement produced code errors. Connector/NET now interprets MySqlDbType.JSON as MySqlDbType.VarChar. No code changes are required to specify a JSON column. (Bug #29959124, Bug #95984)

  • Blank spaces mixed with values in the IN() list of a SELECT statement generated an error. (Bug #29838254)

  • An attempt to read the record of a model class defined to correspond to a MySQL table with a property of type bool? (nullable Boolean), using the EF Core database context, returned an error message. (Bug #29833103, Bug #93028)

  • Access to the MySqlDataReader object was restricted when the parent MySqlCommand object was closed. This fix modifies MySqlCommand.Dispose() to no longer call the ResetReader method. (Bug #27441433, Bug #89159)