<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Multilingual data and NHibernate</title> <atom:link href="http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/feed/" rel="self" type="application/rss+xml" /><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/</link> <description>inquisitive: adjective. given to inquiry, research, or asking questions; eager for knowledge; intellectually curious</description> <lastBuildDate>Wed, 16 May 2012 15:43:00 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Egor Pavlikhin</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-99135</link> <dc:creator>Egor Pavlikhin</dc:creator> <pubDate>Thu, 28 Apr 2011 12:07:00 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-99135</guid> <description>Great solution! Your approach is something I used to do in the past. However, it&#039;s not particular friendly if you don&#039;t know beforehand which culture is going to be required. I&#039;ve written a different solution which automatically deals with mappings, is attachable to pretty much any entity and creates rows for new cultures when appropriate: http://httputility.com/articles/internationalization-with-nhibernate-best-practice.html</description> <content:encoded><![CDATA[<p>Great solution! Your approach is something I used to do in the past. However, it&#8217;s not particular friendly if you don&#8217;t know beforehand which culture is going to be required. I&#8217;ve written a different solution which automatically deals with mappings, is attachable to pretty much any entity and creates rows for new cultures when appropriate: <a
href="http://httputility.com/articles/internationalization-with-nhibernate-best-practice.html" rel="nofollow">http://httputility.com/articles/internationalization-with-nhibernate-best-practice.html</a></p> ]]></content:encoded> </item> <item><title>By: Tambet Matiisen</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-23308</link> <dc:creator>Tambet Matiisen</dc:creator> <pubDate>Wed, 23 Dec 2009 18:18:03 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-23308</guid> <description>I would rename these tables to Phrases and Translations. This makes many-to-one relationship between domain table ja Phrases table natural - Product Name is a Phrase and a Phrase can have many Translations.But if you don&#039;t share the translations for domain objects, then Phrases table becomes useless. It&#039;s only there because of NHibernate. For example deleting your domain object wouldn&#039;t cascade delete it&#039;s translations. (Or it does in NHibernate? It certainly doesn&#039;t at database level.)</description> <content:encoded><![CDATA[<p>I would rename these tables to Phrases and Translations. This makes many-to-one relationship between domain table ja Phrases table natural &#8211; Product Name is a Phrase and a Phrase can have many Translations.</p><p>But if you don&#8217;t share the translations for domain objects, then Phrases table becomes useless. It&#8217;s only there because of NHibernate. For example deleting your domain object wouldn&#8217;t cascade delete it&#8217;s translations. (Or it does in NHibernate? It certainly doesn&#8217;t at database level.)</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-23210</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Mon, 14 Dec 2009 11:12:20 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-23210</guid> <description>@Geertit&#039;s a trade-off obviously, if you have a lot of translatable entities and a high number of concurrent edits then yeah, a single table probably won&#039;t be the best option... a translation table per entity would avoid that problem but introduces more work.  But if it&#039;s necessary, then that is probably the better way to go in your scenario</description> <content:encoded><![CDATA[<p>@Geert</p><p>it&#8217;s a trade-off obviously, if you have a lot of translatable entities and a high number of concurrent edits then yeah, a single table probably won&#8217;t be the best option&#8230; a translation table per entity would avoid that problem but introduces more work.  But if it&#8217;s necessary, then that is probably the better way to go in your scenario</p> ]]></content:encoded> </item> <item><title>By: Geert V</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-23209</link> <dc:creator>Geert V</dc:creator> <pubDate>Mon, 14 Dec 2009 10:51:18 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-23209</guid> <description>Hi Davy,My current project uses NHibernate and since it is my first big project, I run against a lot of questions including the multilanguage aspect.
I started with an approach similar to yours but after sitting together with a DB guy, he informed me that the single translation table might be a bad idea for scalability. Because all updates/inserts of new items that have translations lock that single table.Currently I&#039;m using a translation table per entity to avoid this.
What is your idea on performance?Greets,Geert</description> <content:encoded><![CDATA[<p>Hi Davy,</p><p>My current project uses NHibernate and since it is my first big project, I run against a lot of questions including the multilanguage aspect.<br
/> I started with an approach similar to yours but after sitting together with a DB guy, he informed me that the single translation table might be a bad idea for scalability. Because all updates/inserts of new items that have translations lock that single table.</p><p>Currently I&#8217;m using a translation table per entity to avoid this.<br
/> What is your idea on performance?</p><p>Greets,</p><p>Geert</p> ]]></content:encoded> </item> <item><title>By: Border Crossing Stats &#187; Multilingual data and NHibernate Davy Brion&#8217;s Blog</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-27</link> <dc:creator>Border Crossing Stats &#187; Multilingual data and NHibernate Davy Brion&#8217;s Blog</dc:creator> <pubDate>Tue, 11 Mar 2008 08:08:40 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-27</guid> <description>[...] Find more about it all here [...]</description> <content:encoded><![CDATA[<p>[...] Find more about it all here [...]</p> ]]></content:encoded> </item> <item><title>By: Peter</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-31</link> <dc:creator>Peter</dc:creator> <pubDate>Sat, 02 Feb 2008 06:05:17 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-31</guid> <description>Thought you might be interested in this approach by way of comparison: http://www.nablasoft.com/Alkampfer/?p=41I think the best that can be achieved using NHibernate is somewhere in the middle.  A single EntityText table, with an EntityResource mapping table from the Entity tables.  I don&#039;t see a way around having to delegate to the resource bag from the property accessors.</description> <content:encoded><![CDATA[<p>Thought you might be interested in this approach by way of comparison: <a
href="http://www.nablasoft.com/Alkampfer/?p=41" rel="nofollow">http://www.nablasoft.com/Alkampfer/?p=41</a></p><p>I think the best that can be achieved using NHibernate is somewhere in the middle.  A single EntityText table, with an EntityResource mapping table from the Entity tables.  I don&#8217;t see a way around having to delegate to the resource bag from the property accessors.</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-30</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Thu, 31 Jan 2008 07:36:58 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-30</guid> <description>You could use NHibernate&#039;s Criteria API for that... i don&#039;t have the above solution with me so i can&#039;t experiment with it, but you can definitely do what you said in an efficient way using Criterias.  Or you could use HQL... I&#039;d basically try a few different ways, see what SQL gets generated every time and then i&#039;d pick the most efficient one.</description> <content:encoded><![CDATA[<p>You could use NHibernate&#8217;s Criteria API for that&#8230; i don&#8217;t have the above solution with me so i can&#8217;t experiment with it, but you can definitely do what you said in an efficient way using Criterias.  Or you could use HQL&#8230; I&#8217;d basically try a few different ways, see what SQL gets generated every time and then i&#8217;d pick the most efficient one.</p> ]]></content:encoded> </item> <item><title>By: Duc H Tran</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-29</link> <dc:creator>Duc H Tran</dc:creator> <pubDate>Wed, 30 Jan 2008 15:04:16 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-29</guid> <description>Nice approach, but how about searching on individual localized property? Said, for example, we have Product class with Name and Description localized, any idea of an efficient way when we wanted to search for products that have a specified term in Name or Description (but not both).</description> <content:encoded><![CDATA[<p>Nice approach, but how about searching on individual localized property? Said, for example, we have Product class with Name and Description localized, any idea of an efficient way when we wanted to search for products that have a specified term in Name or Description (but not both).</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-28</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Mon, 28 Jan 2008 09:47:17 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-28</guid> <description>I haven&#039;t used this approach in production, but it is based on some multi-lingual requirements at a previous client. On each screen where multilingual strings could be edited, they wanted to be able to edit each translation at the same time. So that&#039;s the justification for loading all the translations into the domain object. In my POC the Translation class&#039; ToString() method was overridden to display the translation for the user&#039;s current locale though to make it easy to work with for display purposes.I also tried to get it working without a mapping table but could not find a solution that worked... the mapping table just made it really easy to use standard nhibernate approaches, and from a data integrity point of view, i think it&#039;s probably the most &#039;correct&#039; approach.Looking back on my post now, i would rename my original &#039;Translation&#039; class to MultiLingualString and have it hold a collection of Translation objects (which would be the &#039;TranslationValue&#039; instances as they are called in the post).</description> <content:encoded><![CDATA[<p>I haven&#8217;t used this approach in production, but it is based on some multi-lingual requirements at a previous client. On each screen where multilingual strings could be edited, they wanted to be able to edit each translation at the same time. So that&#8217;s the justification for loading all the translations into the domain object. In my POC the Translation class&#8217; ToString() method was overridden to display the translation for the user&#8217;s current locale though to make it easy to work with for display purposes.</p><p>I also tried to get it working without a mapping table but could not find a solution that worked&#8230; the mapping table just made it really easy to use standard nhibernate approaches, and from a data integrity point of view, i think it&#8217;s probably the most &#8216;correct&#8217; approach.</p><p>Looking back on my post now, i would rename my original &#8216;Translation&#8217; class to MultiLingualString and have it hold a collection of Translation objects (which would be the &#8216;TranslationValue&#8217; instances as they are called in the post).</p> ]]></content:encoded> </item> <item><title>By: Peter</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-32</link> <dc:creator>Peter</dc:creator> <pubDate>Sun, 27 Jan 2008 20:40:09 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-32</guid> <description>Good post, but wouldn&#039;t it be preferable to have the translation part invisible to the domain layer?  Product.Name should just be a string, loaded from a separate table depending on the requested locale.  Why load all the translations into the domain object?  It&#039;s unlikely that any one request is going to need or use those other locales at the entity level (rather, language choice is a change at the user or application level).  I&#039;m guessing this is needed to workaround the cache in the ORM -- Product1(fr-FR) having the same identity as Product1(en-US).  Is that the justification?I, too, have implemented a single Text table with textid/iso as the key, but without the mapping table.  In my case, we made the unique key by concatenation: type/id/property, and references it from the entity table.  I&#039;m puzzling through how to replicate this using NHibernate.  Have you had a chance to use this in production?  Is so, any thoughts on the implementation?</description> <content:encoded><![CDATA[<p>Good post, but wouldn&#8217;t it be preferable to have the translation part invisible to the domain layer?  Product.Name should just be a string, loaded from a separate table depending on the requested locale.  Why load all the translations into the domain object?  It&#8217;s unlikely that any one request is going to need or use those other locales at the entity level (rather, language choice is a change at the user or application level).  I&#8217;m guessing this is needed to workaround the cache in the ORM &#8212; Product1(fr-FR) having the same identity as Product1(en-US).  Is that the justification?</p><p>I, too, have implemented a single Text table with textid/iso as the key, but without the mapping table.  In my case, we made the unique key by concatenation: type/id/property, and references it from the entity table.  I&#8217;m puzzling through how to replicate this using NHibernate.  Have you had a chance to use this in production?  Is so, any thoughts on the implementation?</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-33</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Sun, 09 Dec 2007 15:40:59 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-33</guid> <description>yeah, setting the &#039;cascade&#039; attribute to &#039;all&#039; in Product&#039;s many-to-one mapping to Translation should do the trick</description> <content:encoded><![CDATA[<p>yeah, setting the &#8216;cascade&#8217; attribute to &#8216;all&#8217; in Product&#8217;s many-to-one mapping to Translation should do the trick</p> ]]></content:encoded> </item> <item><title>By: Hassan</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-26</link> <dc:creator>Hassan</dc:creator> <pubDate>Sat, 08 Dec 2007 22:16:26 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-26</guid> <description>Hi,
Nice Idea, I am wondering if you can do this without calling &quot;session.Save(product.Name);&quot;, is it possible to make mapping handle calling save for translation objects automatically?Thanks</description> <content:encoded><![CDATA[<p>Hi,<br
/> Nice Idea, I am wondering if you can do this without calling &#8220;session.Save(product.Name);&#8221;, is it possible to make mapping handle calling save for translation objects automatically?</p><p>Thanks</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-22</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Tue, 23 Oct 2007 06:26:09 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-22</guid> <description>well, the easiest solution that comes to mind is to provide a CurrentLanguage property setter on your Translation class, and a TranslatedValueInCurrentLanguage (or a shorter name ;)) property getter. The TranslatedValueInCurrentLanguage would simply return the specific translation based on what you set the CurrentLanguage property to. You can then simply use DynamicComparer and use &quot;TranslatedValueInCurrentLanguage&quot; as the sort expression.I haven&#039;t tried this out yet, but it should work :)</description> <content:encoded><![CDATA[<p>well, the easiest solution that comes to mind is to provide a CurrentLanguage property setter on your Translation class, and a TranslatedValueInCurrentLanguage (or a shorter name <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) property getter. The TranslatedValueInCurrentLanguage would simply return the specific translation based on what you set the CurrentLanguage property to. You can then simply use DynamicComparer and use &#8220;TranslatedValueInCurrentLanguage&#8221; as the sort expression.</p><p>I haven&#8217;t tried this out yet, but it should work <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Bergius</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-21</link> <dc:creator>Bergius</dc:creator> <pubDate>Mon, 22 Oct 2007 16:22:20 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-21</guid> <description>Any ideas regarding how to get a sorted collection of your products based on a specific translation of the names? I really don&#039;t enjoy i18n... :)</description> <content:encoded><![CDATA[<p>Any ideas regarding how to get a sorted collection of your products based on a specific translation of the names? I really don&#8217;t enjoy i18n&#8230; <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-23</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Sun, 21 Oct 2007 15:47:06 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-23</guid> <description>i haven&#039;t really thought about using a one-to-one for it to be honest, i just always use many-to-ones to map foreign keys. Technically, it does make it possible to share the same translation in multiple places although i don&#039;t really make sure that they are indeed shared instead of duplicated.  That would definitely be an interesting approach though.</description> <content:encoded><![CDATA[<p>i haven&#8217;t really thought about using a one-to-one for it to be honest, i just always use many-to-ones to map foreign keys. Technically, it does make it possible to share the same translation in multiple places although i don&#8217;t really make sure that they are indeed shared instead of duplicated.  That would definitely be an interesting approach though.</p> ]]></content:encoded> </item> <item><title>By: bryan</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-20</link> <dc:creator>bryan</dc:creator> <pubDate>Thu, 18 Oct 2007 14:55:16 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-20</guid> <description>why the relationship: &quot;many-to-one from your domain table to your translation table&quot; and not a one-to-one? is this only so that records may share the same translation or is there something else i&#039;m missing?</description> <content:encoded><![CDATA[<p>why the relationship: &#8220;many-to-one from your domain table to your translation table&#8221; and not a one-to-one? is this only so that records may share the same translation or is there something else i&#8217;m missing?</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-25</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Mon, 30 Jul 2007 13:08:41 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-25</guid> <description>in your situation i&#039;d simply replace the TranslationID with a TranslationGUID column but keep everything else the same. The most important part is being able to define a many-to-one from your domain table to your translation table, and a one-to-many from the translation identifier (be it a numeric id or a GUID) to its values.I tried a couple of different approaches, but the Translations-TranslationValues table combination was by far the easiest one and the cleanest one to get working properly. So i&#039;d definitely keep those 2 tables around.</description> <content:encoded><![CDATA[<p>in your situation i&#8217;d simply replace the TranslationID with a TranslationGUID column but keep everything else the same. The most important part is being able to define a many-to-one from your domain table to your translation table, and a one-to-many from the translation identifier (be it a numeric id or a GUID) to its values.</p><p>I tried a couple of different approaches, but the Translations-TranslationValues table combination was by far the easiest one and the cleanest one to get working properly. So i&#8217;d definitely keep those 2 tables around.</p> ]]></content:encoded> </item> <item><title>By: Simon Jones</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-24</link> <dc:creator>Simon Jones</dc:creator> <pubDate>Mon, 30 Jul 2007 12:48:49 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-24</guid> <description>Thanks! Some time ago I was looking for a good approach for multilingual NHibernate data but the project was put on hold. I&#039;ve now come back to this and your approach is the best I&#039;ve seen.However, I don&#039;t have the luxury of being able to change the schema of my domain tables (changing nvarchars to int pointers). Since each of my domain tables uses a GUID as the PK, I&#039;m thinking I can probably avoid the need for the TranslationID column.CREATE TABLE translations
(
objectid uniqueidentifier NOT NULL PRIMARY KEY,
property nvarchar(100) NOT NULL
);Just wondered if you have any thoughts on this before I embark on a POC?</description> <content:encoded><![CDATA[<p>Thanks! Some time ago I was looking for a good approach for multilingual NHibernate data but the project was put on hold. I&#8217;ve now come back to this and your approach is the best I&#8217;ve seen.</p><p>However, I don&#8217;t have the luxury of being able to change the schema of my domain tables (changing nvarchars to int pointers). Since each of my domain tables uses a GUID as the PK, I&#8217;m thinking I can probably avoid the need for the TranslationID column.</p><p>CREATE TABLE translations<br
/> (<br
/> objectid uniqueidentifier NOT NULL PRIMARY KEY,<br
/> property nvarchar(100) NOT NULL<br
/> );</p><p>Just wondered if you have any thoughts on this before I embark on a POC?</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-19</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Fri, 29 Jun 2007 08:22:15 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-19</guid> <description>Yup, definitely a valid question... I&#039;d certainly avoid doing it in the default constructor because that&#039;s the one NHibernate uses to create the persistent instances as well. So for every product you&#039;d load from the database a new Translation object would be instantiated, only to have it overwritten with the instance that NHibernate retrieves from the database moments later. Obviously, the performance penalty of this is minimal but i always prefer to avoid unnecessary object instantiation.The coolest solution would be if your inversion of control container would simply inject a new translation object through setter dependency injection. That way, objects that are instantiated by NHibernate don&#039;t unnecessarily create new translation instances and the developer wouldn&#039;t have to worry about creating the translation instance either. And it would also be completely configurable without touching code.</description> <content:encoded><![CDATA[<p>Yup, definitely a valid question&#8230; I&#8217;d certainly avoid doing it in the default constructor because that&#8217;s the one NHibernate uses to create the persistent instances as well. So for every product you&#8217;d load from the database a new Translation object would be instantiated, only to have it overwritten with the instance that NHibernate retrieves from the database moments later. Obviously, the performance penalty of this is minimal but i always prefer to avoid unnecessary object instantiation.</p><p>The coolest solution would be if your inversion of control container would simply inject a new translation object through setter dependency injection. That way, objects that are instantiated by NHibernate don&#8217;t unnecessarily create new translation instances and the developer wouldn&#8217;t have to worry about creating the translation instance either. And it would also be completely configurable without touching code.</p> ]]></content:encoded> </item> <item><title>By: den ben</title><link>http://davybrion.com/blog/2007/06/multilingual-data-and-nhibernate/comment-page-1/#comment-18</link> <dc:creator>den ben</dc:creator> <pubDate>Fri, 29 Jun 2007 07:44:42 +0000</pubDate> <guid
isPermaLink="false">http://ralinx.wordpress.com/2007/06/28/multilingual-data-and-nhibernate/#comment-18</guid> <description>Pretty nice implementation! Good data model too.  The key difference in (uhum..) most data model implementations I have had to work with in the past is the fact that there _is_ a table &#039;translations&#039; (I would ommit the s at the end of the name though).  Most people, even the  &#039;Most Valuable (tm)&#039; ones tend to forget there is such a thing and just use a duplicate key in the translationvalue table with languageid and some TRanslationID out of the blue.Your code would be even better if you didn&#039;t have to instantiate product.Name yourself.  I assume a product always has a name...This just leaves the question of who/what is responsible for instantiating this product.Name. EntityFactory?, Product Constructor?, ...</description> <content:encoded><![CDATA[<p>Pretty nice implementation! Good data model too.  The key difference in (uhum..) most data model implementations I have had to work with in the past is the fact that there _is_ a table &#8216;translations&#8217; (I would ommit the s at the end of the name though).  Most people, even the  &#8216;Most Valuable &#8482;&#8217; ones tend to forget there is such a thing and just use a duplicate key in the translationvalue table with languageid and some TRanslationID out of the blue.</p><p>Your code would be even better if you didn&#8217;t have to instantiate product.Name yourself.  I assume a product always has a name&#8230;</p><p>This just leaves the question of who/what is responsible for instantiating this product.Name. EntityFactory?, Product Constructor?, &#8230;</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/24 queries in 0.013 seconds using disk: basic
Object Caching 652/653 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d18sni7re4ly7f.cloudfront.net

Served from: davybrion.com @ 2012-05-17 10:41:05 -->
