Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for bitwise operators on enums #164

Open
juice-ontour opened this issue Sep 9, 2024 · 0 comments
Open

Support for bitwise operators on enums #164

juice-ontour opened this issue Sep 9, 2024 · 0 comments

Comments

@juice-ontour
Copy link

Let's say I have an enum that represents flags:

[Flags]
public enum IdentityFlag
{
  Flag01 = 1,
  Flag02 = 2,
  Flag03 = 4
}

It would be nice to be able to set the flags on update, like:

await _context.Identities
  .Upsert(identity)
  .On(x => x.Identifier)
  .WhenMatched((cDb, cIns) => new Identity 
  {
    Name = cIns.Name,
    Flags = (cDb.Flags | cIns.Flags) & flagsToReset
  })
  .RunAsync();

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant