What is the best way to handle this I have an application where I constantly have to "pivot" 12 month records into one year record/object to be able to display a single year per row in a DataGrid. I have been doing this work up until this point in DataSets with some ugly T-SQL to get the pivot to happen.
I'm upgrading this application to NHibernate now and this is the one trouble-spot I have.
As an example, lets say I have a test that I give a group of students once a month. My DDL might look like:
CREATE TABLE [Score](
[ScoreId] [int] IDENTITY(1,1) NOT NULL,
[StudentId] [int] NOT NULL,
[Year] [int] NOT NULL, -- 4 digit year as an int
[Month] [int] NOT NULL, -- 1 through 12 month value as int
[TestScore] [int] NOT NULL
)
I'd like to display in a DataGrid (one record per student/year) these fields:
Student Name, Year, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
What is the normal way to approach this kind of task with NHibernate? How would you handle it?