首页 > 代码库 > LINQ TO ENTITY 根据Birthday获取Age

LINQ TO ENTITY 根据Birthday获取Age

from emp in EmployeeInfolet years = EntityFunctions.DiffYears(emp.Birthday.Value,DateTime.Now)let birthdayThisYear = EntityFunctions.AddYears(emp.Birthday.Value,years)select new {   Age = birthdayThisYear > DateTime.Now ? years - 1 : years}