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

Entities with IsDeleted = true still being queried out #3612


User avatar
0
soonjoo created

Hello, i have issue where the deleted entities are still being queried out. This is my code:

var fileWithAdditionalInfo = await _fileRepository
                .GetAll()
                .Include(e => e.FilePermissions)
                    .ThenInclude(filePermission => filePermission.SharedWithUser)
                .Include(e => e.FileAnnotations)
                    .ThenInclude(fileAnnotation => fileAnnotation.Annotation)
                .Where(e => e.Id  == file.Id)
                .FirstOrDefaultAsync();

And this is my local variable while im debugging.

online uploader

Currently my FilePermission inherits my own class which is PermissionBase, and PermissionBase inherits FullAuditedEntity.

Am I missing something or is this a bug on your side? thank you


2 Answer(s)
  • User Avatar
    0
    soonjoo created

    The issue is still there, but for now, I will use a quick fix, this is my code that works temporarily now:

    var fileWithAdditionalInfo = await _fileRepository
                    .GetAll()
                    .Include(e => e.FileAnnotations)
                        .ThenInclude(fileAnnotation => fileAnnotation.Annotation)
                    .Where(e => e.Id == file.Id)
                    .FirstOrDefaultAsync();
    
                var filePermissions = await _filePermissionRepository
                    .GetAll()
                    .Where(e => e.FileId == fileId)
                    .ToListAsync();
    
                fileWithAdditionalInfo.FilePermissions = filePermissions;
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @soonjoo,

    I think you are using EntityFramework Core. Query filters are not supported in EF Core yet. We make a workaround for this but it only filters main queries and not Includes.

    Thanks.