我怎么能写这个与where子句,其中CreatedDate是在Date1var &Date2var吗?
return _context.Logs.Where(x => x.ApplicationID == applicationId)
.OrderByDescending(x => x.ID)
.Take(count)
.Select(record => new LoggingLogic.entities.Log
{
DataL = record.Data,
LogMessage = record.Message,
CreatedDate = record.CreateDate,
ApplicationName = record.Application.Name,
Environment = record.Application.Environment.EnvironmentName,
ID = record.ID
});
将Where()
更改为Where(x => x.ApplicationID = applicationId && x.CreatedDate >= Date1var && x.CreatedDate <= Date2var)
我假设您想要包含范围
try this
return _context.Logs.Where(x => x.ApplicationID == applicationId && x.CreatedDate >= Date1Var && x.CreatedDate <= Date2Var)
.OrderByDescending(x => x.ID)
.Take(count)
.Select(record => new LoggingLogic.entities.Log
{
DataL = record.Data,
LogMessage = record.Message,
CreatedDate = record.CreateDate,
ApplicationName = record.Application.Name,
Environment = record.Application.Environment.EnvironmentName,
ID = record.ID
});