I have a method which takes an enum flags parameter of items to display. Items in the database can have multiple flags set, and the value passed to the method can also have multiple flags set. Eg:
Item1 = Flag1
Item2 = Flag1 | Flag3
Item3 = Flag2 | Flag3
I want to be able to pass these values to the method and have the corresponding items returned.
- If I pass Flag2 | Flag3, return Item2 and Item3 (Because each flag matches one of the flags set in the entity)
- If I pass Flag1, return Item1 and Item2
...etc. I've been experimenting with .Where and .Any and I still have absolutely no clue how to do this, if it's even possible. I'm targetting .NET 4.5 and using EF5.