Localization - what primary key for a translation table?

Posts   
 
    
Chombatta
User
Posts: 21
Joined: 12-Aug-2008
# Posted on: 16-Apr-2009 17:02:13   

-

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 16-Apr-2009 20:50:14   

Primary Keys have to uniquely identify a row. In your case you cannot use GenderId alone as there could potentially be many translations for each Gender.

Why not add an Id column as you have in your original Gender column? This can be a db generated autoincrement column which would then identify each row. This is actually a fairly standard database design. You can then add a unique constraint or index on the GenderId/CultureId column pair to prevent duplicates.

Indexing for performance is something that you would really need to profile to see if what the differences were - on a table like this with potentially only a few rows I'd be surprised if anything you did made a huge amount of difference.

Be wary of using tinyInts in SQL with LLBLGen - it picks them up as byte data type rather than int, which is not really what you want. Stick with SQL Int.

Matt

Chombatta
User
Posts: 21
Joined: 12-Aug-2008
# Posted on: 16-Apr-2009 21:39:50   

-