How do i map this in NHibernate

Posted by Andrew Smith on Stack Overflow See other posts from Stack Overflow or by Andrew Smith
Published on 2009-03-30T18:33:10Z Indexed on 2010/12/25 22:54 UTC
Read the original article Hit count: 182

I Have two classes, Survey and Poll classes. Also I have Question and Question Choice classes. How do I map these so I come out with particular table formats. here is the classes involved.

public class Survey
{
     public IList<Question> Questions { get; private set; }   
}

public class Poll
{
    public Question Question { get; set; }
}

public class Question
{
    public string Text { get; set; }
    public IList<QuestionChocie> Choices { get; private set; }
}

public class QuestionChoice
{
    public string Text { get; set; }
}

The resulting tables that I'm shooting for include the following

Surveys- a table of survey information.
Polls - a table of polls information.
SurveyQuestions -a table of survey questions.
PollQuestions - a table of poll questions.
SurveyChoices - a table of the question choices for the surveys.
PollChoices - a table of the question choices for the survey.

preferably i really want to know for fluent nhibernate, or just mapping xml is fine too.

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about fluent-nhibernate