using DbFunctions = System.Data.Entity.DbFunctions;
Using the above namespace I tried below ways but nothing worked. This code is throwing an exception which states...
public async Task<int> SomeFunction(){
var count = await _context.Drives.CountAsync(c => DbFunctions.TruncateTime(c.CreatedOn) == DateTime.Today);
var count1 = await _context.Drives.Where(c => DbFunctions.TruncateTime(c.CreatedOn) == DateTime.Today).CountAsync();
var data = _context.Drives.Where(c => !c.IsDeleted).ToList();
//This throw an exception
// "This function can only be invoked from LINQ to Entities."
var count2 = data.Count(x=> DbFunctions.TruncateTime(c.CreatedOn) == DateTime.Today)
}
The LINQ expression 'DbSet().Where(d => DbFunctions.TruncateTime((Nullable)d.CreatedOn) == (Nullable)DateTime.Today)' could not be translated
Can someone help me out how can I compare two dates (only date not with time) in LINQ and Entity Framework?