nhibernate - Component referencing an Entity. not being loaded -
i have following mapping, issue emailtemplate not being loaded eagerly , being set null when retreiving user. can guide me or perhaps refer me material. spent long hours searching , nothing yeilded.
usermap
public usermap() { id(x => x.id); component(x => x.state, y => { y.map(x => x.name); y.map(x => x.surname); y.references(x => x.emailtemplate).not.lazyload(); }); }
edit: emailtemplate
public class emailtemplate:entity { public virtual string subject { get; set; } public virtual string body { get; set; } public virtual icollection<user> users { get; set; } }
emailtemplatemap
public emailtemplatemap() { id(x => x.id); map(x => x.subject); map(x => x.body); hasmany(x => x.users).inverse(); }
state
public class state : valueobject<state> { public virtual string state { get; set; } public virtual emailtemplate emailtemplate { get; set; } }
user
public class user:entity { public virtual string name { get; set; } public virtual string surname { get; set; } public virtual state state { get; protected set; } }
Comments
Post a Comment