My db:
---------------
Currency-Name (PK)
-Value
-.....
---------------
---------------
OldCurrencies-id (PK)
-name (FK)
-value
---------------
Code:
public class Currency
{
public virtual ISet<CurrencyHistorical> Historicals{ get; set; }
public virtual string Name { get; set; }
public virtual string Symbol { get; set; }
.................
Code:
public class CurrencyHistorical
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Value { get; set; }
And the mapping Files.
Code:
<class name="Currency" table="tblWaehrung">
<id name ="Name" column="name">
<generator class="identity" />
</id>
<property name="Value" column="wert" />
...........
<set name="Historicals">
<key column="name" />
<one-to-many class="CurrencyHistorical" />
</set>
</class>
Code:
class name="CurrencyHistorical" table="tblWaehrungHistorisch">
<id name="Id" column="id">
<generator class="identity" />
</id>
<property name="Name" column="name" />
<property name="Value" column="wert" />
<property name="Date" column="kursDatum" />
</class>
And now my problem. in my code i Load a currency with
cur = session.Get<Currency>('EUR');.
works fine so far.
Then i want to access the ISet by
cur.Hisorical.Count.
Now Count is always 0, but when i do the query directly on my db i get some rows.
why doesn't my ISet get filled?