I have a linq condition that i include a second table. On the second table i have a where condition to give me records that are not deleted. how ever the where condition is ignored and it returns items that was deleted.
var test= (await table1.GetListAsync(q => q.Where(x => x.Name == command.Name && x.Id == command.Id && x.Deleted==false).Include(x => x.Tables2.Where(y => y.Deleted == false)))).FirstOrDefault();
in the above code table1 where clause executes correctly but the where clause on table 2 returns deleted records.
Table 1 model looks as follows
public class Table1: IdentityModel<string>
{
public string Name { get; set; }
public string Id { get; set; }
public bool Deleted { get; set; }
public IList<Table2> Tables2{ get; set; } = new List<Table2>();
}
What am i doing wrong?