0

I'm trying ignore a entity property but I cannot do it. Looking for some how to do this, I found some examples but still can't do. How could I do this ?

trying

public class Caixa {

        public virtual long id                      { set; get; }
        public virtual DateTime dtOcorrencia        { set; get; }
        public virtual String historico             { set; get; }
        public virtual int tipoOcorrencia           { set; get; } //1 entrada, 2 saida
        public virtual decimal valorOcorrencia      { set; get; }
        public virtual FormaPagamento formaPagto    { set; get; }

        //should be ignored 
        public IList<Caixa> report = new List<Caixa>();

        public Caixa () {
        }

        public IList<Caixa> getReport() {
            return report;
        }

    }

Map

public class CaixaMap : ClassMap<Caixa> {
        public CaixaMap() {
            Table("CAIXA");
            Id(c => c.id).GeneratedBy.Native();
            Map(c => c.dtOcorrencia).CustomType<DateTime>();
            Map(c => c.historico);
            Map(c => c.tipoOcorrencia).CustomType<int>();
            Map(c => c.valorOcorrencia).CustomType<decimal>().Precision(15).Scale(2);            
            Map(c => c.formaPagto).CustomType<GenericEnumMapper<FormaPagamento>>();
            Map(c => c.report); //ignore it

        }
    }
FernandoPaiva
  • 4,410
  • 13
  • 59
  • 118
  • I think you want map.IgnoreProperty()...I found the answer here http://stackoverflow.com/questions/907576/how-to-tell-fluent-nhibernate-not-to-map-a-class-property by user owen... – BillRuhl Sep 20 '16 at 19:01
  • @BillRuhl yep, I saw it, but I don't know where I can do it. – FernandoPaiva Sep 20 '16 at 19:06
  • I'm following this link: https://github.com/jagregory/fluent-nhibernate/wiki/Auto-mapping#ignoring-properties but its not clear to me how to make it. – FernandoPaiva Sep 20 '16 at 19:10
  • 3
    @FernandoPaiva - you do not need to use it. IgnoreProperty is only used for auto mapping - and you are manually mapping yours. Simply don't map it. – Chris Rogers Aug 23 '17 at 05:06

0 Answers0