Hello
 
We are looking to change the translation mapping and we have though that we 
can optimize it by referencing directly the translation table. The 
Translation table would have a composite key:
 
CompositeId()
 .KeyReference(x => x.Text)
 .KeyProperty(x => x.LanguageCode);

But we would like to reference the Translation entry directly on the other 
entities, we have the Text id on the entity but we need to add the 
LanguageCode in some way in the mapping, can it be done? For example with a 
LanguageCode property on the entity or with a filter in the session?
 
References(x => x.TextTranslation)
 .ForeignKey("Text_Id")
 .PropertyRef("LangaugeCode")
 .Not.Insert()
 .Not.Update();

What we would like at the end is to access the translation directly on the 
entity, something like:
 
myEntity.TextTranslation.Translation

And have only one join in the database with only one record as result. We 
would like to avoid to join the Text table with the Translation table and 
in case of a fetch get every entity multiplied x-times for each language.
 
select ... from myEntity join Text join Translation ...

Is there a way to map a composite key to an entity with only one part of 
the composite id in the database and the other part as a parameter?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to