Entity Framework can save you a lot of time when developing data operations in your application. I am going to demonstrate some techniques to use calculated fields to filter or constrain your results in a LINQ to Entity query.
Before we get started, we’ll use a simple example of a Contact entity that has one or more Address entities associated with it:
public class Contact
{
public int ContactId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime Birthday { get; set; }
public List<Address> Addresses { get; set; }
}
public class Address
{
public int ContactId { ...