我在 NHibernate 2.1 中为以下基于属性的映射搜索等效的 Fluent 映射
[Class(typeof(Article), Table = "ARTIKEL")]
public class Article {
[Id(0, Name = "Id", Column = "Id")]
public virtual int Id { get; set; }
[Map(0)]
[Key(1, Column = "MainArticle")]
[IndexManyToMany(2, ClassType = typeof(Article), Column = "ChildArticle")]
[Element(3, Column = "Amount", NotNull = true)]
public virtual IDictionary<Article, decimal> Bundle { get; set; }
}
我无法获得适用于 NHibernate 3.0 的流畅映射。
我结束了
HasManyToMany<Article>().ParentKeyColumn("MainArticle").ChildKyColumn("ChildArticle").AsMap<int>("Amount");
这会在访问字典时导致“非法访问加载集合”异常...