I have this very simple TPH Model.
When I add an object using context.TIImport.AddObject(tiObj)
and then call context.TIImport.Count() – the value doesn’t include the new object?
I want to be able to add multiple objects before hitting context.SaveChanges()

var context = new CodeFirstContainer();
var g = new TIGuarantee
{
Id = 1,
AccountNumber = "123",
Amount = 123
};
context.TIImports.AddObject(g);
var il = new TIImportLoan
{
Id = 2,
AccountNumber = "123",
Amount = 123
};
context.TIImports.AddObject(il);
var i = context.TIImports.Count(); // = 0
context.SaveChanges();
var j = context.TIImports.Count(); // = 2
}
Is there any way to tell how many objects are in the collection WITHOUT calling SaveChanges?
You can do this by going into the ObjectContext.ObjectStateManager and check all entities with EntityState as Added to the right Collection and include that with your count. Why you want to do this however is not clear. When you perform a read, these entities wont be included untill you actually persist them to the underlying datastore with SaveChanges(); If your aim is not to make the changes final, maybe you should look into transactions then?