I'm trying to figure out how to implement localization of some fields
using tables (right now I'm using a Custom Type and works well until I
need sorting, which is quite slow if there are many rows).

I have found a lot of articles but most of them deal with only one
localizable property, which is not my case. I'm sure there must be a
solution, maybe I'm not on the right track.

I have a class like this, for example:

class Document {
    public virtual Guid Id { get; set; }
    public virtual string Code { get; set; }
    public virtual LocalizableString Title { get; set; }
    public virtual LocalizableString Description { get; set; }

}

LocalizableString is not really a string, but hides a dictionary with
the several translations available for that specific property. This
LocalizableString is not as well a Dictionary, but it could be and I
could add a couple of methods to simplify the use of the
localizations.

The thing is how to relate these properties with the table that
contains the translation for each field and how to map that using
FluentNH.

For example, with two tables, where Title_Id and Description_Id are
related with Resource_Id:
[Documents] - [Id] [Code] [Title_Id] [Description_Id]
[Localizations] - [Resource_Id] [LCID] [Value]

Or maybe three tables, where the relationship between the entity/
property is done through the Entity_Id and the Entity_Field (¿dynamic
components?):
[Documents] - [Id] [Code]
[Dictionaries] - [Dict_Id] [Entity_Id] [Entity_Field]
[Localizations] - [Dict_Id] [LCID] [Value]

I don't really know how to map this, any clue is welcome, maybe the
whole approach is too complex.

These are the articles I've found on the subject:
http://www.siimviikman.com/2010/02/24/mapping-translations-in-nhibernate/
http://www.webdevbros.net/2009/06/24/create-a-multi-languaged-domain-model-with-nhibernate-and-c/
http://www.codewrecks.com/blog/index.php/2007/05/23/localize-entity-with-nhibernate-part-3/comment-page-1/

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to