ABP.Net Core使用教程(一)启动模版项目

1,下载ABP模版:基于.NetCore的Vue或者Anjular单页面应用

https://aspnetboilerplate.com/

2,用VS2017打开解决方案

3,修改数据库连接,只要用户名和密码对就可以,ABP会自动建库

如果使用MySQL,请看步骤4,步骤5

如果使用默认的SQL Server,跳过步骤4,步骤5

"ConnectionStrings": {
  "Default": "Server=localhost; Database=AbpDemoDb; Uid=root; Pwd=123456;"
}

4,修改为使用MySQL:在XXX.EntityFrameworkCore层用Nuget安装添加Pomelo.EntityFrameworkCore.MySql

5,修改 XXXDbContextConfigurer类的数据库连接配置

namespace AbpDemo.EntityFrameworkCore
{
    public static class AbpDemoDbContextConfigurer
    {
        public static void Configure(DbContextOptionsBuilder<AbpDemoDbContext> builder, string connectionString)
        {
            //builder.UseSqlServer(connectionString);
            builder.UseMySql(connectionString);
        }

        public static void Configure(DbContextOptionsBuilder<AbpDemoDbContext> builder, DbConnection connection)
        {
            //builder.UseSqlServer(connection);
            builder.UseMySql(connection);
        }
    }
}

6,数据迁移

7,运行项目

猜你喜欢

转载自www.cnblogs.com/zheyiw/p/9888327.html