Tuesday, January 13, 2009

ConfigurationManager.AppSettings avoid null errors

I found a smart way how to avoid checking for null by using AppSettings.Get or to get an 'Object reference not set to an instance of an object' if not checking for null

Classic method:
string notsmart = String.Empty;
if (ConfigurationManager.AppSettings["test"] != null)
notsmart = ConfigurationManager.AppSettings["test"].ToString();

One-step method:
string keyvalue = ConfigurationManager.AppSettings.Get("test");

Monday, January 12, 2009

MySQL Documentation Tool

I have for long time been looking for a good program to document my MySQL databases. I even tried various Wiki's but found it taking to long time as I manually had to enter all data.

Recently I tested two products:
EMS SQL Manager for MySQL
MySQL Workbench SE

My requirements
  • Nice and easy GUI
  • Reverse engineer tables
  • Make virtual relations between fields
  • Relationship notation that can connect to columns
  • Comments on table and columns
  • pdf/html report with comments

Conclusion
I choose MySQL Workbench SE because its GUI were really nice and easy to work with. It can however at times be slow and it for sure needs some more development time to make it the best. Documenting on table/fields was easy and I can also export to various formats. It do lack the virtual relationship which I hope will come in near future - until then I will create real relationships and then simply not committing back to database. Not the optimal solution but it will do for now.

EMS had the virtual relation but the GUI were not easy to work with. If EMS had a better GUI with the options to add layers and more options then perhaps it would have been my preferred app.