我有一個模型,像這樣的列表(簡體)功能NHibernate - 地圖串
public class Post
{
public string ID { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public string AuthorName { get; set; }
public List<string> Attachments { get; set; }
}
在我的數據庫,我有一個帖子表,以及附着後表
柱連接表中有2列:
帖子ID AttachmentKey
(這樣做的基礎是該附件被上傳到Amazon S3,所以AttachmentKey是S3鍵)
我想要做的就是映射AttachmentKey到返回/插入Post對象的名單...
我怎麼會去這樣做呢?
這不是正確的答案。請參閱下面的答案。 HasMany(x => x.Attachments) .KeyColumn(「PostID」) 。表(「PostAttachment」)。Element(「AttachmentKey」); – regisbsb 2013-10-25 14:22:55