I Am Studying NHibernate

I have not blogged about programming for a long time. That does not mean that I have not been improving my skills. I frequently come across something new and document it for my notes. For example, I recently discovered that web browsers can unexpectedly do form validation with built-in validation triggered by new HTML5 tag attributes. Since this unexpected behavior caught me by surprise twice, I researched the HTML5 Constraint API for Form Validation and added it to my notes. It is quite puzzling when the browser is doing form validation even though you don’t have any code for form validation!

Over the past few days I have been learning how to use NHibernate. NHibernate is an object-relational mapping (ORM) solution for the Microsoft .NET platform. I have been using SubSonic for object-relational mapping but I think the developers have abandoned that project. NHibernate is more difficult than SubSonic since you have to create your own classes. I did find a program to generate the classes, NHibernate Mapping Generator, but it is not as convenient as SubSonic.

The main advantage to using object-relational mapping is that you can make changes to your database tables without having to rewrite a lot of code. Usually you only need to add a line of code for a new column or change a line of code if you change a column’s data type. You won’t need to revise a lot of SQL strings in your code. A project in development may require many changes to the database schema so this can save a lot of time.

Today I learned how to select all records in a table, how to select records based on multiple criteria, and how to create a traditional SQL query which may be necessary for complicated queries. As with any database API, you have to learn how to do CRUD (Create a record, Read a record, Update a record, and Delete a record). I usually add an example of how to select all records and loop through the result set.

I plan to redesign my web site soon. I need to find new clients because I don’t have any freelance work to do right now. In the meantime, I will continue to make trips around Pennsylvania. There are still a few towns I could visit like Danville, Bloomsburg, and State College. I also want to explore the Poconos some more since there are many resorts there with a variety of recreational activities. I am particularly interested in Stroudsburg and will be doing a thorough investigation of the city and its resources. Today I learned exactly where the Pennsylvania Welcome Center is located in Delaware Water Gap and I clarified the location of the Martz Bus Terminal where you can catch a bus to New York City.

This entry was posted in General, Programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.