Linq to Entity get a Date from DateTime

前端 未结 3 1783
别跟我提以往
别跟我提以往 2021-01-17 17:22

var islemList = (from isl in entities.Islemler where (isl.KayitTarihi.Date >= dbas && isl.KayitTarihi.Value.Date <= dbit) selec

3条回答
  •  不知归路
    2021-01-17 17:58

    The .Date property is not supported in Linq to Entities (though it may be supported in other implementations of Linq).

    I realize that you only want to compare the dates, but there is no real problem with comparing the datetimes if the dbas and dbit values are datetimes with time 00:00:00. You might have to offset the dates or use other inequality checks to get the proper interval but the comparison will work as you intend.

    I would personally go with Jandek's solution.

提交回复
热议问题