Closed Nevca closed 4 years ago
I tried adding support for Enum.HasFlag method to linq2db like follows:
LinqToDB.Linq.Expressions.MapMember((Enum e, Enum e2) => e.HasFlag(e2), (Expression<Func<Enum, Enum, bool>>)((t, flag) => (Sql.ConvertTo<int>.From(t) & Sql.ConvertTo<int>.From(flag)) != 0));
I'm getting the following exception when executing this: Expression of type 'MyEnum' cannot be used for parameter of type 'System.Enum' of method 'Int32 From[Enum](System.Enum)
Expression of type 'MyEnum' cannot be used for parameter of type 'System.Enum' of method 'Int32 From[Enum](System.Enum)
I'm not sure if I'm doing it right or this is a bug.
I tried adding support for Enum.HasFlag method to linq2db like follows:
LinqToDB.Linq.Expressions.MapMember((Enum e, Enum e2) => e.HasFlag(e2), (Expression<Func<Enum, Enum, bool>>)((t, flag) => (Sql.ConvertTo<int>.From(t) & Sql.ConvertTo<int>.From(flag)) != 0));
I'm getting the following exception when executing this:
Expression of type 'MyEnum' cannot be used for parameter of type 'System.Enum' of method 'Int32 From[Enum](System.Enum)
I'm not sure if I'm doing it right or this is a bug.