Jh.Abp.QuickComponents.Application.Contracts

Abp Extension


Keywords
Abp, .Net5, .NetCore, CaiJinHao
License
AGPL-3.0
Install
Install-Package Jh.Abp.QuickComponents.Application.Contracts -Version 1.2.605

Documentation

介绍

该仓库的目的是为了快速开始项目的核心业务而建立,基于Abp vNext框架,会随着Abp框架的最新版本迭代。访问Abp源码;
该仓库包含基础组件:Swagger、MiniProfiler、SameSite、JWT、OIDC、默认使用中文、CRUD基础代码生成(包括HTML,基于Layui/vue.js)
详细使用,可参考Menu模块

UI使用

复制Menu模块下wwwroot文件夹到你的项目wwwroot下

项目快速启动

安装依赖

启动install_package.bat,来安装你的项目依赖项。

代码生成

通过单元测试来生成代码,需要在Domain Class上添加[GeneratorClass]才能被代码生成识别,生成之后记得去除不需要生的[GeneratorClass],否则会覆盖原有的文件

            var basePath = @"G:\Temp\";
            var domainAssembly = typeof(MenuManagement.MenuManagementDomainModule).Assembly;
            var domain = @"\AppSettings";
            var options = new GeneratorOptions()
            {
                DbContext = "EquipmentQuotationAppDbContext",
                Namespace = "EquipmentQuotationApp",
                ControllerBase = "EquipmentQuotationAppController",
                CreateContractsPath = @$"{basePath}trunk\src\SupplyDemandPlatform.Application.Contracts{domain}",
                CreateApplicationPath = @$"{basePath}trunk\src\SupplyDemandPlatform.Application{domain}",
                CreateDomainPath = @$"{basePath}trunk\src\SupplyDemandPlatform.Domain{domain}",
                CreateEfCorePath = @$"{basePath}trunk\src\SupplyDemandPlatform.EntityFrameworkCore{domain}",
                CreateHttpApiPath = @$"{basePath}trunk\src\SupplyDemandPlatform.HttpApi\v1{domain}",
                //不需要domain做文件夹
                CreateHtmlPath = @$"{basePath}trunk\host\SupplyDemandPlatform.Web.Unified\wwwroot\main\view",
                CreateHtmlTemplatePath = @"G:\github\mygithub\Jh.Abp.QuickComponents\src\GeneratorCoding\Jh.SourceGenerator.Common\CodeBuilders\Html\Layui"
            };
            var service = new GeneratorService(domainAssembly, options);
            Assert.True(service.GeneratorCode());

其他使用

其他使用请参照Abp vNext框架

PowerDesigner 生成Class

PowerDesigner 生成Class配置

版本更新

版本更新

启动项目

  1. 执行install_package.bat文件安装依赖包
  2. Copy IdentityServer下的Extensions文件夹到你的IdentityServer下
  3. 修改IdentityServerModule文件
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            PreConfigure<IIdentityServerBuilder>(builder => {
                builder.Services.AddTransient<IObjectAccessor<IUserClaimsPrincipalFactory<IdentityUser>>, ObjectAccessor<JhUserClaimsPrincipalFactory>>();
            });
        }
        context.Services.AddSameSiteCookiePolicy();
        context.Services.AddLocalizationComponent();
        app.UseJhRequestLocalization();
        private void SeedData(ApplicationInitializationContext context)
        {
            AsyncHelper.RunSync(async () =>
            {
                using (var scope = context.ServiceProvider.CreateScope())
                {
                    var data = scope.ServiceProvider
                        .GetRequiredService<IDataSeeder>();
                    var context = new DataSeedContext();
                    context["AdminEmail"] = "531003539@qq.com";
                    context["AdminPassword"] = "CaiJinHao@123456";
                    await data.SeedAsync(context);
                }
            });
        }
  1. 批量修改密码(1q2w3e*),使用区分大小,整个解决方案替换
  2. 更改连接数据库类型
//更改引用
//Volo.Abp.EntityFrameworkCore.SqlServer
Volo.Abp.EntityFrameworkCore.MySQL

            Configure<AbpDbContextOptions>(options =>
            {
                options.UseMySQL();
            });
  1. 执行更新数据库操作、成功后启动项目(数据播种)