for example i've got a TestItem entity:
public class TestItem
{
[Key]
public int Id { get; set; }
public string Description { get; set; }
}
and view model with list, method where we'll add new items to this list, and method where we'll call _TestDomainContext.SubmitChanges
EntityList<TestItem> SomeList = new EntityList<TestItem>(_TestDomainContext.TestItems);
private void AddTestItem()
{
SomeList.Add(new TestItem());
}
private void SubmitChanges()
{
_TestDomainContext.SubmitChanges();
}
And now, after the first item is added to list and SubmitChanges() is called everything works perfectly, but when i try to add second item i get the exception : An entity with the same identity already exists in this EntitySet.
is the only way to get rid of this is manually refresh the SomeList in OnSubmitComplete callback i.e.:
_TestDomainContext.TestItems.Clear();
_TestDomainContext.Load(_TestDomainContext.GetTestItemsQuery());
Thank You !