因此,我在LinQ中具有此属性以进行实体查询,并且需要向其中添加天数
isWithinNinetyDays = (a.ParcelData == null ? false :
(a.ParcelData.Parcel_LetterTracking == null ? false :
(a.ParcelData.Parcel_LetterTracking.LMailDate == null ? false :
(System.Data.Entity.DbFunctions.AddDays(a.DateTimeEntry, 90) >= a.ParcelData.Parcel_LetterTracking.LMailDate.Value)))),
问题是我不想使用“ System.Data.Entity.DbFunctions.AddDays(a.DateTimeEntry,90)”,因为我将不得不做很多事情,并且编写它是如此丑陋每次...有可能做一个我可以打电话给的分机
a.DateTimeEntry.MyExtension(90)
that will add 90 days and be able to convert it to a entity convertable to sql object?
使用using
别名。
using DB = System.Data.Entity.DbFunctions;
DB.AddDays(a.DateTimeEntry, 90) ...