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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:12:00+00:00 2026-05-15T18:12:00+00:00

I have an application where a user can upload files and associate the files

  • 0

I have an application where a user can upload files and associate the files with a project. The projects can be duplicated. Here is an example of an object:

Public class Project{
    Int ProjectId{get; set;}
    string ProjectName{get;set;}
    List<int> FileIds{get;set}
}

When I go to duplicate the project, say, what is the best way to associate the same files with a new project? I have two tables for projects and files. I have a relational table that has foreign keys to the project id and the file ids. When I create a new project id I want to bulk insert the file ids into the relational table. Is it just as good to iterate through the List and inert one at a time or is there a better way?

  • 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-15T18:12:00+00:00Added an answer on May 15, 2026 at 6:12 pm

    If the project you’re duplicating is already at the SQL Server by far the most efficient thing to do is to do the duplication at the SQL Server, just a simple:

    INSERT INTO Files (ProjectId,FileId)
    SELECT 2 As ProjectId, FileId
    FROM Files WHERE ProjectId = 1

    Where the New Project is ProjectId=2 and the old one is ProjectId = 1

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

Sidebar

Related Questions

I have an application that shows a list of items. The user can click
I have a web application with users and their documents. Each user can have
I have a Timestamp value that comes from my application. The user can be
I have an application where I need the user to upload a photo. After
I have an application where the user selects the dates of a first statement
We have a current application where user login credentials are stored in a SQL
I have a rails application where each user has a separate database. (taking Joel
We have an application containing a lot of user controls that update frequently based
I have an application that needs to hit the ActiveDirectory to get user permission/roles
I have an application that is using Windows Authentication and a SqlRoleProvider for user

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.