1 Star 2 Fork 0

CaiJinHao/AbpQuickTemplate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
LGPL-3.0

创建项目

Abp Module快速启动模板,基于abp为基础搭建的,所以支持abp的所有功能。后台添加了配合前端使用的代码生成器,支持基础的CRUD生成。前端使用umi + react18 + antd pro v5。

  • 将会同步支持最新abp module 版本,目前最新版本8.0.5

必要安装

dotnet tool install -g Jh.Abp.Cli
dotnet tool install -g dotnet-ef

docker (可选)

# mysql
docker pull mysql8
docker run -d --name mysql8 -p 3306:3306 -v -e MYSQL_ROOT_PASSWORD=Jh@123456 --restart always -t mysql --lower_case_table_names=1
# redis
docker pull redis
docker run -d --name redis  -p 6379:6379  --restart always -t   redis

创建你的项目

# -cs 为数据库连接字符串 数据库支持:MySQL,SQLServer,PostgreSQL,Oracle,OracleDevart,SQLite
jhabp jhnew YourCompanyName.YourProjectName --template module --database-provider ef --connection-string "server=dbserver;database=myDatabase;uid=myUsername;pwd=myPassword" --database-management-system MySQL  -csf 

修改配置

  • 修改你的redis连接配置
  • 修改数据库连接字符串:Default 为Identity的数据库连接字符串;项目名称为你的项目的数据库连接字符串

启动项目

  • 在*.sln目录打开终端,执行 dotnet build 进行构建项目

启动AuthServer

  • 打开终端,并cd 到AuthServer项目目录
  • 执行数据迁移: dotnet ef migrations add initial
  • 执行创建数据库: dotnet ef database update
  • 启动:dotnet run

启动admin

  • 在admin-v5-react 目录执行安装依赖: yarn install
  • 启动: yarn dev
  • 打开地址:https://localhost:44380/ 默认账号:admin 密码:Admin@123

不使用redis

  • 在xxx.xxx.AuthServer.csproj中 删除包 Volo.Abp.Caching.StackExchangeRedis
  • 在xxx.xxx.AuthServer.csproj中 添加包 Volo.Abp.Caching
  • 在IdentityAuthServerModule中 修改Module引用 typeof(AbpCachingStackExchangeRedisModule) =》 typeof(AbpCachingModule)
  • 删除redis连接代码(将下面这段删除)
        var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("YourProjectName");
        if (!hostingEnvironment.IsDevelopment())
        {
            var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
            dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "YourProjectName-Protection-Keys");
        }

不使用https

  • 添加禁用https验证
  PreConfigure<OpenIddictServerBuilder>(builder =>
            {
                //禁用这个 HTTPS 强制要求
                builder.RemoveEventHandler(ValidateTransportSecurityRequirement.Descriptor);
            });
  • 修改你的启动配置launchSettings.json,将https改为http

开始你的业务代码编写

  • 使用思维导图将你的业务逻辑梳理清楚
  • 在Domain中创建你的实体类
    • 在Domain目录创建你的模块文件夹,在文件夹下创建实体文件夹
    • 使用System.ComponentModel.DataAnnotations.Required对你的必填字段进行必填标注
    • 使用System.ComponentModel.Description("描述")对你的属性以及类添加描述,让代码生成器能够生成注释
    • 使用Jh.SourceGenerator.Common.HelpText("字段帮助文本")对你的字段存在的意义进行标注,便于生成前端表单填写时的帮助信息(可选)
    • 使用标识是否显示查询字段
    • 如果Domain类中包含子表,需要添加对子表得集合操作方法:添加(Add)/清空(Clear)/是否存在(IsIn)
  • 使用SourceGeneratorApService_Tests单元测试生成基础代码
    • 修改指定要生成的实体 BaseEnttiys
  • 修改.ConsoleTestApp
    • 修改SourceGeneratorAppService_Tests得BaseEnttiys
    • 修改appsettings.json中得ClientId为Identity中得ClientId
    • 启动测试,生成代码
  • 修改实体数据库映射
    • 对中间表需手动修改映射,并添加数据上下文
    • 索引创建重命名:b.HasIndex(p => new { p.PropertiesId, p.ValidatorRuleId }).IsUnique().HasDatabaseName($"IXU_{nameof(PropertiesValidatorRule)}{nameof(PropertiesValidatorRule.PropertiesId)}{nameof(PropertiesValidatorRule.ValidatorRuleId)}");
    • 联合主键:b.HasKey(p => new { p.PropertiesId, p.ValidatorRuleId });
    • 对HttpApi.Host进行数据库迁移
  • 在Identity种添加Application.Contracts得引用,并添加Module依赖注入。
    • 添加Domain类得字段属性数据初始化
  • 在Identity中添加授权Client
    • 在OpenIddictDataSeed种添加模块Client
    • 启动Swagger,使用网关Client(WebGateway_Swagger)测试API
  • 前端修改
    • 复制生成的文件分别到/src/services 和 /src/pages
    • 在/config/RoutesConfig文件夹下添加模块菜单配置文件
    • 在/config/routes.config中导入新的模块配置
    • 在/src/access.ts 中添加模块主菜单的权限适配
    • 添加菜单中文注释:在自动注入属性中添加前端多语言适配

依赖模块版本升级

  • 在modules目录执行:jhabp jhupdate --nuget -lc -v 8.0.53

支持我,让我提供更有用的

GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

简介

基于Abp构建的快速模板。前端使用react18+antd v5 展开 收起
C#
LGPL-3.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/CaiJinHao/jh-abp-template.git
git@gitee.com:CaiJinHao/jh-abp-template.git
CaiJinHao
jh-abp-template
AbpQuickTemplate
master

搜索帮助

A270a887 8829481 3d7a4017 8829481