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 7196295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:45:06+00:00 2026-05-28T20:45:06+00:00

I have two objects with a many to many relationship, let’s call them Book

  • 0

I have two objects with a many to many relationship, let’s call them Book and Category. The standard thing to do in Entity Framework – Code First would be to map them together and put a navigation property on either side, which I have done. I am working in a detached context, so I need to serialize my objects. So if I have two Book objects and three Category objects, one of which is shared by the two Book objects, do I suffer a performance loss by serializing the Book objects as they are by serializing the shared Category twice? Would it be beneficial performance-wise to serialize my Book objects and Category objects separately and rebuild the relationship post-serialization?

I suppose it might depend on the serializer. If anyone has any other tips on the best method to go about this, I would appreciate any advice.

  • 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-05-28T20:45:07+00:00Added an answer on May 28, 2026 at 8:45 pm

    You need to use serialization with reference tracking (you must do it anyway if you have navigation properties from Book to Category and from Category to Book otherwise you will get circular reference exception). Once you use this serialization each your entity will be serialized only once.

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

Sidebar

Related Questions

I have a one to many relationship between two objects, lets call them Gallery
I have two Entity Framework objects with a one-to-many relationship: widget(parent) and widgetNail(child) Widget
I have two objects, let's call them Input and Output Input has properties Input_ID
Let's say I have two objects: Articles and Categories with a many-many relationship between
I have a many-to-many relationship between two objects with a join table. I need
I have two related objects: ProgramSession and ProgramTask, with a one-to-many relationship. A ProgramSession
If I have two objects that have a many-to-many relationship, I would typically model
Say I have two models, Book and Author with a has_and_belongs_to_many relationship between them.
I've got two entities with a one-to-many relationship between them. The entity that holds
I have two tables - let's call them Customers and Orders. It's a 1:n

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.