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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:52:08+00:00 2026-05-19T16:52:08+00:00

I need populate a Pure Junction Table (containing only FK to other tables) when

  • 0

I need populate a Pure Junction Table (containing only FK to other tables) when an EntityDataSource _Inserted event is raised.

I have 3 Tables in my Database:

CmsJobs (JobId)
CmsJobsUsers (JobId FK, UserId FK)*
aspnet_Users (UserId)

*CmsJobsUsers is a PURE JUNCTION TABLE and it is not represented as an entity in the EF Model.

Here my code, I am NOT able to save this data in CmsJobsUsers.

protected void uxEntityDataSourceCreateJob_Inserted(object sender, EntityDataSourceChangedEventArgs e)
{
    Guid myUserListSelected = new Guid(uxListUsers.SelectedValue);// Guid for UserId in DropDownList 
    CmsJob myJob = (CmsJob)e.Entity; // My new Jobid
    aspnet_Users myUser = new aspnet_Users();
    myUser.UserId = myUserListSelected;
}

Any Ideas? Thanks for your help!

Here a useful resource:
But I am not able to implment it:
http://thedatafarm.com/blog/data-access/inserting-many-to-many-relationships-in-ef-with-or-without-a-join-entity/

  • 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-19T16:52:09+00:00Added an answer on May 19, 2026 at 4:52 pm

    You’re not showing your EDM, but your CmsJob entity should have a navigation property aspnet_Users and the aspnet_User entity should have a navigation property CmsJobs. The simplest way to insert an entity into the junction table you need to fetch a User from the DB, add a CmsJob to the users CmsJobs collection, and save the user.

    Again, you are not showing your attempt to persist anything to the DB, so I will write up a suggestion:

    protected void uxEntityDataSourceCreateJob_Inserted(object sender, EntityDataSourceChangedEventArgs e)
    {
        using (var context = new YourEFObjectContext())
        {
            Guid myUserListSelected = new Guid(uxListUsers.SelectedValue);
            CmsJob myJob = (CmsJob)e.Entity; // My new Jobid
            aspnet_Users myUser = context.aspnet_Users.Single(u => u.UserId == myUserListSelected);
            myUser.CmsJobs.Add(myJob);
            context.SaveChanges();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need run code that will create a database and populate tables. i am
I need to populate my production database app with data in particular tables. This
I have table with two SelectOneMenu in row. I need populate data in second
So i have a temporary table that I need to populate with the records
I have a livesearch script that i need to populate my html menu with
I need to populate the dropdown and onchange of this dropdown I have to
I need to populate a currently empty table with a hundred or so fake
i need to populate a table column which takes one of 30 different string
I need to populate a database with thousands of entries on a daily basis,
I have a form with a select element that I need to populate with

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.