question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possibility to map bitmask to integer list and filter it

See original GitHub issue

Hi,

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:open
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
sdanylivcommented, Sep 3, 2019

@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.

0reactions
frankiDotNetcommented, Sep 4, 2019

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!!!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found