基于.NET Core 3.1 网站开发和部署的方法
D:dotnet_coreHotelWebMVC>dotnet sln ./HotelWebMVC.sln add DALDAL.csproj 已将项目“DALDAL.csproj”添加到解决方案中。 D:dotnet_coreHotelWebMVC>dotnet sln ./HotelWebMVC.sln add BLLBLL.csproj 已将项目“BLLBLL.csproj”添加到解决方案中。 D:dotnet_coreHotelWebMVC>dotnet sln list 项目 -- HotelWebMVCHotelWebMVC.csproj ModelsModels.csproj DALDAL.csproj BLLBLL.csproj 添加启动项目和类库项目之间的引用 Models -->DAL D:dotnet_coreHotelWebMVCDAL>dotnet add reference ..ModelsModels.csproj 已将引用“..ModelsModels.csproj”添加到项目。 DAL —> BLL D:dotnet_coreHotelWebMVCDAL>dotnet add ..bllBLL.csproj reference .DAL.csproj 已将引用“..DALDAL.csproj”添加到项目。 HotelWebMVC --> BLL D:dotnet_coreHotelWebMVCDAL>dotnet add ..HotelWebMVCHotelWebMVC.csproj reference ..bllBLL.csproj 已将引用“..bllBLL.csproj”添加到项目。 2.生成Model① 使用EF Core 生成模型 DB First模式 全局安装ef工具 dotnet tool install --global dotnet-ef 测试工具是否安装成功 D:dotnet_coreHotelWebMVC>dotnet ef _/__ ---==http://www.jb51.net/ ___ ___ |. | | __|| __| | ) | _| | _| _/ | //| |___||_| / / Entity Framework Core .NET Command-line Tools 3.1.0 Usage: dotnet ef [options] [command] Options: --version Show version information -h|--help Show help information -v|--verbose Show verbose output. --no-color Don't colorize output. --prefix-output Prefix output with level. Commands: database Commands to manage the database. dbcontext Commands to manage DbContext types. migrations Commands to manage migrations. Use "dotnet ef [command] --help" for more information about a command. 只要看到有这个独角兽就代表安装成功了。 添加需要的NuGet包 dotnet add package Microsoft.EntityFrameworkCore.Design dotnet add package Pomelo.EntityFrameworkCore.MySql 使用EF工具 查看帮助 (编辑:帝国网站管理系统) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |