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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:19:15+00:00 2026-06-08T20:19:15+00:00

I have a many to many EF map similar to the example below. I

  • 0

I have a many to many EF map similar to the example below. I am using EF code first approach so my mapping class inherits EntityTypeConfiguration<>.

this.HasMany(a => a.KPIs)
            .WithMany()
            .Map(a =>
            {
                a.ToTable("KeyResultArea_KeyPerformanceIndicator_Mapping");
                a.MapLeftKey("KRA_Id");
                a.MapRightKey("KPI_Id");
            });

As a result of this im left with the schema shown below.

enter image description here

No great surprises so far. – However I would like to be able to soft delete one of these mappings so my desired schema would look something like this;

dbo.KeyResultArea_KeyPerformanceIndicator_Mapping(
   KRA_Id int,
   KPI_Id int,
   Deleted bit)

Hope it makes sense, any pointers would be most welcome.

  • 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-08T20:19:17+00:00Added an answer on June 8, 2026 at 8:19 pm

    I think you may need to have your own logic to define the deletion of the relationships. You can define new enttity type for the relationship,

    public class KRAKPI{
    
    public int KPA_Id{get;set;}
    public int KRA_Id{get;set;}
    public bool IsDeleted{get;set;}
    
    }
    

    And then you can define the deletion logic in save changes by getting all KRAKPI deleted items in the state manager and setting them to modified state with changing the IsDeleted value.
    Here is a post on setting the deleted value in save changes method.

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

Sidebar

Related Questions

I have 2 tables which have many-to-many relation. Code of entities public class Product
So, I have created many map applications before, but the one that I am
I have a Hash Map (many-to-one relationship between texts and boolean values): name flag
I have made a map with jQuery which is split up in many regions,
I have a similar problem as @Mike in this question . The question is
I have two simplest of Entities, similar to: public class User { int id;
I'm using nHibernate to map an object very similar to .NET's System.Web.SiteMapNode. In order
I had a similar question to Fluent NHibernate: How to create one-to-many bidirectional mapping?
I am using ruby 1.8.7 and ruby on rails 3.x . I have many
I have many different NSArray 's stored in .dat files, in the Documents folder

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.