Kros-sk / Kros.KORM

Simple and fast micro-ORM framework for .NET.
MIT License
9 stars 16 forks source link

Order by nullable column #90

Closed ML13 closed 2 years ago

ML13 commented 2 years ago

Library name and version

Description

Ordering by nullable datetime column caused exception, because query was incorrectly translate into SQL query. IIF(($it.DueDate == null), null, $it.DueDate) was transled as (DueDate IS NULL)NULLDueData in function Kros.KORM.Query.Sql.DefaultQuerySqlGenerator.VisitOrderBy MicrosoftTeams-image (7)

Steps To Reproduce

  1. Set up one column as DateTime?
  2. Order by this column

Expected behavior

IIF(($it.DueDate == null), null, $it.DueDate) will be transled as `IIF((DueDate IS NULL),NULL,DueData)

Actual behavior

Trown exception: Microsoft.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'IS'.'