In C #, I store the flag enumeration value in the database as a byte. For example, for the following flag enumeration:
[Flags]
public enum Options
{
None = 0,
First = 1,
Second = 2,
Third = 4
}
If I want to write “First” and “Second”, I save this as byte “3” in the “Parameters” field of the record in the database.
So, when using LINQ, how can I check if the value in the "any" database matches the parameters in the argument passed as the "parameter enumeration", something like this pseudocode:
public static Something(Options optionsToMatch)
{
db.MyEntity.Get(a => a.options contains any of the options in optionsToMatch);
source
share