This is not a technical question, but the question of how to model the data.
First, I use the Entity Framework to create a data warehouse.
I am creating an e-commerce site for small businesses, and I created a system that seems to be working fine, but now I realized that I made a fundamental mistake (I think!).
I have an order object and a product object. The product obviously contains all the product information, including price.
Now I have created over 100 products that are now in a table called Products
Therefore, when I create an order, one product or several products is added to the order. Thus, the order now contains links to the product table.
This works fine until I realized that I can change the price (provide a discount, etc.) of the product in the order. Since the product in the order is tied to the product table, if I make changes to the price, this will change the price for all previous and future orders.
So it looks like I need 2 product tables. One of them is the current list of products for sale, and the other is the goods sold, which are children of the order object.
What is the best way to simulate this? I am sure that I will need 2 different product tables.
Any advice on this would be greatly appreciated.
source share