MySQL Connector/NET Release Notes

2.10 Changes in MySQL Connector/NET 8.0.9 (2017-09-28, Development Milestone)

Functionality Added or Changed

  • For accuracy, the following Entity Framework 6 items were renamed:

    • NuGet package – MySql.Data.EntityFramework (was MySql.Data.Entity)

    • Namespace – MySql.Data.EntityFramework (was MySql.Data.Entity)

    • Assembly – MySql.Data.EntityFramework.dll (was MySql.Data.Entity.EF6.dll)

    (Bug #26396260)

  • X DevAPI: The SessionConfigManager.Update method was removed and the SessionConfigManager.Save method now always overwrites the data with the given key. For example:

    SessionConfigManager.Save(
       "mysess",
       "{ \"uri\": \"mysqlx://myuser@localhost/mysess\", \"appdata\": { \"biz\": \"quux\" } }"
    );
    
    SessionConfigManager.Save(
       "mysess",
       "{ \"uri\": \"mysqlx://test@localhost/mysess\", \"appdata\": { \"tar\": \"zzzz\" } }"
    );
    

    The mysess.uri and mysess.appdata values set by the first statement are replaced with the new values set by the second statement. (Bug #25829054, Bug #25860579)

  • MySQL Connector/NET now supports MySQL servers configured to use utf8mb4 as the default character set.

  • The following methods are available for use with EF Core in asynchronous command and connection operations:

    • Microsoft.EntityFrameworkCore.DbContext.AddAsync

    • Microsoft.EntityFrameworkCore.DbContext.AddRangeAsync

    • Microsoft.EntityFrameworkCore.DbContext.FindAsync

    • Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync

    • Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureDeletedAsync

    • Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreatedAsync

    • Microsoft.EntityFrameworkCore.DbContext.ToListAsync

  • X DevAPI: The following methods execute directly, whereas each method previously required .execute() as the final item in the method chain:

    • BaseSession.DropSchema

    • Collection.DropIndex

    • Schema.DropCollection

    • Schema.DropView

    In addition, the methods now succeed even if the objects to be dropped do not exist.

  • The AutoEnlist and IncludeSecurityAsserts connection-string options are not appropriate for use by applications that target .NET Core and now return an error when used.

  • EF Core: Support for explicit loading was added. Explicit loading is an object-relational mapper (O/RM) pattern introduced in EF Core 1.1.0, which enables .NET developers to explicitly load related data from the database at a later time.

  • The following connection-string options are not currently supported for use by applications that target .NET Core and now return an error when used:

    • SharedMemoryName

    • IntegratedSecurity

    • PipeName

    • Logging

    • UseUsageAdvisor

    • UsePerformanceMonitor

    • InteractiveSession

    • Replication

  • X DevAPI: To provide safe transactional document and row updates, the following new methods were added:

    • FindStatement.LockShared

    • FindStatement.LockExclusive

    • TableSelectStatement.LockShared

    • TableSelectStatement.LockExclusive

    The LockShared() and LockExclusive() methods can be called any number of times with either the Collection.Find() or Table.Select() method chains and in any combination. If multiple calls to the methods are made, only the final method is invoked. For additional information about the two types of locking, see Shared and Exclusive Locks.

  • X DevAPI: When creating a new session, multiple hosts can be tried until a successful connection is established. A list of hosts can be given in a connection string or as session creation options, with or without priorities.

    var mySession = MySQLX.GetSession(
      "mysqlx://dbuser:password@[" +
      "(address=localhost:33060, priority=90)," +
      "(address=192.1.10.10:33060, priority=100)," +
      "(address=[2001:db8:85a3:8d3:1319:8a2e:370:7348]:33060, priority=30)" +
      "]"
    );
    
    var mySession = MySQLX.GetSession(
      "user=dbuser;" +
      "password=dbpassword;" +
      "server=" +
      "(address=192.1.10.10, priority=90)," +
      "(address=server.example.com, priority=100)," +
      "(address=localhost, priority=30);" +
      "port=33060;"
    );
    
  • X DevAPI: The IN and NOT IN operators have been updated to expand the range of operands that can be evaluated by the Find(), Modify(), and Remove() methods for collections and the Select(), Update(), and Delete() methods for tables. This update provides support for expressions using the following syntax:

    compExpr ["NOT"] "IN" compExpr
    

    The previous syntax used with IN and NOT IN operators is still valid and it takes precedence over the new syntax when both are present.

  • X DevAPI: Several new direct-execution methods were added to the Collection class that operate at a single document level, unlike the other CRUD methods that operate on all documents that match a filter. The new methods are: ReplaceOne(), AddOrReplaceOne(), GetOne(), and RemoveOne().

  • Support for connections using Unix domain socket files was extended to include MySQL servers deployed on Linux hosts.

    X DevAPI connection example:

    "server=/path/to/socket;protocol=unix;user=root;password=mypass;ssl-mode=none"
    

    Classic MySQL connection example:

    "server=/path/to/socket;protocol=unix;user=root;password=mypass"
    
  • Connections to the MySQL server now can be made using accounts that authenticate with the sha256_password plugin. For more information, see SHA-256 Pluggable Authentication.

    In addition, a new connection option was added to extend authentication support for connections made using the X Protocol with either basic or URI connection strings and as an anonymous type. The auth connection option enables the MYSQL41, PLAIN, or EXTERNAL authentication mechanism if supported by the server. For a description of the auth option, see Options for X Protocol Only.

Bugs Fixed

  • Assemblies within NuGet packages were not fully signed. (Bug #26739307)

  • EF Core: Some methods in the DbContext class were not supported for use with asynchronous operations. (Bug #26448321, Bug #84814)

  • X DevAPI: Priority assignment when connecting to the server in client-side failover situations was not supported in earlier versions of the connector by design. Priority-based failover is now available. (Bug #26198794)

  • EF Core: When attempting to commit a transaction in which the FirstOrDefaultAsync method was called, the connector returned System.InvalidOperationException: Connection must be valid and open to commit transaction instead of committing the transaction. (Bug #26026972, Bug #86199)

  • X DevAPI: Passing in a value of 0 or lower to the Limit method now produces a more relevant error message indicating that the argument is out of range. (Bug #24384660)

  • X DevAPI: Passing in the NULL value as a parameter to the DbDoc.SetValue method resulted in an exception. This fix ensures that NULL is accepted for this method. (Bug #23542093)