我们将数据存放在数据库中,数据表的结构,我们通常会用一个类来抽象,表的属性就是类的属性,我们通常将表的一行存储在一个类中。
在Java中,通常将其称为实体类Entity,在C#中,通常将其称为Model。
这里使用的是Region表中的数据
![](https://img2020.cnblogs.com/blog/911540/202005/911540-20200502111044055-1875890829.png)
在Model类库中增加类Region
![](https://img2020.cnblogs.com/blog/911540/202005/911540-20200502112943744-1028270811.png)
代码如下
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Northwind.Model { public class Region { public int RegionID { get; set; } public string RegionDescription { get; set; } } }