Probably this question has been answered before, if that's the case I would appreciate if you guys point me in the right direction.
I would like to know what happens when a new object is added to an EntityFramework collection.
More precisely, I'd like to know if in order to add the new object the whole collection is loaded into memory
For example:
public class MyContext : DbContext
{
public DbSet<Assignment> Assignments { get; set; }
}
public class SomeClass
{
public void AddAssignment(Assignment assignment)
{
var ctx = new MyContext();
ctx.Assignments.Add(assignment);
ctx.SaveChanges();
}
}
Do all the assignment records have to be loaded into memory just to perform a simple insert???