写个文章试试编辑器
Code
public IQueryable<Profile> GetFriends(long userid) {
var ret = (from f1 in DBExt.DB.Friend
join p1 in DBExt.DB.Profile on f1.ToID equals p1.UserID
where f1.FromID == userid
select p1)
.Union(from f1 in DBExt.DB.Friend
join p1 in DBExt.DB.Profile on f1.FromID equals p1.UserID
where f1.ToID == userid
select p1)
.Select(c => new Profile {
UserID = c.UserID,
Name = c.Name,
ShowText = c.ShowText,
ShowTextTime = c.ShowTextTime
});
return ret;
}