Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to retrieve deleted record in softdelete #2070


User avatar
0
andry3ag created

The patform is setup softdelete. I want to retrieve deleted record. How to do it?


1 Answer(s)
  • User Avatar
    0
    gpcaretti created

    Use filters:

    public async Task<PagedResultDto<SimpleUserDto>> FindByMyCriteriaSimple(SearchInputBasic input) {
        IDisposable filter = null;
        try {
            filter = _unitOfWorkManager.Current.DisableFilter(true);
            // now your query returns 'soft deleted' items too
            var users = await _userRepository.FindByMyCriteriaAsync(input.Pattern, input.SkipCount, input.MaxResultCount);
            . . .
            return ...;
        }
        finally {
            if (filter != null) filter.Dispose();
        }
    }
    

    See <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Data-Filters#DocDisableFilters">http://www.aspnetboilerplate.com/Pages/ ... bleFilters</a>