Linq Where() not working bitwise operators

2

I'm trying to build an asp.net api using Entity Framework MySql

(IQueryable).where(b=>(((fliter ^ b.BlogStatus) & mask) == 0));

error=System.InvalidOperationException: Unsupported Binary operator type specified.

But EOR(^) doesn't work I couldn't find a solution for this so I decided not to use "EOR"

(IQueryable).where(b=>(((fliter  | b.BlogStatus) & ~(fliter  & b.BlogStatus)) & mask) == 0);
// x^y == (x|y) & ~(x&y)

error=MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT (0 & 'b'.'BlogStatus')) & 7) = 0

But NOT(~) doesn't work I couldn't find a solution for this so I decided not to use "NOT"

(IQueryable).where(b=>(((fliter | b.BlogStatus) & (2147483647-(fliter & b.BlogStatus))&mask)) == 0);
// ~x == 2147483647-x

Surprisingly it works but only locally.

  • Could it be because mariaDb is on the server?
  • How can I get this to work without doing nonsense?
  • Why don't bitwise operators work?

(sorry for my bad english)

c#
asp.net
entity-framework
linq
asked on Stack Overflow Mar 30, 2021 by Atduyar

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0