This project is read-only.

Delete from TABLE (How?)

Nov 17, 2011 at 11:05 AM

Hi everybody!

In an point of my application, I need to delete all rows of a table. I'd like to permorm a "DELETE from TABLE" operation.

There is some way to performe a batch delete instead of geting an ObjectSet, loop trhought each object, MarkForDeletion and PersistChanges in each one of them?


Thank u!

Feb 4, 2012 at 6:00 AM

The best way of doing batch deletes is to get around the ORM and directly execute against the database. This is more powerful then loading everything into objects.

Opf3 allows to get access to the ADO.NET objects (as interfaces) through the SqlRawStorageAccess class, which is found in the Chili.Opf3.Storages namespace. This allows to execute queries against the database without having to instantiating the storage specific objects yourself.