10/9/2015 2:59:44 PM

Create a left join using Microsoft Entity Framework (EF). The query below is used to return a list of users without friends.

var query = from users in myDbContext.Users
			join userFriends in myDbContext.UserFriends on users.Id equals userFriends.UserId into myJoinedTable
			from leftJoin in myJoinedTable.DefaultIfEmpty()

			where leftJoin.Id == null

			select users;

allUsers = query.ToList();