Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 571 Bytes

File metadata and controls

19 lines (12 loc) · 571 Bytes

GCop 306

"Instead use {< Or > Or <= Or >= Or > and < } so it can be converted into a SQL statement and run faster"

Rule description

Some extension methods on DateTime such as IsBefore(...) and IsBetween(...) are not recognized by the LINQ to SQL converter in the database engine. So you should write the simpler alternatives using standard operators instead.

Example

Database.GetList<LogonFailure>(f => f.Date.IsBefore(someDate));

should be 🡻

Database.GetList<LogonFailure>(f => f.Date < someDate);