Created
July 4, 2023 15:59
-
-
Save kemsky/0e5ed603e9812b165130da57daed8026 to your computer and use it in GitHub Desktop.
[Medium] nested specifications problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class ActiveDepartmentSpecification : LinqSpecification<Department> | |
{ | |
public override Expression<Func<Department, bool>> AsExpression() => x => x.Active; | |
} | |
public sealed class UserWithActiveDepartmentSpecification : LinqSpecification<User> | |
{ | |
// see, we can't reuse ActiveDepartmentSpecification here: | |
public override Expression<Func<User, bool>> AsExpression() => x => x.Departments.Any(z => z.Active); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment