If you pass a list of persistent objects to the remove method of the IObjectScope, a temporary stored procedure will be created and will be called for the members of the list. This will greatly improve your performance. If you, however, would like to use the approach you mentioned you can quite easily implement it by yourself. What you would need to do is create a simple stored procedure that takes only 1 parameter (the id on which your remove logic will be based) and reverse map it to a static method. Implement a method Clear() in your class that will clear your list and execute the stored procedure for deleting the elements. For example:
|public void Clear()
In the stored procedure DeleteOrderDetails you can have any logic you find suitable for your scenario. This way you can guarantee that minimal calls are made to your SQL server.
the Telerik team