-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Question about Dictionary map
PostPosted: Sun Apr 22, 2007 11:01 am 
Newbie

Joined: Fri Apr 20, 2007 5:10 pm
Posts: 2
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.