Error dehydrating Property value for Entities.Mesa.Mesastatus

Asked

Viewed 13 times

0

I mapped the classes Mesa and Mesastatus with Fluent Nhibernate, according to the code below:

CLASS

 public class Mesa   
 {
    public virtual int MesaId { get; set; }
    public virtual int Numero { get; set; }
    public virtual int MesaStatusId { get; set; }
    public virtual decimal SubTotal { get; set; }
    public virtual decimal PorcentagemGorgeta { get; set; }
    public virtual decimal TotalGorgeta { get; set; }
    public virtual decimal Total { get; set; }
    public virtual MesaStatus MesaStatus { get; set; }
}
public class MesaStatus
{
    public virtual int MesaStatusId { get; set; }
    public virtual string Descricao { get; set; }
}

MAPPING

public class MesaMap : ClassMap<Mesa>
{
    public MesaMap()
    {
        Id(p => p.MesaId);
        Map(p => p.Numero).Not.Nullable();
        Map(p => p.MesaStatusId).Not.Nullable();
        Map(p => p.SubTotal).Not.Nullable();
        Map(p => p.PorcentagemGorgeta).Not.Nullable();
        Map(p => p.TotalGorgeta).Not.Nullable();
        Map(p => p.Total).Not.Nullable();

        References(x => x.MesaStatus).PropertyRef("MesaStatusId").ForeignKey("FK_Mesa_MesaStatus");
        Table("Mesa");
    }
}
public class MesaStatusMap : ClassMap<MesaStatus>  
{
        public MesaStatusMap()
        {
            Id(p => p.MesaStatusId);
            Map(p => p.Descricao).Length(40).Not.Nullable();
            Table("MesaStatus");
        }
}

When I try to insert the table class, I get the error "Error dehydrating Property value for Entities.Mesa.Mesastatus". How to Correctly Map Classes, to Be Able to Insert into the Database?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.