我正在使用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