This project is read-only.

How to delete all records by IRepository<T>?

Topics: Core, General
May 26, 2014 at 11:00 AM
I have table with log records. I need to delete all records from this table by button in dashboard.
How to do this?
Now I see only this way, but it looks ugly:
var itemsToDelete = _repository.Table.Take(1000);

while (itemsToDelete.Any())
    foreach (var item in itemsToDelete)
    itemsToDelete = _repository.Table.Take(1000);
May 26, 2014 at 4:36 PM
Unfortunately there is no other way using the repository. You write HQL directly through the NHibernate ISession (inject ISessionLocator) directly though.