MyDirect .NETmysqlnet@devart.com

Licensing

This topic provides technical details on embedding license information into your applications. This is a special resource that must be present in every application that uses MyDirect .NET.

Note   License information discussed in this topic is not same thing as license for using MyDirect .NET. License purchased on our site allows you, your team or your company to use MyDirect .NET. For information on how to purchase license for using MyDirect .NET please refer to topic Ordering.

The article consists of following sections:

General Information

MyDirect .NET uses .NET component licensing. To build an application MyDirect .NET requires valid license. If no license is available, MyDirect .NET does not work.

License information is a specially formed embedded resource. Usually you do not have to care about embedding license in your application. When you install MyDirect .NET the system is configured so that licensing is done transparently. End-users of your software do not require any additional license.

MyDirect .NET includes License Wizard that helps you configure license information. The wizard analyzes the current project, informs you about problems found, and performs some actions needed to fix the problems.

To invoke the wizard choose Tools | MySQL | License Information menu item. Then click on Fix buttons in the dialog and follow the wizard's instructions. In most cases this is enough to configure .NET component licensing.

The following table helps get started quickly with MyDirect .NET licensing. Find your type of application and follow hyperlinks to corresponding sections of the article.

DiagramExplanation
This is general case of licensed .NET Framework application. Whatever the type of application you develop, read carefully sections Adding License Automatically and Adding License Manually.
These two diagrams show how you can use MyDirect .NET through a class library. In addition to Adding License Automatically and Adding License Manually please read section Class Libraries Support.
These are two modes of accessing MyDirect .NET within ASP.NET application. In addition to Adding License Automatically and Adding License Manually please read section Licensing ASP.NET Applications.
Some applications that have no licensing information embedded, and use DbProviderFactory to operate MyDirect .NET, require the product installed on the computer. Refer to section DbProviderFactory Notes for more information.

Adding License Automatically

License is automatically added to project when you drop a MySqlConnection component from Toolbox onto a form designer.

Under .NET Compact Framework, in the moment of compilation license information is automatically added if the MyDirect .NET addin for Visual Studio is running.

Adding License Manually

You may be required to manually add license. It is necessary for console applications, class libraries and existing projects initially built with MyDirect .NET version that did not use component licensing, that is, 3.20 and older. In this case perform the following steps:

If IDE fails to compile the license automatically you can do it yourself as described in section Compiling License Manually.

Class Libraries Support

In case where it is impossible to put the license information straight to executable file, MyDirect .NET allows you to create class libraries that can be used with certain executable files. To do this perform the following steps:

  1. Create and setup file named licenses.licx as described above.
  2. Create a text file named licenses.config and place it next to licenses.licx.
  3. In this file enumerate names of executable files that will work with the library, every file name on separate line, for example:

    MyApplication.exe
    MyAnotherApp.exe
    ExtraTool.exe

You do not have to add the file licenses.config to project.

Licensing ASP.NET Applications

In deployment of ASP.NET application to server you have two alternative ways.

  1. First, you can compile the application entirely, so that web server does not perform any compilation on demand. In this case licensing web applications is same as licensing common WinForms application.
  2. The other way is to upload source files to server, where they are compiled on user request. In this case you have to have special assembly App_Licenses.dll in the Bin directory of your site. To create this assembly execute Build Runtime Licenses command in the licenses.licx file context menu in the Solution Explorer view. Required assembly will be created automatically. Note that the context menu item is available when the licenses.licx file is located in the root folder of the site.

You can use the second approach for precompiled ASP.NET applications as well.

Licensing Compact Framework Projects

For .NET Compact Framework the Visual Studio addin automatically embeds all required information into every assembly that uses CoreLab.MySql.dll library. Class libraries are supported automatically.

If the license fails to be added to project, you can add and compile it manually. Note that there is no license compiler from Microsoft for .NET Compact Framework. You can request the compiler from Devart support team.

There is a known problem with the .NET Compact Framework. A "License not found" exception can be thrown by MySqlDataAdapter.Fill method in case when MySqlConnection had never been opened. To avoid the problem just open (or open and close) any connection before calling the MySqlDataAdapter.Fill method.

DbProviderFactory Notes

Applications that call MyDirect .NET through DbProviderFactory require MyDirect .NET installed on target machine. To deploy MyDirect .NET launch installer and use compact install type. The licenses.licx file is not required in this case. DbProviderFactory support allows using MyDirect .NET in SQL Server 2005 Business Intelligence Solutions.

Compiling License Manually

When your project does not have reference to CoreLab.MySql.dll the license cannot be compiled automatically. This section describes how to compile the required resource manually. If you have reference to CoreLab.MySql.dll in the project you can safely skip it.

Generate licensing resource file using following command line:
"%Compiler Path%\lc.exe" /target:MyApplication.exe /complist:licenses.licx /i:"%Assembly Path%\CoreLab.MySql.dll"
Where

Substitute these arguments with actual values. If license compiler fails with error, try adding full assembly specification to licenses.licx file, for example:
CoreLab.MySql.MySqlConnection, CoreLab.MySql, Version=3.20.5.0, Culture=neutral, PublicKeyToken=09af7300eec23701

License compiler will generate 'MyApplication.exe.licenses' resource file. You should add this file to your project as embedded resource. Note that if default namespace of your project is not an empty string it must be the same as target assembly name (in this case - 'MyApplication'). IDE adds default namespace to resource name when building application, so you have to rename 'MyApplication.exe.licenses' to 'exe.licenses' before adding it to project. If default namespace of your project is not set (is empty string) you do not have to rename resource file before adding it to project.

Licensing Mono Projects

Since automatic license generation and embedding is not possible with Mono you have to add and compile license manually as described above.

Troubleshooting

When something's wrong with license information you get one of the following exceptions on connecting to server:

Exception textPossible reasons and what to do

License not found...

This generally indicates that license information could not be found, or you try to apply it in some way that does not suit the kind of application. For example:

  • File licenses.licx, required for MyDirect .NET to function properly, could not be found.
  • File licenses.licx is not added as embedded resource.
  • File App_Licenses.dll not found in ASP.NET 2.0 applications.

To fix the problem determine type of your application and read corresponding section in this topic.

This exception can be thrown by MySqlDataAdapter.Fill method under .NET Compact Framework, in case when MySqlConnection had never been opened. To avoid the problem just open (or open and close) any connection before calling the MySqlDataAdapter.Fill method.

This message also can appear if you use VC++ in Visual Stdio .NET 2002 or 2003. This is known Microsoft bug. To avoid it you have to add and compile resource manually as described above.

License not valid...

This means that license information was found but it is incorrect. It usually happens in the following cases:

  • The project was earlier compiled with old or trial version of MyDirect .NET.
  • File licenses.config used by a class library does not refer to launched executable.
  • The App_Licenses.dll belongs to other application or needs to be recompiled.
  • Something's wrong with the operating system or installation of MyDirect .NET.

If you encounter this problem delete all files from obj folder and rebuild the project. If this does not help send to our support address small compiled binary with sources so we can investigate the problem detailed.

Sorry, your trial period has expired...

This exception indicates that you used trial version of MyDirect .NET, and the 30 days trial period is expired. To continue using MyDirect .NET register it or uninstall from your machine.

You can also see this message if the application was compiled with registered version of MyDirect .NET, but deployed with trial assembly CoreLab.MySql.dll. If this is the case, replace old files with latest assemblies.

 

 


© 2002-2008 Devart. All rights reserved.