Print Page | Close Window

Entity not getting Deleted

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2756
Printed Date: 06-May-2025 at 4:36pm


Topic: Entity not getting Deleted
Posted By: Inder_gujral
Subject: Entity not getting Deleted
Date Posted: 12-Jun-2011 at 8:16am
Hi,

I am using IdeaBlade version 6.0.8.1 Entity Model Extension Dlls. How to delete an entity?

If I use Context.RemoveEntity(entity) and do a SaveChangeAsync(). The data still stays in the database.

I checked the samples provided for delete and update. There you are using entity.DeleteGraph() method which is available for each entity.

But in version 6.0.8.1, the deletegraph method is not available. Can you please tell how to delete the entity?

I am not facing any error. Its just the operation executes but data still stays in db.

Looking forward to your quick response.

Thanks
Inder Gujral



Replies:
Posted By: robertg
Date Posted: 13-Jun-2011 at 1:51pm
When you remove the entity, you are just detaching it, which of course would not result it in being deleted from the datasource. What you want to do is mark it for deletion with Delete(), and then SaveChanges().
 
Here is the DRC page on this: http://drc.ideablade.com/xwiki/bin/view/Documentation/entity-deletion - http://drc.ideablade.com/xwiki/bin/view/Documentation/entity-deletion
 
Some of our newer examples do show this in effect. For example, if you look at the Tour of Silverlight example, you'll find these methods in the view model:
 
 

private void Delete(IEnumerable<Employee> employees) {

employees.ForEach(employee => employee.EntityAspect.Delete());

Save();

}

 
Sorry if the samples you have are out of date. You may want to download new versions from the DRC.
 
Yours,
Robert



Print Page | Close Window