Hi,
I am trying to do the following
var q = _manager.UnpaidInvoices; foreach (var unpaidInvoice in q) { unpaidInvoice.EntityAspect.Delete(); } _manager.SaveChanges();
when looking in the database the entities are deleted
but somehow they are still present in the entitymanager
because when i start adding the new entities i get an error saying that an entity with this key already exists.
foreach (var item in list)
{
UnpaidInvoice ui = UnpaidInvoice.Create(_manager, item.Id);
}
_manager.SaveChanges();
also is it necessary to do the savechanges after the delete of the entities ?
here under is the create method
public static UnpaidInvoice Create(EntityManager pEntityManager, string pId) { UnpaidInvoice upi = pEntityManager.CreateEntity<UnpaidInvoice>(); upi.Id = pId; upi.EntityAspect.AddToManager(); return upi; }
what am I doing wrong here? Why isn't the cache update after the delete ?
|