MySQL Connector/Net 6.9.10 has been released

Dear MySQL users,

MySQL Connector/Net 6.9.10 is a maintenance release for the 6.9.x
series of the .NET driver for MySQL. It can be used for production
environments.

It is appropriate for use with MySQL server versions 5.5-5.7.

It is now available in source and binary form from
http://dev.mysql.com/downloads/connector/net/#downloadsandmirrorsites
(note that not all mirror sites may be up to date at this point-if you
can’t find this version on some mirror, please try again later or choose
another download site.)


Changes in MySQL Connector/Net 6.9.10 (2017-10-23, General Availability)

   Bugs Fixed

     * Executing MySql.Web.Security.CreateUserAndAccount with
       valid arguments returned an out-of-range exception.
       Thanks to Stein Setvik for contributing to the fix.
       (Bug #25046364)

     * The default character set and encoding were not set
       properly when making a connection to MySQL 5.6 and 5.7
       servers configured to use the utf8 character set.
       (Bug #23257011)

The documentation is available at:
http://dev.mysql.com/doc/connector-net/en/

Nuget packages are available at:
https://www.nuget.org/packages/MySql.Data/6.9.10
https://www.nuget.org/packages/MySql.Data.Entity/6.9.10
https://www.nuget.org/packages/MySql.Fabric/6.9.10
https://www.nuget.org/packages/MySql.Web/6.9.10


Enjoy and thanks for the support!

On behalf of the MySQL Connector/NET and the MySQL/ORACLE RE Team
Gipson Pulla

MySQL Connector/Net 8.0.9-dmr has been released

Dear MySQL users,

MySQL Connector/Net 8.0.9 is the sixth development release that expands
cross-platform support to Linux and macOS when using Microsoft’s .NET Core
framework. Now, .NET developers can use the X DevAPI with .NET Core and
Entity Framework Core (EF Core) 1.0 to create server applications that run
on Windows, Linux and macOS. We are very excited about this change and
really look forward to your feedback on it!

MySQL Connector/Net 8.0.9 is also the eighth development release of MySQL
Connector/Net to add support for the new X DevAPI.  The X DevAPI enables
application developers to write code that combines the strengths of the
relational and document models using a modern, NoSQL-like syntax that
does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/index.html. For more
information about how the X DevAPI is implemented in Connector/Net, see
http://dev.mysql.com/doc/dev/connector-net.

Please note that the X DevAPI requires at least MySQL Server version
5.7.12 or higher with the X Plugin enabled. For general documentation
about how to get started using MySQL as a document store, see
http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

To download MySQL Connector/Net 8.0.9-dmr, see the “Development
Releases” tab at http://dev.mysql.com/downloads/connector/net/


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


* Functionality Added or Changed

* Bugs Fixed

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.Databas
eFacade.EnsureDeletedAsync

+ Microsoft.EntityFrameworkCore.Infrastructure.Databas
eFacade.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
(http://dev.mysql.com/doc/refman/5.7/en/innodb-locking.html#innodb-shared-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
(http://dev.mysql.com/doc/refman/5.7/en/sha256-pluggable-authentication.html).
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 Connector/Net Connection-String Options
Reference
(http://dev.mysql.com/doc/connector-net/en/connector-net-connection-options.html).

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)

Nuget packages are available at:

https://www.nuget.org/packages/MySql.Data/8.0.9-dmr
https://www.nuget.org/packages/MySql.Web/8.0.9-dmr
https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/8.0.9-dmr
https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore.Design/8.0.9-dmr

Enjoy and thanks for the support!

On Behalf of the MySQL/ORACLE RE Team
Gipson Pulla

MySQL Connector/Net 8.0.8-dmr has been released

MySQL Connector/Net 8.0.8 is the fifth development release that expands cross-platform
support to Linux and macOS when using Microsoft’s .NET Core framework. Now, .NET
developers can use the X DevAPI with .NET Core and Entity Framework Core (EF Core)
1.0 to create server applications that run on Windows, Linux and macOS. We are very
excited about this change and really look forward to your feedback on it!

MySQL Connector/Net 8.0.8 is also the seventh development release of MySQL
Connector/Net to add support for the new X DevAPI. The X DevAPI enables application
developers to write code that combines the strengths of the relational and document
models using a modern, NoSQL-like syntax that does not assume previous experience
writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/index.html.
For more information about how the X DevAPI is implemented in Connector/Net, see
http://dev.mysql.com/doc/dev/connector-net.

Note

The X DevAPI requires at least MySQL Server version 5.7.12 or higher with the X
Plugin enabled. For general documentation about how to get started using MySQL
as a document store, see http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

To download MySQL Connector/Net 8.0.8-dmr, see the “Development Releases” tab at
http://dev.mysql.com/downloads/connector/net/

 


Changes in MySQL Connector/Net 8.0.8 (2017-07-10, Development Milestone)

   MySQL Connectors and other MySQL client tools and
   applications now synchronize the first digit of their version
   number with the (highest) MySQL server version they support.
   For example, MySQL Connector/Net 8.0.12 would be designed to
   support all features of MySQL server version 8 (or lower).
   This change makes it easy and intuitive to decide which
   client version to use for which server version.

   MySQL Connector/Net 8.0.8 is the first release to use the new
   numbering. It is the successor to MySQL Connector/Net 7.0.7.

     * Functionality Added or Changed

     * Bugs Fixed

   Functionality Added or Changed

     * X DevAPI: The format of document ID values generated when
       adding documents to a collection has changed. It is still
       a string of 32 hexadecimal digits based on UUID, but the
       order of digits was changed to match the requirement of a
       stable ID prefix.

     * All connections created using MySQL Connector/Net now are
       secure by default. Also, the Ssl-Enable connection option
       has been replaced by Ssl-Mode. Permitted Ssl-Mode values
       are None, Required (the default), VerifyCA, and
       VerifyFull.

       With this change, a non-SSL enabled server now requires
       the Ssl-Mode option be set to None explicitly in the
       connection string or the connection will fail.

     * X DevAPI: It is no longer permitted to pass an empty
       search condition, such as the NULL value or an empty
       string, to the Collection.Modify and Collection.Remove
       methods.
	
     * X DevAPI: The NodeSession class has been renamed to
       Session and the MySQLX.GetNodeSession method has been
       renamed to MySQLX.GetSession. Also, the XSession class
       has been removed.

     * X DevAPI: When creating a new connection, multiple hosts
       now can be specified as part of the connection string,
       which will try each host until a successful connection is
       established or all elements from the host list have been
       tried. The following connection-string formats are
       supported:

	    var mySession = MySQLX.GetSession(
	      "mysqlx://dbuser:password@[" +
	      "localhost:33060," +
	      "192.1.10.10:33060," +
	      "[2001:db8:85a3:8d3:1319:8a2e:370:7348]:33060" +
	      "]"
	    );

	    var mySession = MySQLX.GetSession(
	      "user=dbuser;" +
	      "password=dbpassword;" +
	      "server=" +
	      "192.1.10.10," +
	      "server.example.com," +
	      "localhost;" +
	      "port=33060;"
	    );

   Bugs Fixed

     * EF Core: The Database First feature did not support the
       following data types: BINARY, VARBINARY, MEDIUMBLOB,
       LONGBLOB, SET, DATE, TIME, and YEAR. (Bug #25493209)

     * EF Core: Database First support produced an error when
       the existing MySQL database included one or more views.
       (Bug #25493086)

     * EF Core: Using
       System.ComponentModel.DataAnnotations.Schema.TableAttribu
       te to initialize a new class instance that specified the
       name of an existing MySQL table produced incorrect
       mappings of table and column names.
       (Bug #25394223, Bug #84423)

Nuget

Packages are available at:

https://www.nuget.org/packages/MySql.Data/8.0.8-dmr
https://www.nuget.org/packages/MySql.Web/8.0.8-dmr
https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/8.0.8-dmr
https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore.Design/8.0.8-dmr

Enjoy and thanks for the support!

On Behalf of MySQL/Oracle Release Engineering Team
Prashant Team

Getting started with ASP.NET Core and MySQL Connector/NET

This tutorial shows how to read information from MySQL Sakila database in an ASP.NET Core application using Connector/NET Core to explore the possibility to run this application on any .NET Core supported environment as Windows, Linux, and Mac.

Pre-requisites:

Windows and Visual Studio 2015

The first step is to create an ASP.NET Core Web Application (.NET Core) type project and name it MvcSakilaCore

Note: the project name should not contain spaces

 

cnet_aspnetcore_010

Select Web Application template and No Authentication:

cnet_aspnetcore_020

The new project will be created:

cnet_aspnetcore_030

Press F5 to run the application:

cnet_aspnetcore_040

Stop the running application to add some code.

Creating the data model

Create a new folder named “Models” where it will store the database access:

cnet_aspnetcore_050

Installing MySQL Connector/NET Core package

In order to use MySQL Connector/NET it’s required to add its nuget package.

In Solution Explorer, right-click MvcSakilaCore project > Manage NuGet Packages…
In the NuGet dialog, Browse “MySql.Data” package using version 6.10.0 or above:

cnet_aspnetcore_060

Adding the connection string

Add your connection string in the appsettings.json file:

cnet_aspnetcore_070

Adding data model classes

For this example a Film class will be used. It contains the database fields as properties we want to show in our application.

Add a new class named “Film” inside Models folder:

Create a new SakilaContext class that will contains the connections and Sakila database entities:

In order to be able to use our SakilaContext it’s required to register the instance as a service in our application. To do this add the code line in the Startup.cs file:

cnet_aspnetcore_090

Adding Film Controller

In Solution Explorer, right-click Controllers > Add > New Item… > MVC Controller Class
Name the controller FilmsController:

cnet_aspnetcore_100

cnet_aspnetcore_110

Change the FilmsController code to this:

Creating the Films View

Start creating the Films folder under Views:

In Solution Explorer, right click Views > Films > Add > New Item… > ASP.NET > MVC View Page

cnet_aspnetcore_130

Add the following code into the new Index.cshtml view file:

Before run the application, add the Films path to the running url.

In Solution Explorer, right click MvcSakilaCore > Properties > Debug > Launch URL > Films:

cnet_aspnetcore_150

Run the application (press F5) and the Films list should be displayed:

cnet_aspnetcore_160