我正在使用FluentHibernate和Automapping。我的课程是一对多关系不能在NHibernate中工作
public class Student
{
public Student()
{
Books = new List<Book>();
}
public virtual int Id{get;private set;}
public virtual string Name{get;set;}
public virtual IList<Book> Books { get; private set; }
}
public class Book
{
public Book(){}
public virtual int Id{get;private set;}
public virtual string Name{get;set;}
}
Now, I create book objects and to a student object, and call save.
Book b = new Book();
b.Name = "test"
Book b1 = new Book();
b2.Name = "test1"
Student student = new Student();
student.Books.Add(b);
student.Books.Add(b1);
session.saveorupdate(student);
只有学生不是书本。我究竟做错了什么?
是的,你是对的。这就是我最终所做的。 – ruskin 2011-05-28 07:24:39
我加了这个,没有更新运行。它只插入没有参考的孩子,并且从不更新。 – BradLaney 2012-10-31 07:24:23
请创建一个新问题,在那里帮助你会更容易。 – Lester 2012-10-31 13:38:37