Steps for a beginner to run very basic linq to sql query using Linqpad

前端 未结 4 1956
长情又很酷
长情又很酷 2021-02-04 04:36

Trying to learn Linq using LinqPad and getting frustated with how to start on it. Let\'s say I want to write a C# Expression and a C# statment where I have a table in SQL server

4条回答
  •  我在风中等你
    2021-02-04 05:09

    var db = new MyDatabaseContext();  // Your database context.
    var result = db.Products.Where(q=>q.Price > 50);
    

    ...where db represents your ORM context. Price represents your mapping to the Price field in the database. result represents the result set -- your database rows/entities.

提交回复
热议问题