Skip to content

NH-3225 - Linq: Add support for bitwise And, Or operators #905

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

Open
nhibernate-bot opened this issue Oct 12, 2017 · 1 comment
Open

NH-3225 - Linq: Add support for bitwise And, Or operators #905

nhibernate-bot opened this issue Oct 12, 2017 · 1 comment

Comments

@nhibernate-bot
Copy link
Collaborator

nhibernate-bot commented Oct 12, 2017

rosieks created an issue — 19th July 2012, 16:05:59:

When I create linq query that use AND operator (&) like below i get InvalidCastException:

session.Query().Where(p => p.Name.Contains("Jo") & p.Address.Contains("War")).ToArray();

My current workaround is to use AndAlso operator (&&).

The issue can be related to NH-2539, because exception is throwed in the same place in AsBooleanExpression method.


rosieks added a comment — 19th July 2012, 16:08:19:

Test case


Alexander Zaytsev added a comment — 19th July 2012, 16:31:30:

What is the reasont to use & operator?


rosieks added a comment — 19th July 2012, 16:48:15:

In my case there was no reason. I just have Filter extension method that dynamically build expression for Where method and it use Expression.And method instead of Expression.AndAlso - that method works great with Entity Framework, but when I use it with NHibernate it doesn't work so I changed it.


Alexander Zaytsev added a comment — 31st October 2016, 20:42:07:

PR is ready for review: #516 The changes for this issue has been removed from the PR


@colewerner
Copy link

@hazzik It appears I'm suffering from this same issue and unfortunately I can't change the code that is producing it. I'm using a 3rd party controls software called SyncFusion and they have a dynamic linq generator that translates query criteria being sent from a vue based javascript grid and they are using the Expression.And to join multiple conditionals in the where clause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants