public void WhereWithRelatedEntities2()
{
MySqlDataAdapter da = new MySqlDataAdapter(
@"SELECT c.* FROM Toys t LEFT JOIN Companies c ON c.Id=t.SupplierId
WHERE c.State<>'TX' AND c.State<>'AZ'", conn);
DataTable dt = new DataTable();
da.Fill(dt);
using (testEntities context = new testEntities())
{
string sql = @"SELECT VALUE t FROM Toys AS t
WHERE t.Supplier.Address.State<>'TX' AND t.Supplier.Address.State <> 'AZ'";
ObjectQuery<Toy> query = context.CreateQuery<Toy>(sql);
int i = 0;
foreach (Toy t in query)
{
Assert.AreEqual(dt.Rows[i++]["id"], t.Id);
}
}
}