我正在尝试在我的类中映射以下 protected 集合:
public class AddressList
{
protected readonly IList<Address> addresses = new List<Address>();
}
具有以下映射:
HasMany<Address>(list => Reveal.Member<AddressList>("addresses"));
但我不断收到 NHibernate.MappingException
NHibernate.MappingException : Could not compile the mapping document:
(XmlDocument) > NHibernate.PropertyNotFoundException
: Could not find a getter for property '**Member**' in class
但是正如您在 Reveal.Member 中看到的那样,我声明它应该查找的属性名称应该是“地址”
我找到了this问题,用户似乎和我有同样的问题,只是这是一个老问题
我也尝试过给出的解决方案 here
最佳答案
您不应将 lambda 表达式与 Reveal
一起使用
正如您在异常消息中看到的:
NHibernate.MappingException : Could not compile the mapping document: (XmlDocument) > NHibernate.PropertyNotFoundException : Could not find a getter for property 'Member' in class
我尝试映射到名为 Member
的字段当您使用list => Reveal.Member
时而不仅仅是Reveal.Member
关于c# - Fluent NHibernate Reveal 不使用给定的属性名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14400368/