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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:18:41+00:00 2026-06-17T06:18:41+00:00

I have an entity model with class Package { … virtual ICollection<Owner> Owners {

  • 0

I have an entity model with

class Package
{
...

    virtual ICollection<Owner> Owners { get; set; }
}

and am implementing an AddOwner() operation.

Does the entity framework require me to retrieve my Package object including owners with .Include(p => p.Owners) in order for me to call p.Add(newOwner); and save changes back to the database?

Secondary question : Intuition isn’t guiding me to an answer here because I don’t know whether to base my intuition on CLR collections or on some principle of Entity Framework; is there a principle of EF that helps me understand things better than thinking in terms of CLR collections?

  • 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-17T06:18:42+00:00Added an answer on June 17, 2026 at 6:18 am

    As long as your Package object is attached to a context, the Owners property will be set to an EntityCollection<Owner>. Regardless of whether it’s loaded, changes through that property will be marked as changes in your context, and SaveChanges() will save those changes.

    Keep in mind that your Owner object already needs to be part of the context, if it is an existing owner, though. If it is not, EF will assume you are trying to save a new Owner.

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

Sidebar

Related Questions

I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
I have an entity model where the base class in an inheritance structure has
I have an entity defined as in a db First Model: public class Merlin_BR_Condiciones_Item
In my business model I have Entity class (IPoint interface ) that has a
I have the following classes in my Model: public abstract class Entity : IEntity
I have an @Entity -annotated Model class in my Play application, which I am
I have the following simple entity: package net.plus.msodb.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity;
I have the following Entity model: public class Todo { [Required] public int ID
I have the following entity model: public class Project { [Key] public int ProjectID
My situation I have an entity model with a base class ItemBase which defines

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.