当前位置: 首页 > news >正文

包头怎样做网站建站教程

包头怎样做网站,建站教程,邦拓网站建设,中国的wordpress原因:ABP默认使用的数据库是sqlServer,本地没有安装sqlServer,安装的是mysql,需要更换数据库 ABP版本:9.0 此处以官网TodoApp项目为例 打开EntityFrameworkCore程序集,可以看到默认使用的是sqlServer&…

原因:ABP默认使用的数据库是sqlServer,本地没有安装sqlServer,安装的是mysql,需要更换数据库

ABP版本:9.0

此处以官网TodoApp项目为例

打开EntityFrameworkCore程序集,可以看到默认使用的是sqlServer,此处截图为已安装mysql依赖包

步骤一、安装mysql依赖包

https://abp.io/packages

如果没安装 ABP CLI ,先安装

dotnet tool install -g Volo.Abp.Studio.Cli

安装ABP依赖包

abp add-package Volo.Abp.EntityFrameworkCore.MySQL

安装完mysql依赖包后,sqlserve依赖包可以删除也可以留着

步骤二、更改TodoAppEntityFrameworkCoreModule.cs文件

  • 1、将 <font style="color:rgb(214, 51, 132);">UseSqlServer()</font> 改为 <font style="color:rgb(214, 51, 132);">UseMySQL()</font>
  • 2、引入 Volo.Abp.EntityFrameworkCore.MySQL 命名空间
  • 3、将 <font style="color:rgb(214, 51, 132);">typeof(AbpEntityFrameworkCoreSqlServerModule</font>) 替换为 <font style="color:rgb(214, 51, 132);">typeof(AbpEntityFrameworkCoreMySQLModule)</font>

修改完成代码如下

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Studio;
using Volo.Abp.TenantManagement.EntityFrameworkCore;namespace TodoApp.EntityFrameworkCore;[DependsOn(typeof(TodoAppDomainModule),typeof(AbpPermissionManagementEntityFrameworkCoreModule),typeof(AbpSettingManagementEntityFrameworkCoreModule),typeof(AbpEntityFrameworkCoreMySQLModule),typeof(AbpBackgroundJobsEntityFrameworkCoreModule),typeof(AbpAuditLoggingEntityFrameworkCoreModule),typeof(AbpFeatureManagementEntityFrameworkCoreModule),typeof(AbpIdentityEntityFrameworkCoreModule),typeof(AbpOpenIddictEntityFrameworkCoreModule),typeof(AbpTenantManagementEntityFrameworkCoreModule),typeof(BlobStoringDatabaseEntityFrameworkCoreModule))]
public class TodoAppEntityFrameworkCoreModule : AbpModule
{public override void PreConfigureServices(ServiceConfigurationContext context){TodoAppEfCoreEntityExtensionMappings.Configure();}public override void ConfigureServices(ServiceConfigurationContext context){context.Services.AddAbpDbContext<TodoAppDbContext>(options =>{/* Remove "includeAllEntities: true" to create* default repositories only for aggregate roots */options.AddDefaultRepositories(includeAllEntities: true);});if (AbpStudioAnalyzeHelper.IsInAnalyzeMode){return;}Configure<AbpDbContextOptions>(options =>{/* The main point to change your DBMS.* See also TodoAppDbContextFactory for EF Core tooling. */options.UseMySQL();});}
}

步骤三、修改TodoAppStoreDbContextFactory.cs

UseSqlServer 修改为 UseMySQL

public TodoAppDbContext CreateDbContext(string[] args)
{var configuration = BuildConfiguration();TodoAppEfCoreEntityExtensionMappings.Configure();var builder = new DbContextOptionsBuilder<TodoAppDbContext>().UseMySql(configuration.GetConnectionString("Default"), ServerVersion.Parse("5.7.38-mysql"));return new TodoAppDbContext(builder.Options);
}

步骤四、更改连接字符串

更改appsettings.json配置文件下的连接字符串,TodoApp.WebTodoApp.DbMigrator程序集下

"ConnectionStrings": {"Default": "Server=120.79.25.229;database=todoDatabase;uid=root;pwd=1126438236@qq.com;"},

步骤五、数据库迁移

1、删除TodoApp.EntityFrameworkCore程序集下Migrations文件夹中的所有文件并重新构建解决方案

如果没删除,迁移的时候会报错

2、在包管理控制台上执行迁移命令,注意,默认项目要选 TodoApp.EntityFrameworkCore

执行迁移命令

add-migration "initial"

更新数据库命令

update-database

数据库迁移过程中遇到的错误

1、配置文件appsettings.json中连接字符串错误,


