Using DateTime in Dynamic LINQ to Entities

前端 未结 4 1045
醉梦人生
醉梦人生 2021-01-05 09:34

I am using LINQ to Entities to retrieve item purchase dates as follows:

where EntityFunctions.TruncateTime(order.PurchaseDate) == myPurchaseDate.date
         


        
4条回答
  •  天命终不由人
    2021-01-05 10:03

    I think you are going to want to go with the date range so that you can take advantage of indexing on the server if you need to. If you base your select statement on a calculated field, it will need to scan the table for each query.

提交回复
热议问题