I am new to NHibernate and I am having a hard time trying to map a dictionary.
The database I am working with is designed to handle localization, so you can have translated names for some entities.
Example for "Products":
---
Products
- productId (PK)
- dateOfCreation
ProductLocales
- productLocaleId (PK)
- productName
- productId (FK)
- cultureId (FK)
Cultures
- cultureId (PK)
- cultureName
---
Basically what I would like to have is a Dictionary in the Product object, like this:
public IDictionary<string, ProductLocale> Locales
{
...
}
Where:
* the KEY would be "cultureName" from the Cultures table and
* the VALUE would be the ProductLocale object with that Culture
So I could access:
myProduc.Locales["en-US"].productName
myProduc.Locales["fr-FR"].productName
And have the localized name of the product.
So, is this mapping possible? Please say yes :)
If yes, could anyone point me an example?
Thanks in advance!
|