Skip to content

ApplyFilter does not work on join statements in LINQ #2549

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

Closed
esabah opened this issue Sep 17, 2020 · 4 comments · Fixed by #2550
Closed

ApplyFilter does not work on join statements in LINQ #2549

esabah opened this issue Sep 17, 2020 · 4 comments · Fixed by #2550

Comments

@esabah
Copy link

esabah commented Sep 17, 2020

Hi
We upgraded NH from 5.2.7 to 5.3.3.
After upgrade we had an issue that ApplyFilter does not work with joins.
Same join statement working fine with version 5.2.7.

You can find testcase implementation below link.
https://github.com/esabah/NHibernateBugTest/blob/master/NHibernateBugTest/TxnDefTest.cs

TxnDefMember entity has a custom filter which applies filter on mbrId field.

ApplyFilter<MemberConditionFilter>();

But mbrId not included in sql query in 5.3.3 version.
(from txndef in session.Query<TxnDef>() join txnDefMember in session.Query<TxnDefMember>() on txndef.Guid equals txnDefMember.Id.TxnDefGuid select txnDefMember.BucketName)

same query returns 8 records in 5.3.3
and returns 4 records in 5.2.7

@bahusoid
Copy link
Member

bahusoid commented Sep 17, 2020

Can you check how it works with latest 5.4 dev build?
https://www.myget.org/feed/nhibernate/package/nuget/NHibernate

@esabah
Copy link
Author

esabah commented Sep 17, 2020

I works correctly with NHibernate 5.4.0-dev.3147.

@bahusoid
Copy link
Member

Good. Thanks for report

@gokhanabatay
Copy link
Contributor

gokhanabatay commented Sep 17, 2020

Would it be better to add Active Filters in HasMany Relations by default? Why do we force adding filters with "ApplyFilter" ?

@bahusoid bahusoid changed the title 5.3.3 upgrade - ApplyFilter does not work on join statements ApplyFilter does not work on join statements in LINQ Sep 17, 2020
@fredericDelaporte fredericDelaporte added this to the 5.3.4 milestone Sep 17, 2020
hazzik pushed a commit that referenced this issue Sep 18, 2020
@hazzik hazzik closed this as completed Sep 18, 2020
bahusoid added a commit to bahusoid/nhibernate-core that referenced this issue Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants