There are many LINQ functions that you will need to know in order to be proficient with queries in Entity Framework.
Element operations allow you to select a single row. Sometimes they are enhanced to select null if a row that matches the target condition does not exist. Typically, you would combine element functions with a filter condition, though this is not necessary. As element functions work on sets of data, you will need to construct a query first and then apply an element function. If you are using the method syntax, you can combine both actions into a single statement. If you are using the query syntax, you would need to apply an element function to the entire query. For example, let's select a single record based on the last name of a person, as shown in the following code:
var query = from person in context.People where person.LastName == "Doe" select person; var first = query.First(); var methodQuery = context.People...