7
tengo un problema con Fluido Nhibernate: el error es "No se pudo resolver la propiedad mailheader de mailheader claseFluido Nhibernate: no se pudo resolver la propiedad
El problema está relacionado con las colecciones dentro de la entidad. 'Mailheader', si quito las colecciones excepción desaparecer, pero yo quiero estas colecciones de Gracias de antemano
las entidades involucradas son:!.
public class MailHeader : Entity
{
public MailHeader()
{
MailRecipientUsers = new List<MailRecipientUser>();
MailsDeleted = new List<MailDeleted>();
}
[Required]
public virtual string Subject { get; set; }
public virtual IList<MailRecipientUser> MailRecipientUsers { get; protected set; }
public virtual IList<MailDeleted> MailsDeleted { get; protected set; }
}
public class Mail : Entity
{
public Mail()
{
Creation = DateTime.Now;
MailHeader = new MailHeader();
}
[Required]
public virtual string BodyText { get; set; }
[Required]
public virtual MailHeader MailHeader { get; set; }
public virtual Mail Parent { get; set; }
[Required]
public virtual User From { get; set; }
public virtual Mail Child { get; set; }
[DataType(DataType.Date)]
public virtual DateTime Creation { get; set; }
//[Required]
//public virtual MailType MailType { get; set; }
}
public class MailRecipientUser : Entity
{
[Required, DomainSignature]
public virtual MailHeader MailHeader { get; set; }
[Required, DomainSignature]
public virtual User User { get; set; }
}
public class MailDeleted : Entity
{
public MailDeleted()
{
}
[DomainSignature,Required]
public virtual MailHeader MailHeader { get; set; }
[DomainSignature, Required]
public virtual User User { get; set; }
}
el mapeo:
public class MailHeaderMap : IAutoMappingOverride<MailHeader>
{
public void Override(AutoMap<MailHeader> mapping)
{
mapping.HasMany(x => x.MailRecipientUsers)
.Inverse()
.Cascade.AllDeleteOrphan();
mapping.HasMany(x => x.MailsDeleted)
.Inverse()
.Cascade.AllDeleteOrphan();
}
}
public class MailMap : IAutoMappingOverride<Mail>
{
public void Override(AutoMap<Mail> mapping)
{
mapping.References(x => x.From);
mapping.References(x => x.Parent);
mapping.References(x => x.MailHeader);
mapping.HasOne(e => e.Child)
.WithForeignKey()
.PropertyRef(a => a.Parent)
.Cascade.All();
}
}
public class MailRecipientUserMap : IAutoMappingOverride<MailRecipientUser>
{
public void Override(AutoMap<MailRecipientUser> mapping)
{
mapping.References(x => x.MailHeader);
mapping.References(x => x.User);
}
}
public class MailDeletedMap : IAutoMappingOverride<MailDeleted>
{
public void Override(AutoMap<MailDeleted> mapping)
{
mapping.References(x => x.MailHeader);
mapping.References(x => x.User);
}
}
Intenta cambiar 'public virtual MailHeader MailHeader {get; conjunto; } 'to' public Virtual MailHeader Header {get; conjunto; } 'y actualice sus referencias para ver si este error desaparece. –