I want to add localization support to my domain object. I have the following:
class Person
{
int Id;
City city;
}
class City
{
int Id;
string Name;
}
All cities are saved in the db lookup table Cities. I would like to:
Person p = PeopleService.GetPersonById(1);
//Assert p.City.Name == 'London' if culture == 'en-us'
I don't like to do
string City::Name { get { return ILocalizationProvider.Get(typeof(City), Id); }
I came to this article:
http://ayende.com/Blog/archive/2006/12/26/LocalizingNHibernateContextualParameters.aspx
But I do not know if it is supported in NH 2.1 or not.
How can I teach NH to cache all cities in a second level cache to avoid merging each time for the same language?
Is there a simple and neat way to handle database lookup and localization tables in NHibernate?
Shadi source
share