This is a migrated thread and some comments may be shown as answers.

List Remove and Clear question

1 Answer 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
adi
Top achievements
Rank 1
adi asked on 10 Nov 2011, 12:49 PM
Hi,

I want to use OpenAccess (not the classical version) and have a question about deleting objects from a list or clearing the complete list.
I've found that How to: Delete Objects in documentation. I've tried this and it works for me.
OpenAccess generates a list of objects (IList<Object>) if there is a 1..n relationship between tables. These lists know Remove() and Clear() methods, I would prefer to use to achieve e.g. clearance the whole list and persist with SaveChanges() in database. Is there a best practice for that or what would you suggest?

1 Answer, 1 is accepted

Sort by
0
Ivailo
Telerik team
answered on 15 Nov 2011, 07:57 AM
Hello Adi,

You have found the correct article. Also, there is no problem to work through the collection for your objects deletion. You need to have  one thing in mind though - by default, the collections are not managed by the OpenAccess ORM runtime automatically. In order to do so, you have to make the IsManaged property of the navigation property true, as shown in the article for the insert operation, within the Setting One-to-Many Relations Between Objects section.

Be careful with that property and use it only when necessary, since it can cause performance slow downs when used with large tables.

I hope that helps. Do not hesitate to get back to us if you need further clarifications or you have other questions.

Greetings,
Ivailo
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

Tags
General Discussions
Asked by
adi
Top achievements
Rank 1
Answers by
Ivailo
Telerik team
Share this question
or