Finding entities using a query

DbSet and IDbSet implement IQueryable and so can be used as the starting point for writing a LINQ query against the database. This is not the appropriate place for an in-depth discussion of LINQ, but here are a couple of simple examples:

  1. using (var context = new BloggingContext())
  2. {
  3. // Query for all blogs with names starting with B
  4. var blogs = from b in context.Blogs
  5. where b.Name.StartsWith("B")
  6. select b;
  7. // Query for the Blog named ADO.NET Blog
  8. var blog = context.Blogs
  9. .Where(b => b.Name == "ADO.NET Blog")
  10. .FirstOrDefault();
  11. }




تو کد اولی اینجوری متوجه شدم که همون کد اس کیول ای ماست که select کن نام هایی که اولشون با B شروع میشه اما در مورد خط دومی نفهمیدم چی شده !! از این چی میخاد
ADO.NET Blog و این متد به چی اشارهFirstOrDefault میکنه؟