GetAllIncluding contains deleted contents
See original GitHub issueFor example, there are entities,
public class User : Entity
{
public string Name { get; set; }
public List<UserPermission> Permissions { get; set; }
}
public class UserPermission : Entity. ISoftDelete
{
public int UserId { get; set; }
public string Permission { get; set; }
public bool IsDeleted { get; set; }
}
Remove a permission from a user like this,
var perm = _permissionRepo.GetAll().First(p => p.UserId == 2 && p.Permission == "admin");
_permissionRepo.Delete(perm); // let's say perm.Id == 3
CurrentUnitOfWork.SaveChanges();
Now,I get the user and his permissions,but the permissions contains deleted contents
var userAfter = _userRepo.GetAllIncluding(u => u.Permissions).First(u => u.Id == 2);
//permission(3) appears in userAfter.Permissions
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Activate SoftDelete data filter when including collections
GetAllIncluding already filters deleted rows and only gets non-deleted entities (github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/…).
Read more >Repositories | Documentation Center | ABP.IO
Provides DeleteAsync method to delete multiple entities by a filter. Querying / LINQ over the Repositories. Repositories provide the GetQueryableAsync() method ...
Read more >Loading Related Entities - EF6
Eager loading is achieved by use of the Include method. For example, the queries below will load blogs and all the posts related...
Read more >Determining If Entity Is Unique In Repository Pattern
Hello, Using c# and ASP .Net Core 6 I have an N-Tier web application that has implemented a Repository Pattern and Unit of...
Read more >Generic Repository Pattern In ASP.NET Core
This article demonstrates a sample Application, which has one too many relationships in ASP.NET Core with Entity Framework Core.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No repro for both: https://github.com/acjh/aspnetboilerplate/commit/cc50216d084b7f6c09f72a036976dd01053f2df4
Thank you @acjh for the repro.