On Tuesday, September 20, 2016 at 6:22:55 PM UTC-4, Fernando Paiva wrote:
> I'm trying ignore a property of a entity. I found a lot of examples but still 
> can't make this. How could do this ?

Also, be aware that a proxy class is generated. Not sure what effect a field 
will have on things. It may need to be a public virtual property; minimum 
virtual protected internal.

> trying.
> 
> Entity
> 
> 
> 
> 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; }
> 
>         //must ignore
>         public IList<Caixa> report = new List<Caixa>();
>         
>         public Caixa () {
>         }
> 
>         public IList<Caixa> getReport() {
>             return report;
>         }
>     }
> 
> The Mapping
> 
> 
> 
> 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           
>         }
>     }
> Mapping 
> 
> 
> 
> FluentConfiguration _config = 
> Fluently.Configure().Database(MySQLConfiguration.Standard.ConnectionString(
>                                                                         x => 
> x.Server(HOST).
>                                                                           
> Username(USER).
>                                                                           
> Password(PASSWORD).
>                                                                           
> Database(DB)
>                                                                         ))
>                                                                         
> .Mappings(m => m.FluentMappings.AddFromAssemblyOf<CaixaMap>())
>                                                                         
> .ExposeConfiguration(cfg => new SchemaUpdate(cfg).Execute(false, true));
> 
>             session = _config.BuildSessionFactory();
>             return session;

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to