常用搜索网站,浙江立鹏建设有限公司网站,建设银行怎么招聘网站,关于医院建设网站的请示2#xff09;含有关系的表的情况 含有关系的表指的是像学生这样#xff0c;除了保存学生的基本信息#xff0c;还希望把选课信息保存到学生的类中。这样情况下不能用软件来辅助产生对应的类和XML#xff0c;这是NHibernate中唯一需要费脑筋学的地方。学生表对应的类和XML如…2 含有关系的表的情况 含有关系的表指的是像学生这样除了保存学生的基本信息还希望把选课信息保存到学生的类中。这样情况下不能用软件来辅助产生对应的类和XML这是NHibernate中唯一需要费脑筋学的地方。学生表对应的类和XML如下所示 类文件Student.cs using System; using Iesi.Collections; namespace CodeTest{ public class Student{ public Student(){} private int studentId; private string studentName; private string studentPassword; private string emailAddress; private DateTime dateCreated; private ISet courses new HashedSet(); public int StudentId{ get { return studentId; } set { studentId value; } } public string StudentName{ get { return studentName; } set { studentName value; } } public string StudentPassword{ get { return studentPassword; } set { studentPassword value; } } public string EmailAddress{ get { return emailAddress; } set { emailAddress value; }} public DateTime DateCreated{ get { return dateCreated; } set { dateCreated value; }} public ISet Courses{ get{return courses;} set{coursesvalue;} } } } XML文件Student.hbm.xml ?xml version1.0 encodingutf-8 ? hibernate-mapping xmlnsurn:nhibernate-mapping-2.0 class nameNHibernateTest.Student, NHibernateTest tableStudent id nameStudentId columnStudentId typeInt32 generator classnative / /id property nameStudentName column StudentName typestring length40/ property nameStudentPassword typestring length20/ property nameEmailAddress typeString length40/ property nameDateCreated typeDateTime length8/ set nameCourses tableStudentCourse inversefalse key columnStudentID/ many-to-many columnCourseID class NHibernateTest.Course, NHibernateTest / /set /class /hibernate-mapping