-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ExpressionSpecification public #2364
Comments
Hi, Thank you for your suggestion. However, it drops the value of specifications. If you want to pass arbitrary expressions, why not directly using LINQ extensions like |
Actually there is |
internal sealed class ExpressionSpecification : Specification :/ So I can't use it. What I am trying to achieve is something that can dynamically, according to the users role, adjust the filters for each entity in a complex way. It seems my options are to either create separate Services for each user role, and have a core service as the parent. Or I create different specifications, and change them depending on the role of the user, and use an interface to allow the Spec to be DI'ed into the service without and code changes in the service layer. For example, the user want's to edit. But I need to check if they can edit this entity. So I could write a giant if statement inside the serivce layer (CheckCanEdit(Entitiy entity, UserInfo ui) or I can create separate services, and inject the right one depending on the role, or I can do a similar thing, but with specifications. Services represent ACTIONS mainly, taken on entities. The actions can be permitted with AbpAuthorize. The actions between admin and non-admin are basically the same. Who can do it changes. For example, shipments older than 3 days can be edited by an admin, but not by a non-admin. How do you suggest implementing such logic? |
We can make ExpressionSpecification public. I don't remember why it's internal. It was contributed by the community. |
Can someone suggest an answer to my final question please? For example, shipments older than 3 days can be edited by an admin, but not by a non-admin. How do you suggest implementing such logic? |
Specifications are a really great idea. I'd like to use them more extensively.
And it works well, Could you add this constructor to the Specification class? (Sorry I don't have 2017 so I cannot open and edit the project to do a PR)
It allows one to do the following
The text was updated successfully, but these errors were encountered: