I have this linq query:
string appuserid = (from c in db.AppUsers
where (c.AppUserID == AppUserId)
select c.AppUserID).Single().ToString();
Lets say testuser1 does not exist in the db
If I let AppUserId = testuser1
I get:
System.InvalidOperationException.
My question is, is there anyway to rewrite this query to avoid this error and perhaps return an empty string or let it be null? I need to return something that I can write some logic around.