Thursday, November 5, 2009

Changes with a list

Inserting from the entity with a list.


foreach(ListItem itemlist in MyListBox.Items)
{
db.MyEntities.InsertOnSubmit(new MyEntity()
{
Id = variableId,
name = itemlist.Value
});
}

with a child:

foreach (ListItem col in SListBox.Items)
{
newentityMaster.Childentity.Add(new Childentity {
FilterId = newfilter.id,
ColumnName = col.Value,

});
}





getting my changes performed (DML, insert, delete, updates).

db.GetChangeSet().Inserts

No comments: