Home > Back-end >  Dynamic LINQ Any() is Returning Invalid Results
Dynamic LINQ Any() is Returning Invalid Results

Time:09-08

Problem Setup

I'm attempting to implement validation rules into my app using the enter image description here

CodePudding user response:

So, after many hours of trying different solutions to see where exactly it was failing, nothing worked, until I changed the expression to use Equals(). Instantly worked after that, and I'm not sure why this: (StageText.Equals("Closed")); works and this: (StageText == "Closed"); doesn't.

I'm still baffled why the original way worked when I tested it in LINQPad but not in the app. @Stef also confirmed it works, so I'm confused. Maybe it has something to do with the snapshot values being pulled from the database, or the validation rule expressions also being pulled from the database?

Anyway, it works with Equals() so I'm rolling with it.

  • Related