I have a table called Employee. Some of the fields in the table are CompanyId, SomeData
I want to query the Min SomeDate based on a companyId.
Something like this:
public DateTime? GetMinDateForCompany(long CompanyId)
{
dataContext.Employees.Where(emp => emp.CompanyID == companyId).Select(emp => emp.SomeDate).Min();
}
If there is no matching companyId, would it throw an exception. Is there a possibility that null could be returned. In general when would nulls be returned for a LINQ-to-SQL query.