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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:37:09+00:00 2026-05-16T03:37:09+00:00

I have successfully used EF4 to insert rows automatically with a server generated GUID:

  • 0

I have successfully used EF4 to insert rows automatically with a server generated GUID:

http://leedumond.com/blog/using-a-guid-as-an-entitykey-in-entity-framework-4/

Now how does one perform this task if there exists a RowID (guid) and ParentRowID (guid) with a primary-foreign key constraint between the two? What would I set .ParentRowID to?

            NewCut = New Row With
            {
                .ParentRowID = .RowID
            }

SaveChanges throws a fit every time.

The fact that the primary key is a GUID is in fact irrelevant because I attempted the same test using a standard autogenerated integer without success.

  • 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-16T03:37:10+00:00Added an answer on May 16, 2026 at 3:37 am

    The solution is as simple as the one you have posted.
    Just create both parent and child entities in code, do not set Entity Key and not forget to set StoreGeneratedPattern for all server-generated Guid columns.
    Then perform either MasterEntityInstance.Children.Add(ChildEntityInstance), or ChildEntityInstance.MasterEntity = MasTerEntityInstance and call SaveChanges.
    After the SaveChanges call both guid properties will be populated with the correct Guid values, and ChildEntity.MasterEntity Entity Key will be populated with the necessary MasterEntity Entity Key value.

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

Sidebar

Ask A Question

Stats

  • Questions 507k
  • Answers 507k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Replace return info with info. Rails.cache.fetch("telecom_info_for_#{ref_num}", :expires_in=> 3.hours) do #… May 16, 2026 at 3:54 pm
  • Editorial Team
    Editorial Team added an answer Cookies are handled by HTTPClient by default. You shouldn't have… May 16, 2026 at 3:54 pm
  • Editorial Team
    Editorial Team added an answer This should do the trick: SELECT P.* FROM Palettes AS… May 16, 2026 at 3:53 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have successfully used Pocket PCs in the past (using the serial port) to
I have successfully used the Excel and Word addin templates in Visual studio 2008
I've followed the tutorial here: http://book.cakephp.org/view/1286/Sending-a-basic-message , which I have successfully used before with
I have successfully created the message queue by using the following command: msgIdHareTurtle =
Using EasyHook I have successfully hooked both exported functions and known vtable functions for
Recently, I have worked in a project were TDD (Test Driven Development) was used.
I have been using Sinatra for sometime now and I would like to add
I have used Oracle Advanced Security to encrypt data during data transfer. I have
For some reason, YQL's XSLT table can't parse my stylesheet. I have used the
I have two horizontally scrolling UIScrollViews stacked vertically on top of each other within

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.