ASP .NET CORE 连接mysql数据库

项目目录

1. nuget安装Pomelo.EntityFrameworkCore.MySql

2.appsettings添加数据库连接信息 MySQLDbConnectionString

 3.新增继承DbContext类    添加实体类名称

 实体类

 4.在start.up类ConfigureServices中注册服务

 AppConfiguration.cs

 5.在Controller 中使用

 可以获取到数据

页面显示的json数据

原文地址:https://www.cnblogs.com/lixia0604/p/14577831.html