var lst = from c in db.Blogs join p in db.Posts on c.Id equals p.BlogId where p.Id==1 select c; var lst1 = db.Blogs.Join(db.Posts.Where(p=>p.Id==1), b=> b.Id, p=> p.BlogId, (b, p) => new {b});
public class Blog { public int Id { get; set; } public string Title { get; set; } } public class Post { public int Id { get; set; } public string Title { get; set; } public int BlogId { get; set; } }
时间: 2024-10-06 16:35:25