ORMEntityIsDeletedException with RadGrid and LLBLGenProDataSource2

Posts   
 
    
mk
User
Posts: 2
Joined: 10-Aug-2007
# Posted on: 10-Aug-2007 10:54:35   

Hi,

LLBLGenPro 2.0.0.0 Runtime library buildnr. 07052007 Adapter ASP.NET 2.0 C# Telerik RadControls Q1 2007 SQLServer 2005

I'm using the Telerik RadGrid with a LLBLGenProDataSource2 datasource with EntityCollection DataContainerType and LivePersistence=true. The grid is showing the correct data and updating and deleting a single row is working fine. However, when selecting multiple rows for deleting, an ORMEntityIsDeletedException is thrown. This is the stacktrace:

[ORMEntityIsDeletedException: This entity is deleted from the database and can't be used in logic.] SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.GetCurrentFieldValue(Int32 fieldIndex) +375 SD.LLBLGen.Pro.ORMSupportClasses.EntityField2.SD.LLBLGen.Pro.ORMSupportClasses. IEntityFieldCoreInterpret.GetValue(IEntityCore entity) +129 SD.LLBLGen.Pro.ORMSupportClasses.FieldCompareValuePredicate.InterpretPredicate(IEntityCore entity) +45 SD.LLBLGen.Pro.ORMSupportClasses.Predicate.SD.LLBLGen.Pro.ORMSupportClasses. IPredicateInterpret.Interpret(IEntityCore entity) +4 SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.InterpretPredicate(IEntityCore entity) +158 SD.LLBLGen.Pro.ORMSupportClasses.Predicate.SD.LLBLGen.Pro.ORMSupportClasses. IPredicateInterpret.Interpret(IEntityCore entity) +4 SD.LLBLGen.Pro.ORMSupportClasses.CollectionCore1.FindMatches(IPredicate filter) +172 SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase21.SD.LLBLGen.Pro.ORMSupportClasses. IEntityCollection2.FindMatches(IPredicate filter) +4 SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceView2.FindEntity(IDictionary keys) +389 SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceView2.ExecuteDelete(IDictionary keys, IDictionary oldValues) +99 System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +71 Telerik.WebControls.GridTableView.PerformDelete(GridEditableItem editedItem, Boolean suppressRebind) +227 Telerik.WebControls.GridCommandEventArgs.ExecuteCommand(Object source) +2615 Telerik.WebControls.RadGrid.OnBubbleEvent(Object source, EventArgs e) +130 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 Telerik.WebControls.GridItem.OnBubbleEvent(Object source, EventArgs e) +36 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 Telerik.WebControls.GridItem.OnBubbleEvent(Object source, EventArgs e) +112 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +86 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921

One selected record has been removed from the database table, the remaining selected records have not been removed.

Is this a problem related to the LLBLGen LLBLGenProDataSource2, or is this a Telerik RadGrid issue?

If I should provide more information, please let me know.

Thanks, Marco

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39888
Joined: 17-Aug-2003
# Posted on: 10-Aug-2007 11:19:20   

The ExecuteDelete method assumes it's called for a single entity, then the delete executes and the data should be updated.

I think the problem is that the grid simply executes ExecuteDelete multiple times, while it doesn't refresh the data (it simply executes delete multiple times on the same set). This then makes it go wrong. What the datasource should do is remove the entity deleted from the set of data.

I'll try to fix this.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39888
Joined: 17-Aug-2003
# Posted on: 10-Aug-2007 11:57:59   

I've a build for you I'd like you to test, as we don't have Telerik's controls we can't test it ourselves.

Please use the attached ormsupportclasses dll to fix your problem. Be sure you haven't installed the ormsupportclasses dll in the GAC and alsomake sure the one in the app's bin folder is indeed this one.

Frans Bouma | Lead developer LLBLGen Pro
mk
User
Posts: 2
Joined: 10-Aug-2007
# Posted on: 10-Aug-2007 12:06:19   

This is great, your new build fixes the problem!

Thanks alot Frans.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39888
Joined: 17-Aug-2003
# Posted on: 10-Aug-2007 13:06:35   

mk wrote:

This is great, your new build fixes the problem!

Thanks alot Frans.

No problem, and thanks for testing! simple_smile

Frans Bouma | Lead developer LLBLGen Pro
bjacobs
User
Posts: 73
Joined: 20-Aug-2008
# Posted on: 22-Aug-2013 22:20:22   

I am having a similar issue. I am using LLBLGen 4.0. I have a WPF project using MVVM. I have a View Model that has an ObservableCollection of entities and they are bound to a grid on my screen. When I delete an entity, I first remove it manually from the ObservableCollection and then delete it from the database, but my DelegateCommand's CanExecute still tries to fire on the removed item which throws the ORMEntityIsDeleted exception. Coincidentally, the collection is bound to a telerik grid.

Is there a way to check to see if the object has been deleted programmatically or something else I should be doing?

Thanks,

Billy Jacobs

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 23-Aug-2013 01:14:35   

Could you please open a new thread for your question?

ref: Forum guidelines: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=7720