6

我正在获取映射私有属性的异常。情况是这样:我在 Entity.cs 中有这个:privat int m_Inactive;

在 EntityMap.cs 我有:

Map(x => Reveal.Property<Entity>("m_Inactive")).ColumnName.("INACTIVE"); 

但我得到这个错误:

System.Reflection.TargetInvocationException: Exception has been thrown 
by 
the target of an invocation. --->  System.ArgumentException: Not a member access 

可能是什么原因?

谢谢。

4

2 回答 2

14

如果您按照wiki 上的示例进行操作,您会发现您应该使用Map(Reveal.Member<YourEntity>("m_Inactive")).

于 2009-06-30T11:10:38.680 回答
2

看起来在最新版本中您应该使用 Reveal.Member 因为 Reveal.Property 已过时:

Map(Reveal.Member<YourEntity>("m_Inactive"))

哦,有点“废话”,但您需要确保包含 FluentNHibernate:

using FluentNHibernate;

还有另一个“duh”,但这将适用于受保护的成员以及private

于 2011-07-21T19:49:42.497 回答