流利的NHibernate Reveal不使用给定的属性名称

Lor*_*ron 2 c# nhibernate fluent-nhibernate fluent-nhibernate-mapping

我正在尝试在班级中映射以下受保护的集合:

public class AddressList
{
    protected readonly IList<Address> addresses = new List<Address>();
}
Run Code Online (Sandbox Code Playgroud)

使用以下映射:

HasMany<Address>(list => Reveal.Member<AddressList>("addresses"));
Run Code Online (Sandbox Code Playgroud)

但是我一直在获取NHibernate.MappingException

NHibernate.MappingException : Could not compile the mapping document: 
(XmlDocument) > NHibernate.PropertyNotFoundException 
: Could not find a getter for property '**Member**' in class
Run Code Online (Sandbox Code Playgroud)

但是,正如您在Reveal.Member中看到的那样,我要指出它应查找的属性名称应该是“地址”

我发现了这个问题,用户似乎和我有同样的问题,只是一个老问题

我也尝试过这里给出的解决方案

jga*_*fin 5

您不应该将lambda与 Reveal

如您在异常消息中看到的:

NHibernate.MappingException:无法编译映射文档:(XmlDocument)> NHibernate.PropertyNotFoundException:无法在类中为属性“ Member ” 找到吸气剂

我尝试映射到Member您使用的命名字段,list => Reveal.Member而不只是Reveal.Member