Skip to content
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

Add notin operator #43

Closed
wants to merge 4 commits into from
Closed

Add notin operator #43

wants to merge 4 commits into from

Conversation

SYOM29
Copy link
Member

@SYOM29 SYOM29 commented Mar 19, 2020

Add NotIn operator.

@cyilcode
Copy link
Member

While we are at it, i think we might as well add an integration test to this feature as well.

@SYOM29 SYOM29 linked an issue Mar 19, 2020 that may be closed by this pull request
@SYOM29 SYOM29 added the enhancement New feature or request label Mar 19, 2020
@SYOM29 SYOM29 requested a review from cyilcode October 3, 2020 16:24
@SYOM29 SYOM29 closed this Dec 22, 2021
@SYOM29 SYOM29 deleted the add-notin-operator branch December 22, 2021 18:22
@markikordahi
Copy link

Hi! I'm wondering why NotIn operator was not merged in master branch ?
also with both In and NotIn opperand, what is the right way to pass value?

new Filter
        {
            Value = "bar",
            PropertyName = ["foo", "foo2"],
            Operator = FilterOperation.In
        }

@SYOM29
Copy link
Member Author

SYOM29 commented Jun 17, 2022

Hi @markikordahi. The NotIn implementation given in that pr was not correct. It was performing the notContains function instead of NotIn. That is the reason I closed the pr. Consecutively I could not find the time to address this.

For the other question, the usage of In operator is as follows:

new Filter
{
Value = "Te, Test, Testx",
PropertyName = "Name",
Operator = FilterOperation.In,
CaseSensitive = caseSensitive
}

The filter given above should generate the following query:
"(((x.Name == "Te") Or (x.Name == " Test")) Or (x.Name == " Testx"))"

or if case sensitivity is set to false:

"(((x.Name.ToLower() == "te".ToLower()) Or (x.Name.ToLower() == " test".ToLower())) Or (x.Name.ToLower() == " testx".ToLower()))"

Whenever in doubt about how the DQB will perform on a certain operation you can check our unit tests. The example I gave is from BuildFilterExpressionTests.cs ShouldConvertInOperationToMultipleEquals test case.

Hope this helps.

@markikordahi
Copy link

markikordahi commented Jun 17, 2022

Thanks @SYOM29 for your quick response.
I was expecting the in operand to generate something like (new[]{"te","Test","Testx"}.Contains(x.Name)) which should end up generating the SQL IN query.
thus for notIn to generate !(new[]{"te","Test","Testx"}.Contains(x.Name))

let me know if I'm missing anything? I would be happy to contribute with a PR

@SYOM29
Copy link
Member Author

SYOM29 commented Jun 17, 2022

@markikordahi I don't know the reason behind the initial design. The solution you are proposing seems feasible to me, but it needs to be tested out.

In terms of pr, I don't know who is in charge of managing this repository at this moment. @ardadevelioglu Can you assign someone to overview DQB? I can review it, no problem, only so that someone in the current team knows what is going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support For NotIn Operator
3 participants