Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Conversion of Reporting Starter Kit to use Mono/MySQL

0.00/5 (No votes)
1 Oct 2005 1  
A porting of the ASP.NET reporting starter kit to use Mono, MySQL and Apache on a Linux system.

Tools used

System setup

I started off with RedHat Linux Fedora Core 4 as my OS, and selected to install all components. After some installation problems, I ended up removing all the packages I needed so that I could install them from source. Specifically, I removed MySQL, Apache (HTTPD), and PHP (plus all dependencies). Next, I installed in the following order:

  1. MySQL
  2. PHP
  3. Apache
  4. Libgdiplus
  5. Mono
  6. XSP
  7. mod_mono

(See directions for each installation on your system.) Just don't forget to modify your httpd.conf for mod_mono use.

LoadModule mono_module modules/mod_mono.so
AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .axd

Data conversion

Thanks to a great tool MSSQL2MySql, I was able to fairly painlessly convert all of the tables and data over to MySQL style. All that was left were the stored procedures.

Now this is exactly why I chose MySQL 5.0. Even though it's in beta stage, it now supports stored procedures. One thing to note about it though, currently, mysqldump doesn't dump the procedures, though they plan to that in future. The conversion process for the stored procedures wasn't a hard process. With the extensive documentation on the MySQL website, it was just a matter of looking up what function translated to what. The major change I ran into was no DatePart function was available. Instead I had to use Extract.

Also, as mentioned above, phpmyadmin is a useful tool; it's a PHP website that provides you with a front end to your MySQL database. It is quite helpful for running scripts, and modifying tables etc. I used it to import the data file that MSSQL2MySql had created.

Code conversion

I admit I kind of cheated on the code porting. MySQL doesn't support the parameter Disconvery so I replaced that code with a simple switch statement that translates the procedure names to parameter names. In addition, I have used MySqlConnector here, and changed all the references of System.Data.SqlClient to MySql.Data.MySqlClient. That's it!

ASPX conversion

Now this was a pain. Images, filenames, etc. were all inconsistent. So I basically renamed everyone that presented a problem so that it was in lowercase. Like I said before, it wasn't hard, but it took some time.

Installation

As far as installing this app is concerned, you should follow these steps:

  1. Unzip the files to a directory of your choice. (i.e.. /var/www/aspnet/reports)
  2. Modify your httpd.conf and add the reports application:
    LoadModule mono_module modules/mod_mono.so
    MonoApplications /reports:/var/www/aspnet/reports
    <Location /reports>
            SetHandler mono
    </Location>
    AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .axd
  3. Start/Restart your Apache server (/etc/init.d/httpd restart).

With the nature of Linux, and its many flavors and installation styles, I don't think I can begin to list in detail every possible way to install this, or set it up. But feel free to leave any questions and I'll get back to you. All the sites given above have excellent documentation. (That's how I figured it out!)

Problems

The biggest problem I ran into was simply setting the system up. Once that was done, the biggest issue was inconsistencies in the case of filenames, and hand coding the stored procedures. But I think that if one were to write an application to make it portable, it would be a snap using mono. They really did a great job developing it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here