Getting Error Invalid for root objects - use Delete insteadGetting Error Invalid for root objects - use Delete instead
Old forum URL: forums.lhotka.net/forums/t/3877.aspx
RanchCharm posted on Friday, November 09, 2007
Hi All,
Thanks for looking at the question in spite of your busy schedule.
I have a Parent List which has list of Parent objects. Each Parent has a Child List. Each Child List has list of childs and each Child in turn has a Grand Child List made of Grand Child. All List are BusinesBaseList and all Parent/Child/Grand Child are BusinessBase. (I loaded the objects using a technique described by Rocky - Thanks)
Everything works fine like loading, saving, and deleting. I recently added an option to lock each Parent (in the database I update the LockedBy field in the table). Basically my grid displays all Parents and when user click on Edit button in a row I want to lock the parent. When this happens I want re-load the parent and all its children and grand children becoz somebody might have changed it.
so i am doing this: ParentList[intItemIdx] = ParentList[intItemIdx].Lock(Global.UserName);
public BusinesBase<Parent> Lock(string UserName)
{
return Parent.GetParent(new Cirteria(this.ParentId, Context.UserName);
}
The Lock function is almost like a load. It creates a criteria, sets the id to Parent's Id and calls the load method. The lock executes without any problem and returns the Parent.
The error "Error Invalid for root objects - use Delete instead" is thrown when I assign it.
I guess i am not understanding CSLA well enough. Did any of you get a similar error? Appreciate any feedback/solution. Please let me know If I haven't given enough info to understand the problem.
Thanks,
Nachi
RanchCharm replied on Friday, November 09, 2007
I found the issue and fixed it. I will post the solution (or should I call the mistake I did and corrected later) on Monday.
Thanks,
Nachi
Copyright (c) Marimer LLC