【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();
}
posted @ 2022-05-18 21:08  .Neterr  阅读(866)  评论(0编辑  收藏  举报