Introduction to Object Relational Mapping
Brief overview
Google: object relational mapping overview
From the wiki:
a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages
Chosen Tools
- ASP.NET MVC
- SQL Server Express
- NHibernate (Fluent Mapping and Linq)
- The June data dump of the StackOverflow database
Getting the bits
Google: fluent nhibernate download
- Download the latest version to your desktop (unblock the zip)
- Extract the entire zip to C:\temp\NHCourse\dependencies\nhibernate
Google: nhibernate linq download
- Download the nhibernate.linq zip (unblock)
- Extract all to C:\temp\NHCourse\dependencies\nhibernate
Google: stackoverflow data dump
- Follow the cc-wiki-dump link to read about it and find out how to get it
- You should already have it as C:\temp\NHCourse\NHCourse.Mvc\App_Data\StackOverflow.mdf
- Data was imported from the data dump using SODDI
The Application
Open the solution C:\temp\NHCourse\IntroToORM.sln and Press Ctrl+F5 (not F5)
- Plain and simple user admin
- Everything you see is dummy data used to create the screens
- Task at hand is to replace the dummy data with live data from the SO database
Course Plan
- 8:00 - 9:00 - Brief overview and Getting the bits
- 9:00 - 9:10 - Break
- 9:10 - 10:00 - Convert the home and edit page to read/save live data
- 10:00 - 10:10 - Break
- 10:10 - 11:00
- Setup logging so we can see the sql that nhibernate generates
- Map the Posts table and show post count in home page grid (not all columns)
- Map the Votes table and show total upvotes and downvotes on main grid (not all columns)
- 11:00 - 11:10 - Break
- 11:10 - 12:00
- Hard coded lookup tables: on Post, Map the post type column as a component
- Q&A