How to model localized items

Posted by tweir on Stack Overflow See other posts from Stack Overflow or by tweir
Published on 2010-04-14T19:01:25Z Indexed on 2010/04/14 20:03 UTC
Read the original article Hit count: 171

I'm currently designing a e-commerce solution. One of the primary requirements is for the store to support localized item details. The same store must be able to support multiple languages via the user's language selection and/or browser preference.

I have two tables:
Item (id, sku, price, ...)
ItemDetails (item_id, language, title, ...)

For each Item, there will be multiple rows corresponding to the item, where the (item_id,language) pair will be unique.

I would like to model this as:
class Item
{
public string sku;
public double price;
public ItemDetails Details;
}

Based on the user's session, I would like the items returned to have the Details object corresponds to the user's selected language (from their session).

What are some approaches for representing this?

© Stack Overflow or respective owner

Related posts about .net-3.5

Related posts about .net-4.0