【EF Core】EF.Functions
EF.Functions是EF Core提供的函数功能,如下
using Microsoft.EntityFrameworkCore;
EF.Functions.Like();
EF.Functions.Contains();
EF.Functions.DateDiffDay();
EF.Functions.DateDiffHour();
EF.Functions.DateDiffMinute();
EF.Functions.DateDiffMonth();
EF.Functions.DateDiffSecond();
EF.Functions.DateDiffYear();
EF.Functions.IsDate();
例子:
using Microsoft.EntityFrameworkCore;
public void GetUserinfo()
{
_dbContext.UserInfos.Where(c => EF.Functions.Like(c.UserName, "%风%")).ToList();
}