Simple.Data 小式一刀
private static readonly string SqlDbText = ConfigurationManager.ConnectionStrings["DbText206"].ConnectionString;
public IEnumerable<Test> GetTests()
{
var db = Database.OpenNamedConnection("DbText206");
// Test:表名 All()全部 OrderBy:排序 Id:列名
var query = db.Test.All().OrderById();
var result =new List<Test>();
foreach (var item in query)
{
var test = new Test
{
Id = item.Id,
Age = item.Age,
Name = item.Name
};
result.Add(test);
}
return result;
}
```
定,精,简,俭