This might help:
http://www.nhforge.org/doc/nh/en/index.html#manipulatingdata-graphs
(essentially set cascade to "save-update" or explicitly save the new
cont object)
rbbauerle wrote:
I have a problem with a HasAndBelongsToMany relationship. It loads a
realtion, but it does not save a new one. Th information is being
added to the list.
This is part of my code:
I load the relaton with: content.Contents
And I try to save a new one with:
content.Contents.Add(cont);
content.Update();
public class Content:ActiveRecordValidationBase<Content>
{
...
[PrimaryKey(PrimaryKeyType.Identity)]
public virtual int Id {
get { return id; }
set { id = value; }
}
...
[HasAndBelongsToMany(typeof(Content), Table = "related_contents",
ColumnKey = "content_id", ColumnRef = "related_content_id", Lazy =
true)]
public IList<Content> Contents {
get { return contents; }
set { contents = value; }
}
...
}
Thanks a lot!
--
You received this message because you are subscribed to the Google Groups "Castle
Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.