Skip to content

Add notin operator - #43

Closed
Siyovush Kadyrov (SYOM29) wants to merge 4 commits into
masterfrom
add-notin-operator
Closed

Siyovush Kadyrov (SYOM29) wants to merge 4 commits into
masterfrom
add-notin-operator

Conversation

@SYOM29

Copy link
Copy Markdown
Contributor

Add NotIn operator.

@cyilcode

Copy link
Copy Markdown
Contributor

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

@SYOM29 Siyovush Kadyrov (SYOM29) linked an issue Mar 19, 2020 that may be closed by this pull request
@SYOM29 Siyovush Kadyrov (SYOM29) added the enhancement New feature or request label Mar 19, 2020
@SYOM29
Siyovush Kadyrov (SYOM29) deleted the add-notin-operator branch December 22, 2021 18:22
@markikordahi

Copy link
Copy Markdown

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
Copy Markdown
Contributor Author

Hi Mark Kordahi (@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

Mark Kordahi (markikordahi) commented Jun 17, 2022 •

Copy link
Copy Markdown

Thanks Siyovush Kadyrov (@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
Copy Markdown
Contributor Author

Mark Kordahi (@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. Arda Develioglu (@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