I' m writing desktop Project in C#. I'm using Nhibernate to communicate with database. Moreover I use FluentNhibernate into mapping of models but I'm stuck in some part of mapping. Here is My mapping Class in ProductMap
Loosing Map
public LosingMap()
{
Id(x => x.id);
Map(x => x.reason);
Map(x => x.quantity);
Map(x => x.lose_sum);
Map(x => x.rate);
Map(x => x.deleted);
Map(x => x.create_date);
Map(x => x.update_date);
References(x => x.currency).Column("CurrencyCode");
Table("Loosing");
}
}
here is CurrencyMap
CurrencyMap
public CurrencyMap()
{
Id(x => x.id);
Map(x => x.code).UniqueKey("currency_code");
Map(x => x.name);
Map(x => x.shname);
Map(x => x.symbol);
Map(x => x.deleted);
HasMany(x => x.Losings).Cascade.All();
Table("currency");
}
}
here is I have in my currency table one primary key and one unique key how I can refer in my LoosingMap class my unique instead of primary key ???