Linq to entity时间比较函数

System.Data.Objects.EntityFunctions.DiffDays();
        //

        // 摘要:

        //     调用 DiffDays 规范函数。有关 DiffDays 规范函数的信息,请参见Date and Time Canonical Functions

        //     (Entity SQL)。

        //

        // 参数:

        //   dateValue1:

        //     有效日期。

        //

        //   dateValue2:

        //     有效日期。

        //

        // 返回结果:

        //     dateValue1 和 dateValue2 之间的天数。

        [EdmFunction("Edm", "DiffDays")]

        public static int? DiffDays(DateTime? dateValue1, DateTime? dateValue2);
        public IList<Meeting> GetMeetingListByDate(DateTime startTime)

        {

            return db.Meeting.Where(x => System.Data.Objects.EntityFunctions.DiffDays(x.StartTime, startTime) == 0)

                .OrderByDescending(x => x.StartTime).ToList();

        }

 

你可能感兴趣的:(entity)