I am new in NHibernate and need help. I have two classes:
class Pop3 { public virtual long Id { set; get; } public virtual string HostName { set; get; } public virtual int Port { set; get; } public virtual bool UseSsl { set; get; } } class Email { public virtual long Id { set; get; } public virtual string UserName { set; get; } public virtual string Password { set; get; } public virtual Pop3 Host { set; get; } } I need to map them to NHibernate (uses Sqlite). That is easy with Pop3 class
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="TestAsm" namespace="TestAsm.Entity.Mail"> <class name="Pop3" table="pop3hosts"> <id name="Id"> <generator class="identity" /> </id> <property name="HostName" /> <property name="Port" /> <property name="UseSsl" /> </class> </hibernate-mapping> But how can I map Email class contains Pop3 class as property? My be i need to set Pop3.Id in Host property? But I think it is wrong way.