Reputation: 25
So I have been trying to get a MySql connection to work in universal windows platform but have not been very successful. My first issue was that I was unable to get the connector to work because it was made for.NetCore rather than.NETFramework. I have now found one but I am getting the issue that it needs to have a reference to System.data version 2.0.0.0, however, as UWP already have a version of System.data in its core reference when I then reference System.Data version 2.0.0.0 it throws the error 'reference to type 'component' claims it is defined in 'system', but it is not found ' So I am any sure what to do next, thanks in advance for any help!
Upvotes: 1
Views: 1206
Reputation: 15758
Update: Since UWP has added support for .NET Standard 2.0, we can now use the latest MySQL Connector/NET from NuGet directly.
The latest MySQL Connector for .Net now is MySQL Connector/Net 8.0.8. This Connector supports Microsoft’s .NET Core framework. However, if we look at its NuGet package, we will find it dependents on .NET Standard 1.6 which is not supported by UWP now (See .NET platforms support). So for now, we can't use this in UWP apps.
To connect MySQL database, you can try with Connector/Net for Windows Store. The key point here is using MySql.Data.RT.dll. The latest version seems to be the one in Connector/Net 6.9.8. You can extract the contents and manually reference the DLL under the RT folder. For more info about how to use it, please refer to How to: Using MySQL Connector/NET with Windows Store Apps and Using MySQL database with UWP.
Upvotes: 3
Reputation: 245
You should be able to utilise the runtime version of the MySQL library MySql.Data.RT.dll
to make connections to and from your database.
With WinRT being based on .net core instead of the full framework, you will lose some features moving from the full assembly to the RT version such as load balancing - these are documented here: https://dev.mysql.com/doc/connector-net/en/connector-net-rt.html
Let me know if you need any more assistance
Upvotes: 1