Just use FirstOrDefault()instead:
return (from a in dc.Applications
where a.UserId == userId && a.chr_Version == version
select a).FirstOrDefault<Application>();
SingleOrDefault()will throw an exception if there is more than one record, FirstOrDefault()will just accept the first.
You also do not need to specify Application- your entry already has a type Application.
source
share