Possibility to map bitmask to integer list and filter it
See original GitHub issueHi,
is it possible to map a bitmask to an integer list and make filter operations to it?
[PERSON]
public class Person{
[ExpressionMethod(nameof(MaskToList), IsColumn = true)]
public List<int> PermissionList{ get; set;}
public static Expression<Func<Person, List<int>>> MaskToList(){
return p => new List<int>(){p.Permissions & 1, p.Permissions & 2, p.Permissions & 4};
}
[PERMISSIONS]
public int Permissions{ get; set;}
}
using(var db = new TestDb())
{
var result = db.GetTable<Person>().PermissionList.Contains(2).ToList();
}
This does not work with the given code!
DB-Provider: Firebird 2.1 LingToDb: 2.7.4
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
bit manipulation - How to mask ints using bitwise operators
I was wondering if there is a way to mask a list of int values using bitwise operators, and using that mask to...
Read more >Bitmasks: A very esoteric (and impractical) way of ...
Using a bitmask means to query the bits found in some binary number. If you're confused by that definition, I don't blame you....
Read more >O.3 — Bit manipulation with bitwise operators and bit masks
A bit mask is a predefined set of bits that is used to select which ... Since any non-zero number converts to true...
Read more >Introduction to Bitmasking in SQL Server, Part 2
Let us take a look at bitmasking with integers. We will limit our masking to only two simple operators, the bitwise AND (&)...
Read more >Bitmask Blueprint Variables
Blueprints now support declaring an integer variable as a bitmask. This allows individual mask bits (flags) to be set and unset through the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Franki1986, everything is possible, if you can transform expression tree. I can, but i have not enough time for that. Implement
IExpressionPreprocessor
in your DataConnection class, and you can transform any expression in any parseable expression.I know that this should not be part of this issue, but the DevExtreme team did extend their functionalities for custom filters:
Custom filters
@sdanyliv and @MaceWindu thanks for your help again!!!