I have an IEnumerable and I want to insert all the items into an Entity Model collection.
e.g. Looking for a way to do the following:
var missingitems = IEnumerable<MissingItem>();
//Add lots of Missing Items
modelContext.MissingItems.AddList(missingitems);
Instead of having to do:
missingitems.ToList().ForEach(mi=>modelContext.MissingItems.Add(mi));
There is no
AddListorAddRange. You can create your own extension method which will offer you your expected syntax but internally your new method will still callAddObject(orAddin DbContext) in loop becauseAddObject(Add) is not just adding to “collection”.