Querying objects after AddObject before SaveChanges?
To persist an entity you usually add it to it’s DbSet in the context. For example var bar = new Bar(); bar.Name = “foo”; var context = new Context(); context.Bars.Add(bar); Surprisingly, querying context.Bars, the just added entity cannot be found var howMany = context.Bars.Count(b => b.Name == “foo”); // howMany == 0 After context.SaveChanges() the … Read more