I have a simple catalog for a company on the web. It consists of categories with items in them. They now have some items that fit in two categories and want to show one item in two categories.
At the moment the models looks like this
public class Category {
public virtual ICollection<Item> Items { get; set; }
}
public class Item {
/* No reference to no category */
}
The database that was generated long ago linked the category from the Item-table. So now if i add an item to two categories on the last i added “counts”.
I would like to change this without any data-loss. How would i do this? Note that i can change the database structure how much i like.
I ended up creating a back up of the database and forcing a update database with dataloss and using
then creating an sql-script to insert the data loss into the right table