public static UserProfile GetProfileByUserID(Guid userId)
{
using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
return (from u in _db.membership_Users
join ud1 in _db.carrot_UserDatas on u.Id equals ud1.UserKey into ud2
from ud in ud2.DefaultIfEmpty()
where ud.UserId == userId
select new UserProfile(u, ud)).FirstOrDefault();
}
}