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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:55:52+00:00 2026-05-26T12:55:52+00:00

I have a database that consists in keeping calendars, those calendars are spread out

  • 0

I have a database that consists in keeping calendars, those calendars are spread out in several tables that uses FK to each tables…

Everything works but now I want to be able to say

Create a new calendar with all it’s features based on calendar Id: 62

I was trying one way but it’s terrible, witch is going through all my repository Update area and fire each onde that will create new content on each table…

Is there a faster Solution?

A way that we could simply say

db.Entity<Calendar>(CalendarId).CloneAsNew();

so I would end up with :

[Table Calendars]
calendar_id    Name    Url
62             Cal_A   url_A
74             Cal_A   url_A

[Table CalendarContents]
content_id   calendar_id  type   img_background    img_top
14           62           1      bkg.png           top.png
26           74           1      bkg.png           top.png

having only one calendar before, as

[Table Calendars]
calendar_id    Name    Url
14             Cal_A   url_A

[Table CalendarContents]
content_id   calendar_id  type   img_background    img_top
14           62           1      bkg.png           top.png

P.S. If you detach and attach it again like

context.Detach(entity);
entityCollection.Add(entity);

we loose all references :-/

  • 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-26T12:55:53+00:00Added an answer on May 26, 2026 at 12:55 pm

    EF doesn’t provide any way to clone entity graph. At this time you have to general solutions:

    • Create stored procedure to clone your calendar, map it as function import and use it for cloning and retrieving Id of new calendar. Once you have an Id execute new query to load whole entity graph for the new calendar.
    • Get entity graph for the whole old calendar and create deep clone (you must serialize the entity graph to the stream and deserialize it back to a new entity graph). Add new entity graph to the context and save changes. It should insert all entities in the new graph.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an access 2007 Database that consists of 3 tables each having 1
I have a database that consists of 5 tables : Course, Category, Location, CourseCategories,
Consider a database(MSSQL 2005) that consists of 100+ tables which have primary keys defined
I have a database that consists of two tables, which look like this: users
Let's say I have a large database that consists of products in groups. Let's
If you have a set of tables in the database that strictly consist of
I have a Silverlight application that consists of a MainWindow and several classes which
We have a SQL Server database table that consists of user id, some numeric
I have inherited an Access 2007 database that has been split so the tables
I have a simple MySQL 5 database that consists of id - Int -

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.