Exception using Reveal.Member

xabrewulf's Avatar

xabrewulf

17 Jun, 2010 10:24 AM via web

I get the exception "Could not determine type for: System.Linq.Expressions.Expression1[[System.Func2[[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
}
  1. Support Staff 2 Posted by Paul Batum on 17 Jun, 2010 12:44 PM

    Paul Batum's Avatar

    Don't use a lambda with reveal. See here:
    http://wiki.fluentnhibernate.org/Fluent_mapping_private_properties

  2. 3 Posted by xabrewulf on 17 Jun, 2010 01:32 PM

    xabrewulf's Avatar

    Thanks Paul

    You solved it!

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What is the number before twelve?