Base solution for your next web application
Open Closed

Repository and IFullAudited problem #67


User avatar
0
gvb created

Hi,

I'm trying to make a list of my entity and it seem's that i cannot get the entities where the IsDeleted = true

_repoNews.GetAll().Where(x => x.IsDeleted == true).ToList().Count always return 0 but i have at least 1 entity that is Deleted.

Is there a way to get the IsDeleted = true ?

I found that ISoftDelete say ->

/// <summary> /// Used to standardize soft deleting entities. /// Soft-delete entities are not actually deleted, /// marked as IsDeleted = true in the database, /// but can not be retrieved to the application. /// /// </summary>

Is there a way to deactive this for a request?

The thing i wanna make is a list where I see all my entity and see if they are active / inactive (!deleted or deleted) and i want to be able to reactive an entity IsDeleted = true to IsDeleted = false


2 Answer(s)
  • User Avatar
    0
    gvb created

    Any idea on how to remove the filter SoftDelete from IRepository query ?

  • User Avatar
    0
    hikalkan created
    Support Team

    If you're in an application service, just call this:

    CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete);
    

    Then your deleted data is retrieved. You can then filter if you want.

    But notice that: If you need some Active/Passive state that passive entities are always retrieved into application unless you explicitly filter, then do not use ISoftDelete, use IPassivable.

    I'm documenting these nowadays (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/doc/WebSiteContents/data-filters.html">https://github.com/aspnetboilerplate/as ... lters.html</a>) but not finished yet.