LINQ DefaultIfEmpty(), generating inferred argument error
- by Refracted Paladin
I am trying to get the below linq query to return -1 if there isn't any current value.  I was looking at this article on MSDN, here, and it seemed that DefaultIfEmpty() was what I wanted.
Unfortunately, I am getting a The type arguments cannot be inferred from the usage.  Try specifying the type arguments explicitly. error.
I guess I am not sure what that means or what it is telling me to do.  Can someone explain, please.
 public static int CheckForDRIID(int personID)
    {
        using (var context = ConnectDataContext.Create())
        {
            var masterIndex =
                (from applicationAssociation in context.tblApplicationAssociations
                 where applicationAssociation.ApplicationID == 1 && applicationAssociation.PersonID == personID
                 select applicationAssociation.PersonApplicationID).DefaultIfEmpty(-1).Single();
            return Convert.ToInt32(masterIndex);
        }
    }