On Wed, 10 Mar 2010 10:47:05 +0100, Marc Climent <m.clim...@adapting.com> wrote:

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; }
}

Seems like a regular many-to-one relation, only with an IDictionary instead of an ISet or IList in the many-end. I'd implement this as such:

protected virtual IDictionary<string, string> TitleDictionary { get; set; }

public virtual string Title
{
  get { return TitleDictionary["en-GB"]; }
}

where "en-GB" of course needs to be dynamically looked up somewhere, but I hope you get the idea. Notice how the dictionary is protected and the string public. That way you can hide away the gritty details of the dictionary lookup within the bowels of your class and not expose it to the world.

The way to map the dictioanry is with the .AsMap() method. Take a look here for more details:

http://stackoverflow.com/questions/1335859/fluent-nhibernate-mapping

--
Asbjørn Ulsberg         -=|=-          asbj...@ulsberg.no
«He's a loathsome offensive brute, yet I can't look away»

--
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