I tried on two ways to choose to date only from the date frame but still, I get the wrong result. I saw another post but the response doesn't work for me. Please help mine.
List<Measurement> measurementsForTemplate = await databaseCommandContext.CreateSet<Measurement>()
.Include(v => v.MeasuredValues)
.Where(x => x.MeasurementFormTemplateId == command.TemplateId )
.Where(v => v.MeasuredValues.Any(d => d.Time >= command.FromDate))
.Where(v => v.MeasuredValues.Any(d => d.Time <= command.ToDate)).ToListAsync(cancellationToken);
Or I created an object without filtering in the above query and then
var measurementsForTemplateDateLimit = measurementsForTemplate.Where(b => b.MeasuredValues
.Any(d => d.Time >= command.FromDate && d.Time <= command.ToDate)).Select(b => b);
See Question&Answers more detail:os