Load licence data without having to Open() a connection

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
pergardebrink
Posts: 6
Joined: Mon 02 Jul 2018 08:26

Load licence data without having to Open() a connection

Post by pergardebrink » Wed 26 Jun 2019 11:29

When using the Devart.Data.MySql package from NuGet, is there any way other than doing a "fake" .Open() using a dummy connectionstring to provide a License key that works embedded without external dependencies like a separate license file?

The current approach, which works, but feels very ugly is doing like this (::0 is an invalid address which causes it to fail early and not to make an actual connection to localhost, which it would if no host is specified):

Code: Select all

try { 
	using (var dummy = new MySqlConnection(new MySqlConnectionStringBuilder {
		Host = "::0", LicenseKey = "LICENSEKEY_GOES_HERE"}.ToString())) {
		dummy.Open();
	}
} catch { }
Is there a better way to embed the license key and set it during application startup?

Shalex
Site Admin
Posts: 9122
Joined: Thu 14 Aug 2008 12:44

Re: Load licence data without having to Open() a connection

Post by Shalex » Thu 27 Jun 2019 13:27

conn.Open() with specified License Key is the only way to activate the license in a current application domain: https://www.devart.com/dotconnect/mysql ... ndard.html.

Post Reply