It’s deep in the winter, so it’s time for what? Exactly: Hibernation! The (n)hibernate framework offers you persistence of existing (.NET) objects to/from a DB (various DBMS supported, among them Oracle, MSSQL, DB2, SQLLite etc.). This way you can realize all the CRUD operations using .NET objects while the framework will generate the necessary underlying SQL statements. On top of that, it can also perform sorting, range-based retrieval and much more for you. And in the end, you will end up with a transparent mapping of one or more DBs into your own (reusable) framework.
Why is that cool?
- Easier maintenance (DB changes will be reflected in the nhibernate mappings, hence in the underlying objects, not on higher levels)
- Mapping multiple DBs into one codebase
- Avoidance of DB-dependent constructs, such as packages, procedures
- Possibility to improve speed through caching the objects
The following (announced) article series will get you started with your first nhibernate mapping steps. It is intended for an audience, who is already somewhat confident in using databases and C# (or at least, any .NET programming language). However, some experience in C#, XML and concepts of DBs is required. Here comes a list with the topics covered in the article series:
- Part 1: Preparing the stage
- Part 2: Mapping your first table
- Part 3: Query types
- Part 4: Mapping relationships
More points to be announced!