Using Microsoft Enterprise Library with MySql


Here is a few steps to use MySql with Microsoft enterprise library and visual studio 2008.
Requirement.
1. Microsoft Visual studio 2008 installed
2. MySql database server is installed. If you didn’t have any mysql database, you can download here. and follow the installation instruction.
Install
1. Download and install Microsoft Enterprise Library. (You can download from here if You didn’t have any of it) Follow the installation instruction. After the installation success you need to proceed to the next installation of Mysql-connector-net-5.2.1(You can download from here if You didn’t have any of it).
Notes : Please notes that the Mysql connector for .net-5.2.1 is currently still on alpha release, so don’t use it in the production environment.
2. After the installation success, you will see the Microsoft enterprise library and the Mysql Conenctor menu in the start menu programs. Now open visual studio 2008, Create new project, add all the reference to the Enterprise library to Your project by right click the References in your project choose Add Reference. The add reference dialog is open and choose all the reference started with Enterprise Library.
3. Click the Enterprise Library Configuration in the Start > all programs > Microsoft patterns & practices > Enterprise Library 3.1 - May 2007. Then create a new application by clicking the New Application button in the toolbar. Right click on the Application configuration then choose New > Data access application block from here. After that, Name your connection String to what you deserve, Create your connection string and choose the right data profider name. In this case we are using the MySql.Data.MySqlClient
Here is an example of connection string :
server=<hostname>;user id=<username>;password=<password>;database=<database name>
After You create the Data access application block for enterprise library configuration, then save it as app.config in Your project folder inside the solution folder.
4. The last but not least. Add your app.config file to your project by right click on the project in visual studio choose add Existing item and choose the app.config file that You create before.
5. Now You can start to develop any application using Visual studio 2008 with Enterprise library and MySql support.
Leave a Reply