惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
The Hacker News
The Hacker News
D
Docker
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
罗磊的独立博客
A
Arctic Wolf
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
Spread Privacy
Spread Privacy
B
Blog
A
About on SuperTechFans
L
LINUX DO - 最新话题
博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
W
WeLiveSecurity
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
T
The Exploit Database - CXSecurity.com
美团技术团队
J
Java Code Geeks
Cloudbric
Cloudbric
雷峰网
雷峰网
Vercel News
Vercel News
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
G
Google Developers Blog
T
Tenable Blog
PCI Perspectives
PCI Perspectives
Engineering at Meta
Engineering at Meta
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Hackread – Cybersecurity News, Data Breaches, AI and More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
C
Cybersecurity and Infrastructure Security Agency CISA
S
Secure Thoughts
N
News and Events Feed by Topic
GbyAI
GbyAI
S
SegmentFault 最新的问题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

博客园 - aquilahkj

在Flutter中使用极光推送集成华为通道踩坑 Flutter中生成Android的jks签名文件并使用 实现ElementUI Dialog宽度响应式变化 使用Vue Baidu Map对百度地图实现输入框搜索定位 在dotnet core实现类似crontab的定时任务 使用Docker搭建HttpRunnerManager环境 docker搭建nginx反代ngrok服务 - aquilahkj 开源一个基于dotnet standard的轻量级的ORM框架-Light.Data VMware Fusion下安装Win8启用Hyper-V centos下安装rinetd(转载) 在Mac OS X上安装JavaHL SVN数据仓库配置 在MONO下实现WCF所遇到的问题 mysql 创建 主键索引 唯一索引 全文索引 多列索引 添加索引 CentOS 6.0 安装 MONO 2.10.8 关于MYSQL 远程登录的授权方法 命令 CentOS 6.0 编译安装 MySQL 5.5.17 linux下允许root用户远程登录 Linux Vi命令
ABP Vnext使用mysql数据库
aquilahkj · 2020-08-16 · via 博客园 - aquilahkj

ABP Vnext支持Sqlserver、Mysql、PostgreSql等数据库,通过CLI模板建立的项目默认使用SqlServer,需要进行一定变更才支持其他数据库,下面以使用Mysql举例

1. 使用CLI建立一个带UI的MVC项目

abp new Acme.BookStoreUi --template app --database-provider ef --ui mvc --mobile none

建立后项目如下

2. 使用Nuget安装支持Mysql的包并对代码进行修改

  • 在EntityFrameworkCore项目里移除Volo.Abp.EntityFrameworkCore.SqlServer包
  • 在EntityFrameworkCore项目里新增Volo.Abp.EntityFrameworkCore.Mysql包
  • 修复因移除SqlServer包而报错的代码,把SqlServer改为Mysql

  如下

using Volo.Abp.EntityFrameworkCore.SqlServer

using Volo.Abp.EntityFrameworkCore.MySQL;


typeof(AbpEntityFrameworkCoreSqlServerModule)

typeof(AbpEntityFrameworkCoreMySQLModule)


options.UseSqlServer();

options.UseMySQL();

3. 修改Acme.BookStoreUi.DbMigrations项目下appsetting.json文件中的ConnectionStrings,修改为mysql数据库连接字符串,并复制进Acme.BookStoreUi.EntityFrameworkCore.DbMigrations项目。

4. 重建DbMigrations

首先,删掉Acme.BookStoreUi.EntityFrameworkCore.DbMigrations下原有的Migrations文件夹,重建Migrations,我使用EF CLI方式重建

终端进入Acme.BookStoreUi.EntityFrameworkCore.DbMigrations,新建Migrations

dotnet ef migrations add initialDB

更新至数据库

dotnet ef database update initialDB

运行Acme.BookStoreUi.DbMigrations项目初始化数据。

5.Acme.BookStoreUi.Web项目同样修改appsetting.json文件中的ConnectionStrings,运行即可