Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8426683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:35:48+00:00 2026-06-10T04:35:48+00:00

I have a simple catalog for a company on the web. It consists of

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:35:50+00:00Added an answer on June 10, 2026 at 4:35 am

    I ended up creating a back up of the database and forcing a update database with dataloss and using

              modelBuilder
                .Entity<Category>()
                .HasMany(c => c.Items)
                .WithMany()
                ;
    

    then creating an sql-script to insert the data loss into the right table

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some simple catalog products in Magento, so I have their SKUs &
I have this simple snippet with an ActionLink that is supposed to display some
I have written a simple Magento plugin that simply lists all sub categories that
I have put together a simple ASP.NET MVC 3 test web app that uses
i have some simple Export/Import Scenario that i can't figur out why this not
I have a simple .change function that goes to the database and gets some
I'm developing a simple product catalog in Titanium and I have a TableView with
I have simple php validation form that is halfway working. If you leave the
I have simple database - one table with 6 collumns. 3 of them i
I have simple win service, that executes few tasks periodically. How should I pass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.