Exception using Reveal.Member
I get the exception "Could not determine type for: System.Linq.Expressions.Expression1[[System.Func
2[[Scala.Map, Scala, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, for columns: NHibernate.Mapping.Column(Member)"
When using Id(x => Reveal.Member("id"));
The reason I do this is because I want to keep the database id hidden in my object.
The code:
I have a Map class:
public class Map
{
/// Database id.
private int id { get; set; }
public virtual double Height
{
get;
set;
}
public virtual double Width
{
get;
set;
}
}
I use the mapping:
public class MapMapping : ClassMap
{
#region Constructors
public MapMapping()
{
Id(x => Reveal.Member<Map>("id"));
NaturalId().Property(x => x.Name);
Map(m => m.Width);
Map(m => m.Height);
HasOne(m => m.GeoMapping).Cascade.All();
}
#endregion Constructors
}
Support Staff 2 Posted by Paul Batum on 17 Jun, 2010 12:44 PM
Don't use a lambda with reveal. See here:
http://wiki.fluentnhibernate.org/Fluent_mapping_private_properties
3 Posted by xabrewulf on 17 Jun, 2010 01:32 PM
Thanks Paul
You solved it!