After a few years with our current state, I decide to move the site to
a new direction in terms of a redesign. As a full time .NET developer,
I knew the benefits of moving the site from its current ASP scripted
design to the Microsoft technology. I wanted to take full advantage of
using an object oriented design and powerful language in C#. I’ve
gotten some great experience working on a few projects and I wanted to
utilize the things I’ve learned to make a much better site. My goals
- Improve the speed
- Architect a more robust and easily upgradeable site
- Leverage open source products
First off, a whole redesign of the database was needed. The DB design,
as well as the site, was quickly created due to circumstances with our
previous partner. Because of the decision of our staff to move on
without a site, I had to quickly come up with a whole site design front
to back. Now that we’ve been online for three years with the current
database and I have time to actually sit down and mull over what
features we want in the new version, I felt the need to redesign the
database to be more efficient and offer the flexibility we needed.
After a complete redesign, I also had to write the scripts to migrate
the old data to the new database.
Accessing the database in the old site was usually done using ADO.
Here’s an example:
On a few previous applications I built at my other job, I utilized a
persistence framework instead. A persistence framework moves the
program data in its most natural form (in memory objects) to and from a
permanent data store the database. The persistence framework manages
the database and the mapping between the database and the objects.
There are plenty out there both commercially and through open source.
Because I wanted to leverage open source, I found a few that were on
Sourceforge.net. Of the ones I researched, Gentle.NET
was the one that
I found that provided the features I needed. Most of the other ones I
saw had you make an XML file to map the objects to the database. But
with Gentle, all I needed to do was mark up my object with attributes
and I could save, retrieve, and update data in the database. Normally,
you would create an object, create stored procedures, and functions in
the object to call the stored procedures to do all the functions. I
wanted to get away from stored procedures and the pros and cons of this approach is another long subject to be debated elsewhere
but the persistence framework should take care of it all. With
Gentle.NET, this is all I need to do to get an object to persist in and
out of the database:
Simple, eh? Another great feature of Gentle.NET is
independence from a database platform. So I could take the same objects
and run them on Oracle or MySQL or whatever Gentle supports, which is a
lot. This decouples me from the database and if I decide to change
database sources or move to a hosting company that offers a different
database, I only have to make a few changes to my config files and
references and I’m done.
Page 1 of 4