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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:03:36+00:00 2026-06-10T08:03:36+00:00

I have the following many-to-many relationship set up in my db. Mapped using Code-First

  • 0

I have the following many-to-many relationship set up in my db.

table example

Mapped using Code-First EF; A Ticket has an ICollection of Branch and vice versa.

This all works fine but now I need to make a significant change since the spec has been fleshed out.

Originally a single Ticket could be marked as IsRead but that, as a concept, only really works when the Ticket is allocated to a single branch. What I need to do is say that a Ticket has been read at each individual Branch.

Now my first thought is that I should change the relational table BranchTickets so that it has an Identity column and the IsRead property thus creating a one-to-many relationship but I don’t know then how to map the two foreign keys using the Code-First Api.

Would this be the right approach, and if so how would I go about ensuring EF maps the tables appropriately?

  • 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-10T08:03:38+00:00Added an answer on June 10, 2026 at 8:03 am

    If a Ticket can only be deemed read at Branch level, then I would say all you need to do is remove the IsRead property from Ticket and move it to BranchTickets.

    This means each individual ticket can be associated with multiple branches which can have different read states.

    how would I go about ensuring EF maps the tables appropriately

    This is a change you would need to make at DB level, you can then update your EF model.

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

Sidebar

Related Questions

I have the following relationship CType has many Field Field has many Ctype and
Using the Entity Framework Code First paradigm I have defined the following objects and
I have the following query with many LEFT JOIN clauses that has 7 result
I have the following one to many associations. Document has many Sections and Section
How do you represent a many-to-many relationship in the EF4 Code-First CTP3? For example
I have two tables set up in a many-to-many relationship: Incidents and Users. When
I have a simple many to many relationship set up between tasks and tags.
I have two tables (groups and parties) in a many to many relationship using
I have a typical many-to-many relationship using has_many => :through , as detailed below.
Let's say I have the following tables in a database forming a Many-to-Many Relationship.

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.