在本文中,空白示例项目(.NET Core 3.1)是连接到Northwind数据库。 数据库结构:
要创建一个项目并将其连接到数据库: 1. 创建一个新项目:
2. 选择DevExpress v20.1 WPFBlank App (.NET Core):
3. 指定项目名称,然后单击创建:
4. 将Microsoft.EntityFrameworkCore.SqlServer和Microsoft.EntityFrameworkCore.Tools NuGet程序包添加到项目中:
Scaffold-DbContext "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Data\Northwind.mdf;Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context NorthwindEntities -Tables "Categories","Customers","CustomerDemographics","Employees","Orders","Order Details","Products","Region","Shippers","Suppliers","Territories"
DevExpress技术交流群2:775869749 欢迎一起进群讨论
|