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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:28:47+00:00 2026-05-19T17:28:47+00:00

I am wondering if it is possible to map a m:n relationship in the

  • 0

I am wondering if it is possible to map a m:n relationship in the database twice in a EF4 Model.

Consider this database model:

http://andarki.dk/stackoverflow/db.png

It is a standard m:n relationship between companies and users.
If the field works_at.is_locked_out is ignored during model generation it generates a nice * to * relationship in EF:

http://andarki.dk/stackoverflow/pretty.png

If i enable works_at.is_locked_out it looks more like the original db schema:

http://andarki.dk/stackoverflow/detailed.png

Is it possible to have both relations at once?
For some queries works_at.is_locked_out isn’t necessary and having the direct link makes it easier to query in those cases.
When i add both relations i get the error

Problem in mapping fragments starting at lines 23, 30:Two entities with possibly different keys are mapped to the same row. Ensure these two mapping fragments map both ends of the AssociationSet to the corresponding columns.
TestModel.edml

Is this in any way possible or is it a case of me trying to have my cake and eating it too?

  • 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-19T17:28:47+00:00Added an answer on May 19, 2026 at 5:28 pm

    Both at the same time is not possible as you see with the error you are presented. This article by Julie Lerman will explain a lot, if not all. And I think you should go for alternative 2, because as you said it isn’t always necessary, but sometimes (or in the near future) it is. That field isn’t there without any purpose I guess… 😉 Good luck!

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

Sidebar

Related Questions

I'm a complete noob to Automapper and I'm wondering if its possible to map
I am wondering if it is possible using annotations to persist the attributes map
I am wondering if it is possible to create a route on a map
I am wondering whether or not it is possible to elegantly map the results
Is it possible to write map/reduce jobs for Amazon Elastic MapReduce ( http://aws.amazon.com/elasticmapreduce/ )
I was wondering if it is possible to map multiple DTO objects to a
I'm wondering, is it possible to somehow map a key-press event to act like
I'm wondering if only by applying some standard algorithms is possible to write a
I was wondering ( if possible ) if there was a program/tool/utility that when
Just toying with the SDK and I was wondering if possible a UITouch event

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.