Many-to-many with class for join entity EF
I'm facing an issue with implementing soft deletes in a custom many-to-many relationship class. I've created a custom class to handle the relationship, but I'm struggling to figure out how to modify the repository's get method to only fetch entities where the relationship's DeletedAt is not null.
10 Replies
It's cs and not C# for the coloration highlights
You also should show you repo methods
I managed to implement soft deletes in the other repositories; they fill the deletedAt field in the RolePermissions class as expected. My issue lies solely in retrieving the Roles with permissions where the association has been deleted.
What is DeletedAt a bool or object or something else?
Likely a nullable DateTime
a ofc thanks
yep
So why are you trying to get the roles that have a Deletedaat value here?
Wait no
Brain farted
:KEK: I'm eepy
What is the result you have with your current code
:kekw:
It returns the permissions where I deleted the relationship using soft delete.
Oh but you are going through Permissions instead of RolePermissions
I think you need to include RolePermissions.Where(blabla is not null)
And then to use the ThenInclude(RP.Roles)
word up
I'll test it out
Thank you, the problem has been solved, now I just need to solve some mapping problems