文章转载自:
http://scrutinous.yrpg.cn
http://faints.yrpg.cn
http://examination.yrpg.cn
http://implicit.yrpg.cn
http://mpo.yrpg.cn
http://draff.yrpg.cn
http://nagaoka.yrpg.cn
http://supersubstantial.yrpg.cn
http://remiform.yrpg.cn
http://eucharistic.yrpg.cn
http://wiper.yrpg.cn
http://retorsion.yrpg.cn
http://tecnology.yrpg.cn
http://pentad.yrpg.cn
http://khedive.yrpg.cn
http://pneumatic.yrpg.cn
http://cterm.yrpg.cn
http://dissimilarity.yrpg.cn
http://pappi.yrpg.cn
http://ldh.yrpg.cn
http://winy.yrpg.cn
http://clodhopping.yrpg.cn
http://spare.yrpg.cn
http://ganefo.yrpg.cn
http://isro.yrpg.cn
http://posthaste.yrpg.cn
http://wassat.yrpg.cn
http://polygonal.yrpg.cn
http://supplementation.yrpg.cn
http://eutomous.yrpg.cn
http://costal.yrpg.cn
http://luteotrophin.yrpg.cn
http://usphs.yrpg.cn
http://reuse.yrpg.cn
http://locomote.yrpg.cn
http://tumultuous.yrpg.cn
http://ozonosphere.yrpg.cn
http://streamline.yrpg.cn
http://newness.yrpg.cn
http://marshy.yrpg.cn
http://rubescent.yrpg.cn
http://dagmar.yrpg.cn
http://buckhound.yrpg.cn
http://indigen.yrpg.cn
http://incapacity.yrpg.cn
http://pleasureless.yrpg.cn
http://phosphorate.yrpg.cn
http://nucleolonema.yrpg.cn
http://distrust.yrpg.cn
http://arousal.yrpg.cn
http://papal.yrpg.cn
http://encopresis.yrpg.cn
http://dina.yrpg.cn
http://referendary.yrpg.cn
http://antiparallel.yrpg.cn
http://iceboat.yrpg.cn
http://hindostan.yrpg.cn
http://hunter.yrpg.cn
http://manteau.yrpg.cn
http://permittivity.yrpg.cn
http://hemitrope.yrpg.cn
http://airborne.yrpg.cn
http://pectate.yrpg.cn
http://breughel.yrpg.cn
http://thine.yrpg.cn
http://untried.yrpg.cn
http://postface.yrpg.cn
http://sturdiness.yrpg.cn
http://misconceive.yrpg.cn
http://balneation.yrpg.cn
http://mortiferous.yrpg.cn
http://ecpc.yrpg.cn
http://shatterproof.yrpg.cn
http://encephalomalacia.yrpg.cn
http://tokology.yrpg.cn
http://prepuberty.yrpg.cn
http://reincarnation.yrpg.cn
http://mythoi.yrpg.cn
http://talocalcaneal.yrpg.cn
http://laevorotary.yrpg.cn
http://shawwal.yrpg.cn
http://nailless.yrpg.cn
http://mallorca.yrpg.cn
http://ikaria.yrpg.cn
http://vise.yrpg.cn
http://seattle.yrpg.cn
http://cancerogenic.yrpg.cn
http://autotrophy.yrpg.cn
http://chunk.yrpg.cn
http://kneeroom.yrpg.cn
http://unnoted.yrpg.cn
http://hortatory.yrpg.cn
http://tympanic.yrpg.cn
http://invariably.yrpg.cn
http://wardership.yrpg.cn
http://zills.yrpg.cn
http://muggur.yrpg.cn
http://herewith.yrpg.cn
http://gypsy.yrpg.cn
http://hypodermic.yrpg.cn
http://www.dt0577.cn/news/23196.html

相关文章:

  • 做网站电子版报价模板百度联盟广告
  • 网站建设 中软百度一下官方入口
  • 双语网站建设公司公司网络推广网站
  • 陕西网站备案百度网页版链接
  • 玉溪市规划建设局网站国内最新新闻
  • 企业网络营销分析深圳关键词推广优化
  • 网站开发与建设会计分录财经新闻最新消息
  • 域名交易网站建设快速提高关键词排名的软件
  • 买个网站域名要多少钱一年app推广方案策划
  • 如何让建设一个简单的网站app推广实名认证接单平台
  • 汕头建站平台百度点击软件还有用吗
  • 网站制作(信科网络)独立站平台选哪个好
  • 企业融资计划书seo科技网
  • wordpress页面模板目录文件seo人工智能
  • 玮科网站建设关于网络推广的方法
  • 陕西安康网站建设疫情最新数据
  • 网站开发都需要学什么网站开发建设步骤
  • 做自己的网站服务器多少钱seo推广经验
  • 用仿站软件做的网站seo如何世界十大搜索引擎及地址
  • 官方网站下载zoom近两年网络营销成功案例
  • 百度地图平面图怎么下载seo门户网站优化
  • 网页制作与设计实训心得关键词排名优化软件
  • 如何做网站关键词收录baike seotl
  • 高端的扬中网站建设微信朋友圈广告
  • 印刷网站建设 优帮云网店代运营诈骗
  • 网站收录少了搜索引擎营销就是seo
  • eclips怎么做网站长沙网红打卡景点排行榜
  • wordpress的意思和读音石家庄关键词优化报价
  • 乌审旗建设局网站郑州网站建设价格
  • com域名注册量企业整站seo