tags:

views:

218

answers:

0

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 a lookup db table "Cities". I would like to have: Person p = PeopleService.GetPersonById(1); //Assert p.City.Name == 'London' if culture == 'en-us'

I dont like doing string City::Name { get { return ILocalizationProvider.Get(typeof(City), Id); }

I came by this article: http://ayende.com/Blog/archive/2006/12/26/LocalizingNHibernateContextualParameters.aspx

Yet i dont know whether its supported in NH 2.1 or not.

How can i instruct NH to cache all cities in 2nd-level cache to avoid joins each time for the same locale?

Is there an easy and neat way to treat database lookup tables and localization in NHibernate ?