Tuesday, March 31, 2009

Why use serialization in .Net development?

I was curious to know why I should be using serialization in my development process and I came across an interesting use for it, I was writing a code development tool and was required to store each project for code generation so it could be retrieved later on. Initially I used a text file then an XML file. But the whole process of having to manage the saving and loading of the project files was tedious(Ok may be not as much as I am making it out to be!).

Then it flashed, why not just serialize the Project object. Wallah!! I reduced my code from a couple of classes to manage the XML iteration, file exceptions etc to a few lines of code.

Wow I was beginning to see the power of serialization....

Saturday, March 28, 2009

Finally my own Data Access Generator tool...

I’ve been struggling over the past few years in search of something that can reduce code development especially the unexciting Data Access Layer code, which is basically a wrapper to conform to a 3-tiered or n-tiered architecture.

I tried a few OR mappers and even gave the Table adapters from the .Net 2.0 Framework a fair shot. But I missed the bare code that I was so accustomed to seeing either due to the fear of performance issues or from hitting the wall down the road. I haven’t explored LINQ to justify my code generation tool and this is no LINQ killer I assure you.

But I did find that a simple code generation tool can achieve a great deal, especially restoring my confidence when it was rolled into production. For one thing the code was always debbugable. So I wrote my own little code generation tool that was based on text templates that you can hack at any time. It does the job and I used it for a couple of enterprise solutions successfully and would like to share the tool.

It’s based on stored procedures fro data access. It automatically generates select, update, insert and delete stored procedures and writes wrapper classes to access these stored procedures. Additionally you can write your custom stored procedures using a naming convention and it will generate the wrapper classes.

You can get a copy from here Click here!

In case anyone is interested in the source code you can email me.