示例#1
0
 public IEnumerable <Kitten> GetFluffyKittens()
 {
     using (var db = new KittenEntities()){ // db can also be injected,
         return(db.Kittens                  // this explicit query is here
                .Where(kitten => kitten.fluffiness > 10)
                .Select(kitten => new {
             Name = kitten.name,
             Url = kitten.imageUrl
         }).Take(10));
     }
 }
示例#2
0
 public IEnumerable <Kitten> GetLatestKittens(int fluffinessIndex = 10)
 {
     using (var db = new KittenEntities())
     {
         return(db.Kittens // this explicit query is here
                .Where(kitten => kitten.fluffiness > 10)
                .Select(kitten => new {
             Name = kitten.name,
             Url = kitten.imageUrl
         }).Take(10));
     }
 }