Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 735 Bytes

GCop523.md

File metadata and controls

31 lines (20 loc) · 735 Bytes

GCop 523

"Database search is case insensitive. Simply use {LambdaIdentifier}.{Property} == yourValue for a faster execution."

Rule description

Science the M# database search is case insensitive, there is no need to use string comparer objects which cause lower execution. You can simply use == operator instead.

Example1

Database.GetList<Customer>(s=>s.LastName.Equals("SomeValue", StringComparison.OrdinalIgnoreCase));

should be 🡻

Database.GetList<Customer>(s=>s.LastName == "SomeValue");

Example2

Database.GetList<Customer>(s=>s.LastName.ToLower() == "SomeValue");

should be 🡻

Database.GetList<Customer>(s=>s.LastName == "SomeValue");