chore: 构建稳定版本

This commit is contained in:
陈淳
2023-12-11 09:55:12 +08:00
parent 098d4bc85f
commit 769a6a9c63
756 changed files with 10431 additions and 19867 deletions

123
.gitignore vendored
View File

@@ -1,14 +1,7 @@
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
dist/
appsettings.Production.json
appsettings.Development.json
wwwroot
# User-specific files # User-specific files
*.rsuser
*.suo *.suo
*.user *.user
*.userosscache *.userosscache
@@ -24,21 +17,16 @@ wwwroot
[Rr]eleases/ [Rr]eleases/
x64/ x64/
x86/ x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/ bld/
[Bb]in/ [Bb]in/
[Oo]bj/ [Oo]bj/
[Ll]og/ [Ll]og/
# Visual Studio 2015/2017 cache/options directory # Visual Studio 2015 cache/options directory
.vs/ .vs/
# Uncomment if you have tasks that create the project's static files in wwwroot # Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/ #wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results # MSTest test Results
[Tt]est[Rr]esult*/ [Tt]est[Rr]esult*/
[Bb]uild[Ll]og.* [Bb]uild[Ll]og.*
@@ -52,28 +40,18 @@ TestResult.xml
[Rr]eleasePS/ [Rr]eleasePS/
dlldata.c dlldata.c
# Benchmark Results # DNX
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json project.lock.json
project.fragment.lock.json
artifacts/ artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c *_i.c
*_p.c *_p.c
*_h.h *_i.h
*.ilk *.ilk
*.meta *.meta
*.obj *.obj
*.iobj
*.pch *.pch
*.pdb *.pdb
*.ipdb
*.pgc *.pgc
*.pgd *.pgd
*.rsp *.rsp
@@ -83,7 +61,6 @@ StyleCopReport.xml
*.tlh *.tlh
*.tmp *.tmp
*.tmp_proj *.tmp_proj
*_wpftmp.csproj
*.log *.log
*.vspscc *.vspscc
*.vssscc *.vssscc
@@ -112,9 +89,6 @@ ipch/
*.vspx *.vspx
*.sap *.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace # TFS 2012 Local Workspace
$tf/ $tf/
@@ -135,14 +109,6 @@ _TeamCity*
# DotCover is a Code Coverage Tool # DotCover is a Code Coverage Tool
*.dotCover *.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch # NCrunch
_NCrunch_* _NCrunch_*
.*crunch*.local.xml .*crunch*.local.xml
@@ -174,7 +140,7 @@ publish/
# Publish Web Output # Publish Web Output
*.[Pp]ublish.xml *.[Pp]ublish.xml
*.azurePubxml *.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings, # TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted # but database connection strings (with potential passwords) will be unencrypted
*.pubxml *.pubxml
*.publishproj *.publishproj
@@ -187,12 +153,12 @@ PublishScripts/
# NuGet Packages # NuGet Packages
*.nupkg *.nupkg
# The packages folder can be ignored because of Package Restore # The packages folder can be ignored because of Package Restore
**/[Pp]ackages/* **/packages/*
# except build/, which is used as an MSBuild target. # except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/ !**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed # Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config #!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files # NuGet v3's project.json files produces more ignoreable files
*.nuget.props *.nuget.props
*.nuget.targets *.nuget.targets
@@ -209,13 +175,12 @@ AppPackages/
BundleArtifacts/ BundleArtifacts/
Package.StoreAssociation.xml Package.StoreAssociation.xml
_pkginfo.txt _pkginfo.txt
*.appx
# Visual Studio cache files # Visual Studio cache files
# files ending in .cache can be ignored # files ending in .cache can be ignored
*.[Cc]ache *.[Cc]ache
# but keep track of directories ending in .cache # but keep track of directories ending in .cache
!?*.[Cc]ache/ !*.[Cc]ache/
# Others # Others
ClientBin/ ClientBin/
@@ -223,15 +188,11 @@ ClientBin/
*~ *~
*.dbmdl *.dbmdl
*.dbproj.schemaview *.dbproj.schemaview
*.jfm
*.pfx *.pfx
*.publishsettings *.publishsettings
node_modules/
orleans.codegen.cs orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components # Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/ #bower_components/
@@ -246,20 +207,15 @@ _UpgradeReport_Files/
Backup*/ Backup*/
UpgradeLog*.XML UpgradeLog*.XML
UpgradeLog*.htm UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files # SQL Server files
*.mdf *.mdf
*.ldf *.ldf
*.ndf
# Business Intelligence projects # Business Intelligence projects
*.rdl.data *.rdl.data
*.bim.layout *.bim.layout
*.bim_*.settings *.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
# Microsoft Fakes # Microsoft Fakes
FakesAssemblies/ FakesAssemblies/
@@ -269,7 +225,6 @@ FakesAssemblies/
# Node.js Tools for Visual Studio # Node.js Tools for Visual Studio
.ntvs_analysis.dat .ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log # Visual Studio 6 build log
*.plg *.plg
@@ -277,9 +232,6 @@ node_modules/
# Visual Studio 6 workspace options file # Visual Studio 6 workspace options file
*.opt *.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output # Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts **/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts
@@ -299,48 +251,15 @@ paket-files/
.idea/ .idea/
*.sln.iml *.sln.iml
# CodeRush personal settings # BookStore
.cr/personal src/Acme.BookStore.Web/Logs/*
src/Acme.BookStore.Web.Host/Logs/*
src/Acme.BookStore.AuthServer/Logs/*
src/Acme.BookStore.HttpApi.Host/Logs/*
src/Acme.BookStore.HttpApi.HostWithIds/Logs/*
src/Acme.BookStore.DbMigrator/Logs/*
src/Acme.BookStore.Blazor.Server/Logs/*
src/Acme.BookStore.Blazor.Server.Tiered/Logs/*
# Python Tools for Visual Studio (PTVS) # Use abp install-libs to restore.
__pycache__/ **/wwwroot/libs/*
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
appsettings.Development.json

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2022 jacktang Copyright (c) 2023 橙子
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

36
README.en.md Normal file
View File

@@ -0,0 +1,36 @@
# YiAbp
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

304
README.md
View File

@@ -1,289 +1,39 @@
<h1 align="center"><img align="left" height="150px" src="https://user-images.githubusercontent.com/68722157/138828506-f58b7c57-5e10-4178-8f7d-5d5e12050113.png"> Yi框架</h1> # YiAbp
<h4 align="center">一套以用户体验出发的.Net6 Web开源框架</h4>
<h5 align="center">支持原生版本、Furion版本、Abp版本前端后台接入Ruoyi Vue3.0</h5>
<h2 align="center">集大成者,终究轮子</h2>
[English](README-en.md) | 简体中文 #### 介绍
{**以下是 Gitee 平台说明,您可以替换此简介**
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
![sdk](https://img.shields.io/badge/sdk-6.0.1-d.svg)![License MIT](https://img.shields.io/badge/license-Apache-blue.svg?style=flat-square) #### 软件架构
软件架构说明
****
### 简介:
**中文:意框架**和他的名字一样“简易”同时接入Java的Ruoyi Vue3.0前端)
模块分化较多,可根据业务自行引用或抛弃,集大成者,大而全乎,也许你能从中学习到一些独特见解 #### 安装教程
**英文YiFramework** 1. xxxx
2. xxxx
3. xxxx
Yi框架-一套与SqlSugar一样爽的.Net6开源框架。 #### 使用说明
与Sqlsugar理念一致以用户体验出发。
适合.Net6学习、Sqlsugar学习 、项目二次开发。
集大成者,终究轮子
Yi框架最新版本标签`v3.0.0`,具体版本可以查看标签迭代 1. xxxx
2. xxxx
3. xxxx
项目与Sqlsugar同步更新但这作者老杰哥代码天天爆肝到凌晨两点我们也尽量会跟上他的脚步。更新频繁所以可watching持续关注。 #### 参与贡献
————这不仅仅是一个程序,更是一个艺术品,面向艺术的开发! 1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
> 核心特点简单好用框架不以打包形式引用而是直接以项目附带源码给出自由度拉满遵循Mit协议允许随意修改请注明来源即可
**分支:** #### 特技
本项目由EFCore版本历经4年不断迭代至Sqlsugar版本现EFcore版本已弃用目前sqlsugar已带业务功能 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
- (推荐) **Furion**: 基于Furion分支回归开发本质极度简单用起来贼爽 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
- ~~**Framework**~~: 框架分支,所有东西都在这里 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
- ~~**SqlSugar**:.Net6 DDD领域驱动设计 简单分层微服务架构~~
- ~~**SqlSugar-Dev**为sqlsugar分支的实时开发版本~~
- ~~**abp**:基于abp.vnext项目~~
****
**目录:**
Yi后端框架分为3个部分
- Infrastructure基础设施框架底层+sqlsugar+furion
- Module应用模块可选项例如缓存模块、微信模块、文件模块、日志模块等
- Application业务模块用于开发
另外光说不练假把式我们不仅仅提供一个空白的框架还同时提供3个基于yi框架的业务模块没有听错目前为1个后端支持3个前端。各个模块关系解耦可单独使用其中的任意业务模块
- Yi.RuoYi.Vue3Ruoyi后台管理系统Rbac Vue3前端推荐
- Yi.Furion.Net6.NET6后端推荐
- Yi.App.Vue3移动端App Vue3前端
- Yi.BBS.Vue3Web网页端BBS论坛 Vue3+Ts前端
后续我们持续更新各大应用模块及业务模块shop商场、erp进销存、mes工厂系统等
业务支持并扩展至各个领域,用于具体项目的二次开发极大复用后端代码及前端代码,以通用的部分+不通的部分快速二开
### 演示地址:
废话少说直接上地址,**请不要**更改里面的数据
官网网址:[ccnetcore.com](https://ccnetcore.com) (已上线,欢迎加入)
Bbs社区系统[ccnetcore.com](https://ccnetcore.com) (已上线,欢迎加入)
Rbac后台管理系统[yi.ccnetcore.com](http://yi.ccnetcore.com) (已上线)~~管理员账号cc 、 123456~~
App移动端系统[xxx](xxx)正在部署
网关地址:~~[gate.ccnetcore.com/swagger](http://gate.ccnetcore.com/swagger)~~(目前使用单体架构部署,无需网关)
### 支持:
- [x] 完全支持单体应用架构
- [x] 完全支持分布式应用架构
- [x] 完全支持微服务架构
****
### 详细到爆炸的Yi框架教程导航
1. [框架快速开始](https://ccnetcore.com/article/1641733850189139969)(已完成)
2. [框架模块教程](https://ccnetcore.com/article/1641733991574933505)(已完成)
3. [应用模块教程](https://ccnetcore.com/article/1641734073091231745)
4. [Yi.RBAC后台系统](https://ccnetcore.com/article/1641734171128893441)
5. [Yi.BBS社区系统](https://ccnetcore.com/article/1641734308475572225)
****
### 它的理念:
优雅的进行快速开发通常简单程度与优雅程度不可兼得Yi框架并不一昧的追求极致的解耦会站在用户使用角度上在使用难易度进行考虑衡量
例如我们大部分功能紧密贴合Sqlsugar虽然缺少其他orm的替换性但在使用程度上降低的使用难度
> 一个面向用户的快速开发后端框架
在真正的使用这,你会明白这一点,极致的简单,也是优雅的一种体现。
****
### 特点:
- 面向用户的后端框架,使用简单,适合小型、企业级项目
- 项目内置源码,不打包
- 开箱即用
- 支持模块化
- 支持动态Api
- 支持属性注入
- 内置包含大量通用场景模块
- 等等
### 基础设施简介
- Jwt鉴权
- 接口级别授权
- 对象映射
- O/RM
- 数据过滤
- 多租户
- 逻辑删除
- 审计日志
- 种子数据
- 工作单元
- 模块化
- 动态Api
- 属性注入
- 自动依赖注入
- 当前用户
- 仓储
- Crud
### 内置模块简介
- 后台任务
- 本地缓存
- 分布式缓存
- 事件总线
- 字典管理
- 文件管理
- 图片操作
- Excel操作
- 操作日志管理
- Sms短信
- 微信支付
- WebFirst代码生成
### 业务项目
- RABC后台管理系统
- BBS社区系统
- APP移动端系统
> 重复的东西,无需再写一遍,这也是优雅的体现之一
****
### 核心技术
#### 后端
C# Asp.NetCore 6.0
- [x] 动态ApiCike.AutoApi
- [x] 鉴权授权Jwt
- [x] 日志Nlog
- [x] 模块化StartupModules
- [x] 依赖注入Autofac
- [x] 对象映射Mapster
- [x] ORM:SqlsugarCore
- [x] 多租户Abp
- [x] 后台任务Quartz.Net
- [x] 本地缓存MemortCache
- [x] 分布式缓存CSRedisCore
- [x] 事件总线Cike.EventBus
- [x] 图像操作SixLabors.ImageSharp
- [x] Excle操作ExcelToObject.Npoi
#### 前端
js Vue3.2
- [x] 异步请求axios
- [x] 图表echarts
- [x] uielement-plus
- [x] 存储pinia
- [x] 路由vue-router
- [x] 打包vite
#### 运维
- [x] 部署nginx
- [x] CICDgitlab+Jenkins
- [x] Dockerharbor
****
### 业务支持模块:
RABC权限管理系统正在更新
采用ruoyi前端
- 用户管理
- 角色管理
- 菜单管理
- 部门管理
- 岗位管理
- 字典管理
- 参数管理
- 用户在线
- 操作日志
- 登录日志
- 定时任务
- 缓存列表
- 服务监控
- WebFirst代码生成工具
**演示截图:**
![输入图片说明](readme/1.png)
![输入图片说明](readme/2.png)
![输入图片说明](readme/3.png)
![输入图片说明](readme/4.png)
![输入图片说明](readme/5.png)
![输入图片说明](readme/6.png)
![输入图片说明](readme/7.png)
![输入图片说明](readme/8.png)
![输入图片说明](readme/9.png)
![输入图片说明](readme/10.png)
![输入图片说明](readme/1696760969217.jpg)
![输入图片说明](readme/1696761014270.jpg)
BBS论坛系统持续迭代
- 文章管理
- 评论管理
- 主题管理
- 板块管理
- 点赞管理
- 等等
APP移动端系统持续迭代
- 动态查询
- 我的资料
ERP进销存系统持续迭代
- 供货商管理
- 等等
SHOP电商系统持续迭代
- SPU管理
- SKU管理
- 商品规格
- 商品分类
- 等等
****
### 感谢:
**大力支持** Eleven神、Sqlsugar上海杰哥、Gerry、哲学的老张
[橙子]https://ccnetcore.com
[lzw]https://github.com/yeslode
[朝夕教育]https://www.zhaoxiedu.net
[Sqlsugar老杰哥]https://www.donet5.com/Home/Doc
[RuYiAdmin如意老兄]https://gitee.com/pang-mingjun/RuYiAdmin
[ZrAdminNetCore字母老哥]https://gitee.com/izory/ZrAdminNetCore
[Admin.NET周哥]https://gitee.com/zuohuaijun/Admin.NET
[Furion百小僧]https://furion.baiqian.ltd/
****
### 联系我们:
作者QQ`454313500`2029年之前作者24小时在线时刻保持活跃更新。
QQ交流群官方一群已满、官方二群已满、官方三群`786308927`(基本已满)、官方四群:`498310311`(新群)
联系作者,这里人人都是顾问
官方网址留言区:[ccnetcore.com](https://ccnetcore.com)
****
### FQA:
前往官网查看留言区
[留言区](https://ccnetcore.com/discuss/1641030787056930818)

201
Yi.Abp.Net8/Yi.Abp.sln Normal file
View File

@@ -0,0 +1,201 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34202.233
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.Web", "src\Yi.Abp.Web\Yi.Abp.Web.csproj", "{15913E44-DA92-44B9-9AC5-E9457EA34BF5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.SqlSugarCore", "framework\Yi.Framework.SqlSugarCore\Yi.Framework.SqlSugarCore.csproj", "{DC431ECC-C75D-4B01-8B79-4861948179BB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B782C78B-6C17-49E6-A237-3383BA720766}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0D10EEF2-FBAE-4C72-B816-A52823FC299B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "framework", "framework", "{77B949E9-530E-45A5-9657-20F7D5C6875C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "module", "module", "{2317227D-7796-4E7B-BEDB-7CD1CAE7B853}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.SqlSugarCore", "src\Yi.Abp.SqlSugarCore\Yi.Abp.SqlSugarCore.csproj", "{9A7BBA40-28D6-4900-9E1D-D627A516EE72}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.Application", "src\Yi.Abp.Application\Yi.Abp.Application.csproj", "{746DBBD6-23E8-4D5D-9D23-E2902BE338BD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.Application.Contracts", "src\Yi.Abp.Application.Contracts\Yi.Abp.Application.Contracts.csproj", "{51EEBF59-3D37-4681-981D-56F8D8F8968D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.Domain", "src\Yi.Abp.Domain\Yi.Abp.Domain.csproj", "{7B15C198-538A-44ED-A6AA-3A0FEAA1D2BD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.Domain.Shared", "src\Yi.Abp.Domain.Shared\Yi.Abp.Domain.Shared.csproj", "{F4D5A496-BFBE-470B-A05B-CB5823B47E72}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6A5375C6-1D55-4E93-9B19-736F1C68CBC3}"
ProjectSection(SolutionItems) = preProject
common.props = common.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.SqlSugarCore.Abstractions", "framework\Yi.Framework.SqlSugarCore.Abstractions\Yi.Framework.SqlSugarCore.Abstractions.csproj", "{FD6D6860-3753-4747-8A26-977E4A3001F9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core", "framework\Yi.Framework.Core\Yi.Framework.Core.csproj", "{ECE874D4-F882-4EF4-84A6-A842D9B8FBC5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Mapster", "framework\Yi.Framework.Mapster\Yi.Framework.Mapster.csproj", "{1995A019-C8AE-467E-B427-ED57D6CBF44F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.AspNetCore", "framework\Yi.Framework.AspNetCore\Yi.Framework.AspNetCore.csproj", "{F5011C0D-209B-4A98-BBE3-68157503EEF8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Ddd.Application.Contracts", "framework\Yi.Framework.Ddd.Application.Contracts\Yi.Framework.Ddd.Application.Contracts.csproj", "{0A8296A3-C11F-4F13-8E49-6BC8188D4804}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Ddd.Application", "framework\Yi.Framework.Ddd.Application\Yi.Framework.Ddd.Application.csproj", "{F0141C17-0EBD-4261-98D5-1C5B7BC1DFEE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rbac", "rbac", "{9CC7A457-1236-40BA-B47B-E7B710A3F061}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.Application.Contracts", "module\rbac\Yi.Framework.Rbac.Application.Contracts\Yi.Framework.Rbac.Application.Contracts.csproj", "{1C360956-8CD8-407E-B87F-D0BD57068EB9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.Application", "module\rbac\Yi.Framework.Rbac.Application\Yi.Framework.Rbac.Application.csproj", "{4F02B08D-5FE2-460D-BCA5-DA565151AE30}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.Domain", "module\rbac\Yi.Framework.Rbac.Domain\Yi.Framework.Rbac.Domain.csproj", "{C04D3F71-1557-46D0-B810-97B1FBB6AB73}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.Domain.Shared", "module\rbac\Yi.Framework.Rbac.Domain.Shared\Yi.Framework.Rbac.Domain.Shared.csproj", "{A2BB899D-4F9A-4184-81BD-94B938E2AB03}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.SqlSugarCore", "module\rbac\Yi.Framework.Rbac.SqlSugarCore\Yi.Framework.Rbac.SqlSugarCore.csproj", "{4503A2F9-139D-4CBC-AF11-689C34F0D77B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "bbs", "bbs", "{E902A945-4F41-4E96-A0DA-9F66CDA22261}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Bbs.Domain.Shared", "module\bbs\Yi.Framework.Bbs.Domain.Shared\Yi.Framework.Bbs.Domain.Shared.csproj", "{EB9349E2-256D-41EB-A345-21635A1361B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Bbs.Domain", "module\bbs\Yi.Framework.Bbs.Domain\Yi.Framework.Bbs.Domain.csproj", "{4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Bbs.Application.Contracts", "module\bbs\Yi.Framework.Bbs.Application.Contracts\Yi.Framework.Bbs.Application.Contracts.csproj", "{7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Bbs.Application", "module\bbs\Yi.Framework.Bbs.Application\Yi.Framework.Bbs.Application.csproj", "{AD4EE9E6-F4A3-4139-AF05-71388167DE5B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Bbs.SqlSugarCore", "module\bbs\Yi.Framework.Bbs.SqlSugarCore\Yi.Framework.Bbs.SqlSugarCore.csproj", "{6C86BA71-9F87-4E2C-B467-2950D77DCDFA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{15913E44-DA92-44B9-9AC5-E9457EA34BF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15913E44-DA92-44B9-9AC5-E9457EA34BF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15913E44-DA92-44B9-9AC5-E9457EA34BF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15913E44-DA92-44B9-9AC5-E9457EA34BF5}.Release|Any CPU.Build.0 = Release|Any CPU
{DC431ECC-C75D-4B01-8B79-4861948179BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC431ECC-C75D-4B01-8B79-4861948179BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC431ECC-C75D-4B01-8B79-4861948179BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC431ECC-C75D-4B01-8B79-4861948179BB}.Release|Any CPU.Build.0 = Release|Any CPU
{9A7BBA40-28D6-4900-9E1D-D627A516EE72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A7BBA40-28D6-4900-9E1D-D627A516EE72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A7BBA40-28D6-4900-9E1D-D627A516EE72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A7BBA40-28D6-4900-9E1D-D627A516EE72}.Release|Any CPU.Build.0 = Release|Any CPU
{746DBBD6-23E8-4D5D-9D23-E2902BE338BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{746DBBD6-23E8-4D5D-9D23-E2902BE338BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{746DBBD6-23E8-4D5D-9D23-E2902BE338BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{746DBBD6-23E8-4D5D-9D23-E2902BE338BD}.Release|Any CPU.Build.0 = Release|Any CPU
{51EEBF59-3D37-4681-981D-56F8D8F8968D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51EEBF59-3D37-4681-981D-56F8D8F8968D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51EEBF59-3D37-4681-981D-56F8D8F8968D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51EEBF59-3D37-4681-981D-56F8D8F8968D}.Release|Any CPU.Build.0 = Release|Any CPU
{7B15C198-538A-44ED-A6AA-3A0FEAA1D2BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B15C198-538A-44ED-A6AA-3A0FEAA1D2BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B15C198-538A-44ED-A6AA-3A0FEAA1D2BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B15C198-538A-44ED-A6AA-3A0FEAA1D2BD}.Release|Any CPU.Build.0 = Release|Any CPU
{F4D5A496-BFBE-470B-A05B-CB5823B47E72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4D5A496-BFBE-470B-A05B-CB5823B47E72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4D5A496-BFBE-470B-A05B-CB5823B47E72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4D5A496-BFBE-470B-A05B-CB5823B47E72}.Release|Any CPU.Build.0 = Release|Any CPU
{FD6D6860-3753-4747-8A26-977E4A3001F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD6D6860-3753-4747-8A26-977E4A3001F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD6D6860-3753-4747-8A26-977E4A3001F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD6D6860-3753-4747-8A26-977E4A3001F9}.Release|Any CPU.Build.0 = Release|Any CPU
{ECE874D4-F882-4EF4-84A6-A842D9B8FBC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECE874D4-F882-4EF4-84A6-A842D9B8FBC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECE874D4-F882-4EF4-84A6-A842D9B8FBC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECE874D4-F882-4EF4-84A6-A842D9B8FBC5}.Release|Any CPU.Build.0 = Release|Any CPU
{1995A019-C8AE-467E-B427-ED57D6CBF44F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1995A019-C8AE-467E-B427-ED57D6CBF44F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1995A019-C8AE-467E-B427-ED57D6CBF44F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1995A019-C8AE-467E-B427-ED57D6CBF44F}.Release|Any CPU.Build.0 = Release|Any CPU
{F5011C0D-209B-4A98-BBE3-68157503EEF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5011C0D-209B-4A98-BBE3-68157503EEF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5011C0D-209B-4A98-BBE3-68157503EEF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5011C0D-209B-4A98-BBE3-68157503EEF8}.Release|Any CPU.Build.0 = Release|Any CPU
{0A8296A3-C11F-4F13-8E49-6BC8188D4804}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A8296A3-C11F-4F13-8E49-6BC8188D4804}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A8296A3-C11F-4F13-8E49-6BC8188D4804}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A8296A3-C11F-4F13-8E49-6BC8188D4804}.Release|Any CPU.Build.0 = Release|Any CPU
{F0141C17-0EBD-4261-98D5-1C5B7BC1DFEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0141C17-0EBD-4261-98D5-1C5B7BC1DFEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0141C17-0EBD-4261-98D5-1C5B7BC1DFEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0141C17-0EBD-4261-98D5-1C5B7BC1DFEE}.Release|Any CPU.Build.0 = Release|Any CPU
{1C360956-8CD8-407E-B87F-D0BD57068EB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C360956-8CD8-407E-B87F-D0BD57068EB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C360956-8CD8-407E-B87F-D0BD57068EB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C360956-8CD8-407E-B87F-D0BD57068EB9}.Release|Any CPU.Build.0 = Release|Any CPU
{4F02B08D-5FE2-460D-BCA5-DA565151AE30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F02B08D-5FE2-460D-BCA5-DA565151AE30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F02B08D-5FE2-460D-BCA5-DA565151AE30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F02B08D-5FE2-460D-BCA5-DA565151AE30}.Release|Any CPU.Build.0 = Release|Any CPU
{C04D3F71-1557-46D0-B810-97B1FBB6AB73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C04D3F71-1557-46D0-B810-97B1FBB6AB73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C04D3F71-1557-46D0-B810-97B1FBB6AB73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C04D3F71-1557-46D0-B810-97B1FBB6AB73}.Release|Any CPU.Build.0 = Release|Any CPU
{A2BB899D-4F9A-4184-81BD-94B938E2AB03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2BB899D-4F9A-4184-81BD-94B938E2AB03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2BB899D-4F9A-4184-81BD-94B938E2AB03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2BB899D-4F9A-4184-81BD-94B938E2AB03}.Release|Any CPU.Build.0 = Release|Any CPU
{4503A2F9-139D-4CBC-AF11-689C34F0D77B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4503A2F9-139D-4CBC-AF11-689C34F0D77B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4503A2F9-139D-4CBC-AF11-689C34F0D77B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4503A2F9-139D-4CBC-AF11-689C34F0D77B}.Release|Any CPU.Build.0 = Release|Any CPU
{EB9349E2-256D-41EB-A345-21635A1361B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB9349E2-256D-41EB-A345-21635A1361B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB9349E2-256D-41EB-A345-21635A1361B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB9349E2-256D-41EB-A345-21635A1361B3}.Release|Any CPU.Build.0 = Release|Any CPU
{4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Release|Any CPU.Build.0 = Release|Any CPU
{7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Release|Any CPU.Build.0 = Release|Any CPU
{AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Release|Any CPU.Build.0 = Release|Any CPU
{6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{15913E44-DA92-44B9-9AC5-E9457EA34BF5} = {B782C78B-6C17-49E6-A237-3383BA720766}
{DC431ECC-C75D-4B01-8B79-4861948179BB} = {77B949E9-530E-45A5-9657-20F7D5C6875C}
{9A7BBA40-28D6-4900-9E1D-D627A516EE72} = {B782C78B-6C17-49E6-A237-3383BA720766}
{746DBBD6-23E8-4D5D-9D23-E2902BE338BD} = {B782C78B-6C17-49E6-A237-3383BA720766}
{51EEBF59-3D37-4681-981D-56F8D8F8968D} = {B782C78B-6C17-49E6-A237-3383BA720766}
{7B15C198-538A-44ED-A6AA-3A0FEAA1D2BD} = {B782C78B-6C17-49E6-A237-3383BA720766}
{F4D5A496-BFBE-470B-A05B-CB5823B47E72} = {B782C78B-6C17-49E6-A237-3383BA720766}
{FD6D6860-3753-4747-8A26-977E4A3001F9} = {77B949E9-530E-45A5-9657-20F7D5C6875C}
{ECE874D4-F882-4EF4-84A6-A842D9B8FBC5} = {77B949E9-530E-45A5-9657-20F7D5C6875C}
{1995A019-C8AE-467E-B427-ED57D6CBF44F} = {77B949E9-530E-45A5-9657-20F7D5C6875C}
{F5011C0D-209B-4A98-BBE3-68157503EEF8} = {77B949E9-530E-45A5-9657-20F7D5C6875C}
{0A8296A3-C11F-4F13-8E49-6BC8188D4804} = {77B949E9-530E-45A5-9657-20F7D5C6875C}
{F0141C17-0EBD-4261-98D5-1C5B7BC1DFEE} = {77B949E9-530E-45A5-9657-20F7D5C6875C}
{9CC7A457-1236-40BA-B47B-E7B710A3F061} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853}
{1C360956-8CD8-407E-B87F-D0BD57068EB9} = {9CC7A457-1236-40BA-B47B-E7B710A3F061}
{4F02B08D-5FE2-460D-BCA5-DA565151AE30} = {9CC7A457-1236-40BA-B47B-E7B710A3F061}
{C04D3F71-1557-46D0-B810-97B1FBB6AB73} = {9CC7A457-1236-40BA-B47B-E7B710A3F061}
{A2BB899D-4F9A-4184-81BD-94B938E2AB03} = {9CC7A457-1236-40BA-B47B-E7B710A3F061}
{4503A2F9-139D-4CBC-AF11-689C34F0D77B} = {9CC7A457-1236-40BA-B47B-E7B710A3F061}
{E902A945-4F41-4E96-A0DA-9F66CDA22261} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853}
{EB9349E2-256D-41EB-A345-21635A1361B3} = {E902A945-4F41-4E96-A0DA-9F66CDA22261}
{4EABBC84-BCED-46C1-8CF1-62A7B8081ED7} = {E902A945-4F41-4E96-A0DA-9F66CDA22261}
{7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20} = {E902A945-4F41-4E96-A0DA-9F66CDA22261}
{AD4EE9E6-F4A3-4139-AF05-71388167DE5B} = {E902A945-4F41-4E96-A0DA-9F66CDA22261}
{6C86BA71-9F87-4E2C-B467-2950D77DCDFA} = {E902A945-4F41-4E96-A0DA-9F66CDA22261}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {23D6FBC9-C970-4641-BC1E-2AEA59F51C18}
EndGlobalSection
EndGlobal

20
Yi.Abp.Net8/common.props Normal file
View File

@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>1.0.0</Version>
<NoWarn>$(NoWarn);CS1591;CS8618;CS1998;CS8604;CS8620;CS8600;CS8602</NoWarn>
<AbpProjectType>app</AbpProjectType>
<DocumentationFile>$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<Target Name="NoWarnOnRazorViewImportedTypeConflicts" BeforeTargets="RazorCoreCompile">
<PropertyGroup>
<NoWarn>$(NoWarn);0436</NoWarn>
</PropertyGroup>
</Target>
<ItemGroup>
<Content Remove="$(UserProfile)\.nuget\packages\*\*\contentFiles\any\*\*.abppkg*.json" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,16 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.Builder;
using Yi.Framework.AspNetCore.Microsoft.AspNetCore.Middlewares;
namespace Yi.Framework.AspNetCore.Microsoft.AspNetCore.Builder
{
public static class ApiInfoBuilderExtensions
{
public static IApplicationBuilder UseYiApiHandlinge([NotNull] this IApplicationBuilder app)
{
app.UseMiddleware<ApiInfoMiddleware>();
return app;
}
}
}

View File

@@ -0,0 +1,45 @@
using Microsoft.AspNetCore.Builder;
namespace Yi.Framework.AspNetCore.Microsoft.AspNetCore.Builder
{
public static class SwaggerBuilderExtensons
{
public static IApplicationBuilder UseYiSwagger(this IApplicationBuilder app, params SwaggerModel[] swaggerModels)
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
if (swaggerModels.Length == 0)
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework");
}
else
{
foreach (var k in swaggerModels)
{
c.SwaggerEndpoint(k.Url, k.Name);
}
}
});
return app;
}
}
public class SwaggerModel
{
public SwaggerModel(string name)
{
this.Name = name;
this.Url = "/swagger/v1/swagger.json";
}
public SwaggerModel(string url, string name)
{
this.Url = url;
this.Name = name;
}
public string Url { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System.Net.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Json;
namespace Yi.Framework.AspNetCore.Microsoft.AspNetCore.Middlewares
{
public class ApiInfoMiddleware : IMiddleware, ITransientDependency
{
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
await next(context);
}
}
}

View File

@@ -0,0 +1,55 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection
{
public static class SwaggerAddExtensions
{
public static IServiceCollection AddYiSwaggerGen<Program>(this IServiceCollection services, Action<SwaggerGenOptions>? action)
{
services.AddAbpSwaggerGen(
options =>
{
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
if (basePath is not null)
{
foreach (var item in Directory.GetFiles(basePath, "*.xml"))
{
options.IncludeXmlComments(item, true);
}
}
options.AddSecurityDefinition("JwtBearer", new OpenApiSecurityScheme()
{
Description = "直接输入Token即可",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = "bearer"
});
var scheme = new OpenApiSecurityScheme()
{
Reference = new OpenApiReference() { Type = ReferenceType.SecurityScheme, Id = "JwtBearer" }
};
options.AddSecurityRequirement(new OpenApiSecurityRequirement()
{
[scheme] = new string[0]
});
if (action is not null)
{
action.Invoke(options);
}
}
);
return services;
}
}
}

View File

@@ -0,0 +1,73 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Reflection;
namespace Yi.Framework.AspNetCore.Mvc
{
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
[ExposeServices(typeof(IConventionalRouteBuilder))]
public class YiConventionalRouteBuilder : ConventionalRouteBuilder
{
public YiConventionalRouteBuilder(IOptions<AbpConventionalControllerOptions> options) : base(options)
{
}
public override string Build(
string rootPath,
string controllerName,
ActionModel action,
string httpMethod,
[CanBeNull] ConventionalControllerSetting configuration)
{
var apiRoutePrefix = GetApiRoutePrefix(action, configuration);
var controllerNameInUrl =
NormalizeUrlControllerName(rootPath, controllerName, action, httpMethod, configuration);
var url = $"{apiRoutePrefix}/{rootPath}/{NormalizeControllerNameCase(controllerNameInUrl, configuration)}";
//Add {id} path if needed
var idParameterModel = action.Parameters.FirstOrDefault(p => p.ParameterName == "id");
if (idParameterModel != null)
{
if (TypeHelper.IsPrimitiveExtended(idParameterModel.ParameterType, includeEnums: true))
{
url += "/{id}";
}
else
{
var properties = idParameterModel
.ParameterType
.GetProperties(BindingFlags.Instance | BindingFlags.Public);
foreach (var property in properties)
{
url += "/{" + NormalizeIdPropertyNameCase(property, configuration) + "}";
}
}
}
//Add action name if needed
var actionNameInUrl = NormalizeUrlActionName(rootPath, controllerName, action, httpMethod, configuration);
if (!actionNameInUrl.IsNullOrEmpty())
{
url += $"/{NormalizeActionNameCase(actionNameInUrl, configuration)}";
//Add secondary Id
var secondaryIds = action.Parameters
.Where(p => p.ParameterName.EndsWith("Id", StringComparison.Ordinal)).ToList();
if (secondaryIds.Count == 1)
{
url += $"/{{{NormalizeSecondaryIdNameCase(secondaryIds[0], configuration)}}}";
}
}
return url;
}
}
}

View File

@@ -0,0 +1,99 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.AspNetCore;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Reflection;
namespace Yi.Framework.AspNetCore.Mvc
{
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
[ExposeServices(typeof(IAbpServiceConvention))]
public class YiServiceConvention : AbpServiceConvention
{
public YiServiceConvention(IOptions<AbpAspNetCoreMvcOptions> options, IConventionalRouteBuilder conventionalRouteBuilder) : base(options, conventionalRouteBuilder)
{
}
protected override void ConfigureSelector(string rootPath, string controllerName, ActionModel action, ConventionalControllerSetting? configuration)
{
RemoveEmptySelectors(action.Selectors);
var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(action.ActionMethod);
if (remoteServiceAtt != null && !remoteServiceAtt.IsEnabledFor(action.ActionMethod))
{
return;
}
if (!action.Selectors.Any())
{
AddAbpServiceSelector(rootPath, controllerName, action, configuration);
}
else
{
NormalizeSelectorRoutes(rootPath, controllerName, action, configuration);
}
}
protected override void AddAbpServiceSelector(string rootPath, string controllerName, ActionModel action, ConventionalControllerSetting? configuration)
{
if (action.ActionName.ToLower().Contains("vue"))
{
}
base.AddAbpServiceSelector(rootPath, controllerName, action, configuration);
}
protected override void NormalizeSelectorRoutes(string rootPath, string controllerName, ActionModel action, ConventionalControllerSetting? configuration)
{
foreach (var selector in action.Selectors)
{
var httpMethod = selector.ActionConstraints
.OfType<HttpMethodActionConstraint>()
.FirstOrDefault()?
.HttpMethods?
.FirstOrDefault();
if (httpMethod == null)
{
httpMethod = SelectHttpMethod(action, configuration);
}
if (selector.AttributeRouteModel == null)
{
selector.AttributeRouteModel = CreateAbpServiceAttributeRouteModel(rootPath, controllerName, action, httpMethod, configuration);
}
else
{
var template = selector.AttributeRouteModel.Template;
if (!template.StartsWith("/"))
{
var route = $"{AbpAspNetCoreConsts.DefaultApiPrefix}/{rootPath}/{template}";
selector.AttributeRouteModel.Template = route;
}
}
if (!selector.ActionConstraints.OfType<HttpMethodActionConstraint>().Any())
{
selector.ActionConstraints.Add(new HttpMethodActionConstraint(new[] { httpMethod }));
}
}
}
}
}

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.AspNetCore
{
[Serializable]
public class RemoteServiceSuccessInfo
{
/// <summary>
/// Creates a new instance of <see cref="RemoteServiceSuccessInfo"/>.
/// </summary>
public RemoteServiceSuccessInfo()
{
}
/// <summary>
/// Creates a new instance of <see cref="RemoteServiceSuccessInfo"/>.
/// </summary>
/// <param name="code">Error code</param>
/// <param name="details">Error details</param>
/// <param name="message">Error message</param>
/// <param name="data">Error data</param>
public RemoteServiceSuccessInfo(string message, string? details = null, string? code = null, object? data = null)
{
Message = message;
Details = details;
Code = code;
Data = data;
}
/// <summary>
/// code.
/// </summary>
public string? Code { get; set; }
/// <summary>
/// message.
/// </summary>
public string? Message { get; set; }
/// <summary>
/// details.
/// </summary>
public string? Details { get; set; }
/// <summary>
/// data.
/// </summary>
public object? Data { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Json" Version="7.4.2" />
<PackageReference Include="Volo.Abp.Swashbuckle" Version="7.4.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Cors\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.AspNetCore</name>
</assembly>
<members>
<member name="M:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo.#ctor">
<summary>
Creates a new instance of <see cref="T:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo"/>.
</summary>
</member>
<member name="M:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo.#ctor(System.String,System.String,System.String,System.Object)">
<summary>
Creates a new instance of <see cref="T:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo"/>.
</summary>
<param name="code">Error code</param>
<param name="details">Error details</param>
<param name="message">Error message</param>
<param name="data">Error data</param>
</member>
<member name="P:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo.Code">
<summary>
code.
</summary>
</member>
<member name="P:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo.Message">
<summary>
message.
</summary>
</member>
<member name="P:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo.Details">
<summary>
details.
</summary>
</member>
<member name="P:Yi.Framework.AspNetCore.RemoteServiceSuccessInfo.Data">
<summary>
data.
</summary>
</member>
</members>
</doc>

View File

@@ -0,0 +1,17 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.Modularity;
using Yi.Framework.AspNetCore.Mvc;
using Yi.Framework.Core;
namespace Yi.Framework.AspNetCore
{
[DependsOn(typeof(YiFrameworkCoreModule)
)]
public class YiFrameworkAspNetCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
}
}
}

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Enums namespace Yi.Framework.Core.Enums
{ {
/// <summary> /// <summary>
/// 定义公共文件路径 /// 定义公共文件路径

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Enums namespace Yi.Framework.Core.Enums
{ {
public enum OrderByEnum public enum OrderByEnum
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Enums namespace Yi.Framework.Core.Enums
{ {
public enum QueryOperatorEnum public enum QueryOperatorEnum
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Enums namespace Yi.Framework.Core.Enums
{ {
public enum ResultCodeEnum public enum ResultCodeEnum
{ {

View File

@@ -1,12 +1,8 @@
using Microsoft.AspNetCore.Http; using System.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using Microsoft.AspNetCore.Http;
namespace Yi.Framework.Infrastructure.AspNetCore namespace Yi.Framework.Core.Extensions
{ {
public static class HttpContextExtensions public static class HttpContextExtensions
{ {
@@ -95,5 +91,10 @@ namespace Yi.Framework.Infrastructure.AspNetCore
{ {
return context.Request.Headers["User-Agent"]; return context.Request.Headers["User-Agent"];
} }
public static string[]? GetUserPermissions(this HttpContext context, string permissionsName)
{
return context.User.Claims.Where(x => x.Type == permissionsName).Select(x => x.Value).ToArray();
}
} }
} }

View File

@@ -5,7 +5,7 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class AssemblyHelper public static class AssemblyHelper
{ {

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.Text; using System.Text;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public sealed class Base32Helper public sealed class Base32Helper
{ {

View File

@@ -1,11 +1,84 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Newtonsoft.Json; using Newtonsoft.Json;
using Yi.Framework.Infrastructure.Extensions;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class ComputerHelper public class ComputerHelper
{ {
/// <summary>
/// 将object转换为long若转换失败则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private static long ParseToLong( object obj)
{
try
{
return long.Parse(obj.ToString());
}
catch
{
return 0L;
}
}
/// <summary>
/// 将string转换为DateTime若转换失败则返回日期最小值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private static DateTime ParseToDateTime( string str)
{
try
{
if (string.IsNullOrWhiteSpace(str))
{
return DateTime.MinValue;
}
if (str.Contains("-") || str.Contains("/"))
{
return DateTime.Parse(str);
}
else
{
int length = str.Length;
switch (length)
{
case 4:
return DateTime.ParseExact(str, "yyyy", System.Globalization.CultureInfo.CurrentCulture);
case 6:
return DateTime.ParseExact(str, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
case 8:
return DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
case 10:
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
case 12:
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
case 14:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
default:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
}
}
}
catch
{
return DateTime.MinValue;
}
}
private static double ParseToDouble(object obj)
{
try
{
return double.Parse(obj.ToString());
}
catch
{
return 0;
}
}
/// <summary> /// <summary>
/// 内存使用情况 /// 内存使用情况
/// </summary> /// </summary>
@@ -21,7 +94,7 @@ namespace Yi.Framework.Infrastructure.Helper
memoryMetrics.UsedRam = Math.Round(memoryMetrics.Used / 1024, 2) + "GB"; memoryMetrics.UsedRam = Math.Round(memoryMetrics.Used / 1024, 2) + "GB";
memoryMetrics.TotalRAM = Math.Round(memoryMetrics.Total / 1024, 2) + "GB"; memoryMetrics.TotalRAM = Math.Round(memoryMetrics.Total / 1024, 2) + "GB";
memoryMetrics.RAMRate = Math.Ceiling(100 * memoryMetrics.Used / memoryMetrics.Total).ToString() + "%"; memoryMetrics.RAMRate = Math.Ceiling(100 * memoryMetrics.Used / memoryMetrics.Total).ToString() + "%";
memoryMetrics.CPURate = Math.Ceiling(GetCPURate().ParseToDouble()) + "%"; memoryMetrics.CPURate = Math.Ceiling(ParseToDouble(GetCPURate())) + "%";
return memoryMetrics; return memoryMetrics;
} }
catch (Exception ex) catch (Exception ex)
@@ -130,7 +203,7 @@ namespace Yi.Framework.Infrastructure.Helper
if (IsUnix()) if (IsUnix())
{ {
string output = ShellHelper.Bash("uptime -s").Trim(); string output = ShellHelper.Bash("uptime -s").Trim();
runTime = DateTimeHelper.FormatTime((DateTime.Now - output.ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); runTime = DateTimeHelper.FormatTime(ParseToLong((DateTime.Now - ParseToDateTime(output)).TotalMilliseconds.ToString().Split('.')[0]));
} }
else else
{ {
@@ -138,7 +211,7 @@ namespace Yi.Framework.Infrastructure.Helper
string[] outputArr = output.Split('=', (char)StringSplitOptions.RemoveEmptyEntries); string[] outputArr = output.Split('=', (char)StringSplitOptions.RemoveEmptyEntries);
if (outputArr.Length == 2) if (outputArr.Length == 2)
{ {
runTime = DateTimeHelper.FormatTime((DateTime.Now - outputArr[1].Split('.')[0].ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); runTime = DateTimeHelper.FormatTime(ParseToLong((DateTime.Now - ParseToDateTime( outputArr[1].Split('.')[0])).TotalMilliseconds.ToString().Split('.')[0]));
} }
} }
} }

View File

@@ -1,6 +1,6 @@
using System; using System;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class ConsoleHelper public static class ConsoleHelper
{ {

View File

@@ -1,6 +1,6 @@
using System; using System;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class DateHelper public class DateHelper
{ {

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class DateTimeHelper public class DateTimeHelper
{ {

View File

@@ -5,7 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class Compare<T, C> : IEqualityComparer<T> public class Compare<T, C> : IEqualityComparer<T>
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class EnumHelper public static class EnumHelper
{ {

View File

@@ -5,7 +5,7 @@ using System.Linq.Expressions;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class ExpressionHelper public static class ExpressionHelper
{ {

View File

@@ -4,7 +4,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class FileHelper : IDisposable public class FileHelper : IDisposable
{ {

View File

@@ -1,4 +1,4 @@
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class HtmlHelper public static class HtmlHelper
{ {

View File

@@ -10,7 +10,7 @@ using System.Text.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class HttpHelper public static class HttpHelper
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class IdHelper public static class IdHelper
{ {

View File

@@ -3,7 +3,7 @@ using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Net.Sockets; using System.Net.Sockets;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class IpHelper public class IpHelper
{ {

View File

@@ -1,10 +1,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Text.Json;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class JsonHelper public class JsonHelper
{ {
@@ -37,7 +34,6 @@ namespace Yi.Framework.Infrastructure.Helper
string result = string.Empty; string result = string.Empty;
try try
{ {
System.Text.Json.JsonSerializer.Serialize("");
System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = System.Runtime.Serialization.Json.DataContractJsonSerializer serializer =
new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T)); new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T));
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
@@ -454,7 +450,7 @@ namespace Yi.Framework.Infrastructure.Helper
{ {
return; return;
} }
//示例 ["aa",{"bbbb":123,"fff","ddd"}] //示例 ["aa",{"bbbb":123,"fff","Ddd"}]
switch (c) switch (c)
{ {
case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}] case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}]

View File

@@ -3,7 +3,7 @@ using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class MD5Helper public class MD5Helper
{ {

View File

@@ -4,9 +4,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Enums; using Yi.Framework.Core.Enums;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class MimeHelper public static class MimeHelper
{ {

View File

@@ -6,7 +6,7 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class RSAFileHelper public class RSAFileHelper
{ {

View File

@@ -3,7 +3,7 @@ using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
/// <summary> /// <summary>
/// RSA加解密 使用OpenSSL的公钥加密/私钥解密 /// RSA加解密 使用OpenSSL的公钥加密/私钥解密

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class RandomHelper public class RandomHelper
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class ReflexHelper public static class ReflexHelper
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class ShellHelper public class ShellHelper
{ {

View File

@@ -4,7 +4,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class StringHelper public class StringHelper
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class TreeHelper public static class TreeHelper
{ {
@@ -13,7 +13,7 @@ namespace Yi.Framework.Infrastructure.Helper
if (list is not null && list.Count > 0) if (list is not null && list.Count > 0)
{ {
IList<T> result = new List<T>(); IList<T> result = new List<T>();
long pid = list.Min(m => (m as ITreeModel<T>)!.ParentId); Guid pid = list.Min(m => (m as ITreeModel<T>)!.ParentId);
IList<T> t = list.Where(m => (m as ITreeModel<T>)!.ParentId == pid).ToList(); IList<T> t = list.Where(m => (m as ITreeModel<T>)!.ParentId == pid).ToList();
foreach (T model in t) foreach (T model in t)
{ {
@@ -57,8 +57,8 @@ namespace Yi.Framework.Infrastructure.Helper
public interface ITreeModel<T> public interface ITreeModel<T>
{ {
public long Id { get; set; } public Guid Id { get; set; }
public long ParentId { get; set; } public Guid ParentId { get; set; }
public int OrderNum { get; set; } public int OrderNum { get; set; }
public List<T>? Children { get; set; } public List<T>? Children { get; set; }

View File

@@ -2,7 +2,7 @@
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public static class UnicodeHelper public static class UnicodeHelper
{ {

View File

@@ -1,4 +1,4 @@
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class UrlHelper public class UrlHelper
{ {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace Yi.Framework.Infrastructure.Helper namespace Yi.Framework.Core.Helper
{ {
public class XmlHelper public class XmlHelper
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Data.Entities namespace Yi.Framework.Core
{ {
public interface IOrderNum public interface IOrderNum
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Data.Entities namespace Yi.Framework.Core
{ {
public interface IState public interface IState
{ {

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Volo.Abp.Core" Version="7.4.2" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,847 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Core</name>
</assembly>
<members>
<member name="T:Yi.Framework.Core.Enums.FileTypeEnum">
<summary>
定义公共文件路径
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.Equal">
<summary>
相等
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.Like">
<summary>
匹配
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.GreaterThan">
<summary>
大于
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.GreaterThanOrEqual">
<summary>
大于或等于
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.LessThan">
<summary>
小于
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.LessThanOrEqual">
<summary>
小于或等于
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.In">
<summary>
等于集合
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.NotIn">
<summary>
不等于集合
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.LikeLeft">
<summary>
左边匹配
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.LikeRight">
<summary>
右边匹配
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.NoEqual">
<summary>
不相等
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.IsNullOrEmpty">
<summary>
为空或空
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.IsNot">
<summary>
不为空
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.NoLike">
<summary>
不匹配
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.QueryOperatorEnum.DateRange">
<summary>
时间段 值用 "|" 隔开
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.ResultCodeEnum.Success">
<summary>
操作成功。
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.ResultCodeEnum.NotSuccess">
<summary>
操作不成功
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.ResultCodeEnum.NoPermission">
<summary>
无权限
</summary>
</member>
<member name="F:Yi.Framework.Core.Enums.ResultCodeEnum.Denied">
<summary>
被拒绝
</summary>
</member>
<member name="M:Yi.Framework.Core.Extensions.HttpContextExtensions.FileInlineHandle(Microsoft.AspNetCore.Http.HttpContext,System.String)">
<summary>
设置文件下载名称
</summary>
<param name="httpContext"></param>
<param name="fileName"></param>
</member>
<member name="M:Yi.Framework.Core.Extensions.HttpContextExtensions.FileAttachmentHandle(Microsoft.AspNetCore.Http.HttpContext,System.String)">
<summary>
设置文件附件名称
</summary>
<param name="httpContext"></param>
<param name="fileName"></param>
</member>
<member name="M:Yi.Framework.Core.Extensions.HttpContextExtensions.GetLanguage(Microsoft.AspNetCore.Http.HttpContext)">
<summary>
获取语言种类
</summary>
<param name="httpContext"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Extensions.HttpContextExtensions.IsAjaxRequest(Microsoft.AspNetCore.Http.HttpRequest)">
<summary>
判断是否为异步请求
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Extensions.HttpContextExtensions.GetClientIp(Microsoft.AspNetCore.Http.HttpContext)">
<summary>
获取客户端IP
</summary>
<param name="context"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Extensions.HttpContextExtensions.GetUserAgent(Microsoft.AspNetCore.Http.HttpContext)">
<summary>
获取浏览器标识
</summary>
<param name="context"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.AssemblyHelper.GetAllLoadAssembly">
<summary>
此处统一获取程序集,排除微软内部相关
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.Base32Helper.ToString(System.Byte[])">
<summary>
Converts an array of bytes to a Base32-k string.
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.Base32Helper.FromBase32String(System.String)">
<summary>
Converts a Base32-k string into an array of bytes.
</summary>
<exception cref="T:System.ArgumentException">
Input string <paramref name="s">s</paramref> contains invalid Base32-k characters.
</exception>
</member>
<member name="M:Yi.Framework.Core.Helper.ComputerHelper.ParseToLong(System.Object)">
<summary>
将object转换为long若转换失败则返回0。不抛出异常。
</summary>
<param name="str"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ComputerHelper.ParseToDateTime(System.String)">
<summary>
将string转换为DateTime若转换失败则返回日期最小值。不抛出异常。
</summary>
<param name="str"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ComputerHelper.GetComputerInfo">
<summary>
内存使用情况
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ComputerHelper.GetDiskInfos">
<summary>
获取内存大小
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ComputerHelper.GetRunTime">
<summary>
获取系统运行时间
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.Core.Helper.MemoryMetrics">
<summary>
内存信息
</summary>
</member>
<member name="P:Yi.Framework.Core.Helper.MemoryMetrics.CPURate">
<summary>
CPU使用率%
</summary>
</member>
<member name="P:Yi.Framework.Core.Helper.MemoryMetrics.TotalRAM">
<summary>
总内存 GB
</summary>
</member>
<member name="P:Yi.Framework.Core.Helper.MemoryMetrics.RAMRate">
<summary>
内存使用率 %
</summary>
</member>
<member name="P:Yi.Framework.Core.Helper.MemoryMetrics.FreeRam">
<summary>
空闲内存
</summary>
</member>
<member name="P:Yi.Framework.Core.Helper.DiskInfo.DiskName">
<summary>
磁盘名
</summary>
</member>
<member name="P:Yi.Framework.Core.Helper.DiskInfo.Used">
<summary>
已使用
</summary>
</member>
<member name="P:Yi.Framework.Core.Helper.DiskInfo.AvailableFreeSpace">
<summary>
可使用
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.MemoryMetricsClient.GetWindowsMetrics">
<summary>
windows系统获取内存信息
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.MemoryMetricsClient.GetUnixMetrics">
<summary>
Unix系统获取
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ConsoleHelper.WriteErrorLine(System.String,System.ConsoleColor)">
<summary>
打印错误信息
</summary>
<param name="str">待打印的字符串</param>
<param name="color">想要打印的颜色</param>
</member>
<member name="M:Yi.Framework.Core.Helper.ConsoleHelper.WriteWarningLine(System.String,System.ConsoleColor)">
<summary>
打印警告信息
</summary>
<param name="str">待打印的字符串</param>
<param name="color">想要打印的颜色</param>
</member>
<member name="M:Yi.Framework.Core.Helper.ConsoleHelper.WriteInfoLine(System.String,System.ConsoleColor)">
<summary>
打印正常信息
</summary>
<param name="str">待打印的字符串</param>
<param name="color">想要打印的颜色</param>
</member>
<member name="M:Yi.Framework.Core.Helper.ConsoleHelper.WriteSuccessLine(System.String,System.ConsoleColor)">
<summary>
打印成功的信息
</summary>
<param name="str">待打印的字符串</param>
<param name="color">想要打印的颜色</param>
</member>
<member name="M:Yi.Framework.Core.Helper.DateHelper.ToLocalTimeDateBySeconds(System.Int64)">
<summary>
时间戳转本地时间-时间戳精确到秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateHelper.ToUnixTimestampBySeconds(System.DateTime)">
<summary>
时间转时间戳Unix-时间戳精确到秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateHelper.ToLocalTimeDateByMilliseconds(System.Int64)">
<summary>
时间戳转本地时间-时间戳精确到毫秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateHelper.ToUnixTimestampByMilliseconds(System.DateTime)">
<summary>
时间转时间戳Unix-时间戳精确到毫秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateTimeHelper.GetBeginTime(System.Nullable{System.DateTime},System.Int32)">
<summary>
</summary>
<param name="dateTime"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.DateTimeHelper.ToLocalTimeDateBySeconds(System.Int64)">
<summary>
时间戳转本地时间-时间戳精确到秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateTimeHelper.ToUnixTimestampBySeconds(System.DateTime)">
<summary>
时间转时间戳Unix-时间戳精确到秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateTimeHelper.ToLocalTimeDateByMilliseconds(System.Int64)">
<summary>
时间戳转本地时间-时间戳精确到毫秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateTimeHelper.ToUnixTimestampByMilliseconds(System.DateTime)">
<summary>
时间转时间戳Unix-时间戳精确到毫秒
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.DateTimeHelper.FormatTime(System.Int64)">
<summary>
毫秒转天时分秒
</summary>
<param name="ms"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.DateTimeHelper.GetUnixTimeStamp(System.DateTime)">
<summary>
获取unix时间戳
</summary>
<param name="dt"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.DistinctHelper.DistinctNew``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1})">
<summary>
自定义Distinct扩展方法
</summary>
<typeparam name="T">要去重的对象类</typeparam>
<typeparam name="C">自定义去重的字段类型</typeparam>
<param name="source">要去重的对象</param>
<param name="getfield">获取自定义去重字段的委托</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ExpressionHelper.Compose``1(System.Linq.Expressions.Expression{``0},System.Linq.Expressions.Expression{``0},System.Func{System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression})">
<summary>
Expression表达式树lambda参数拼接组合
</summary>
<typeparam name="T"></typeparam>
<param name="first"></param>
<param name="second"></param>
<param name="merge"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ExpressionHelper.False``1">
<summary>
Expression表达式树lambda参数拼接--false
</summary>
<typeparam name="T"></typeparam>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ExpressionHelper.True``1">
<summary>
Expression表达式树lambda参数拼接-true
</summary>
<typeparam name="T"></typeparam>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ExpressionHelper.And``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">
<summary>
Expression表达式树lambda参数拼接--and
</summary>
<typeparam name="T"></typeparam>
<param name="first"></param>
<param name="second"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ExpressionHelper.Or``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">
<summary>
Expression表达式树lambda参数拼接--or
</summary>
<typeparam name="T"></typeparam>
<param name="first"></param>
<param name="second"></param>
<returns></returns>
</member>
<member name="F:Yi.Framework.Core.Helper.LambdaParameteRebinder.map">
<summary>
存放表达式树的参数的字典
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.LambdaParameteRebinder.#ctor(System.Collections.Generic.Dictionary{System.Linq.Expressions.ParameterExpression,System.Linq.Expressions.ParameterExpression})">
<summary>
构造函数
</summary>
<param name="map"></param>
</member>
<member name="M:Yi.Framework.Core.Helper.LambdaParameteRebinder.VisitParameter(System.Linq.Expressions.ParameterExpression)">
<summary>
重载参数访问的方法,访问表达式树参数,如果字典中包含,则取出
</summary>
<param name="node">表达式树参数</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.GetPostfixStr(System.String)">
<summary>
取后缀名
</summary>
<param name="filename">文件名</param>
<returns>.gif|.html格式</returns>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.WriteFile(System.String,System.String)">
<summary>
写文件
</summary>
<param name="Path">文件路径</param>
<param name="Strings">文件内容</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.WriteFile(System.String,System.String,System.Text.Encoding)">
<summary>
写文件
</summary>
<param name="Path">文件路径</param>
<param name="Strings">文件内容</param>
<param name="encode">编码格式</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.ReadFile(System.String)">
<summary>
读文件
</summary>
<param name="Path">文件路径</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.ReadFile(System.String,System.Text.Encoding)">
<summary>
读文件
</summary>
<param name="Path">文件路径</param>
<param name="encode">编码格式</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.FileAdd(System.String,System.String)">
<summary>
追加文件
</summary>
<param name="Path">文件路径</param>
<param name="strings">内容</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.FileCoppy(System.String,System.String)">
<summary>
拷贝文件
</summary>
<param name="OrignFile">原始文件</param>
<param name="NewFile">新文件路径</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.FileDel(System.String)">
<summary>
删除文件
</summary>
<param name="Path">路径</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.FileMove(System.String,System.String)">
<summary>
移动文件
</summary>
<param name="OrignFile">原始路径</param>
<param name="NewFile">新路径</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.FolderCreate(System.String,System.String)">
<summary>
在当前目录下创建目录
</summary>
<param name="OrignFolder">当前目录</param>
<param name="NewFloder">新目录</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.DeleteFolder(System.String)">
<summary>
递归删除文件夹目录及文件
</summary>
<param name="dir"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.CopyDir(System.String,System.String)">
<summary>
指定文件夹下面的所有内容copy到目标文件夹下面
</summary>
<param name="srcPath">原始路径</param>
<param name="aimPath">目标文件夹</param>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.GetAllFileNames(System.String,System.String)">
<summary>
获取目录下全部文件名
</summary>
<param name="path"></param>
<param name="pattern"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.FileContentReplace(System.String,System.String,System.String)">
<summary>
文件内容替换
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.FileNameReplace(System.String,System.String,System.String)">
<summary>
文件名称
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.DirectoryNameReplace(System.String,System.String,System.String)">
<summary>
目录名替换
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.FileHelper.AllInfoReplace(System.String,System.String,System.String)">
<summary>
全部信息递归替换
</summary>
<param name="dirPath"></param>
<param name="oldStr"></param>
<param name="newStr"></param>
</member>
<member name="M:Yi.Framework.Core.Helper.HtmlHelper.ReplaceHtmlTag(System.String,System.Int32)">
<summary>
去除富文本中的HTML标签
</summary>
<param name="html"></param>
<param name="length"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.IpHelper.GetCurrentIp(System.String)">
<summary>
获取当前IP地址
</summary>
<param name="preferredNetworks"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.JsonHelper.GetJSON``1(System.Object)">
<summary>
转换对象为JSON格式数据
</summary>
<typeparam name="T"></typeparam>
<param name="obj">对象</param>
<returns>字符格式的JSON数据</returns>
</member>
<!-- Badly formed XML comment ignored for member "M:Yi.Framework.Core.Helper.JsonHelper.JSON``1(System.Collections.Generic.List{``0})" -->
<member name="M:Yi.Framework.Core.Helper.JsonHelper.ParseFormByJson``1(System.String)">
<summary>
JSON格式字符转换为T类型的对象
</summary>
<typeparam name="T"></typeparam>
<param name="jsonStr"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.JsonHelper.GetValueLength(System.String,System.Boolean,System.Int32@)">
<summary>
获取值的长度当Json值嵌套以"{"或"["开头时)
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.JsonHelper.SetCharState(System.Char,Yi.Framework.Core.Helper.CharState@)">
<summary>
设置字符状态(返回true则为关键词返回false则当为普通字符处理
</summary>
</member>
<member name="T:Yi.Framework.Core.Helper.CharState">
<summary>
字符状态
</summary>
</member>
<member name="F:Yi.Framework.Core.Helper.CharState.arrayStart">
<summary>
数组开始【仅第一开头才算】值嵌套的以【childrenStart】来标识。
</summary>
</member>
<member name="F:Yi.Framework.Core.Helper.CharState.state">
<summary>
【0 初始状态,或 遇到“,”逗号】【1 遇到“:”冒号】
</summary>
</member>
<member name="F:Yi.Framework.Core.Helper.CharState.keyStart">
<summary>
【-1 取值结束】【0 未开始】【1 无引号开始】【2 单引号开始】【3 双引号开始】
</summary>
</member>
<member name="F:Yi.Framework.Core.Helper.CharState.valueStart">
<summary>
【-1 取值结束】【0 未开始】【1 无引号开始】【2 单引号开始】【3 双引号开始】
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.MD5Helper.GenerateSalt">
<summary>
生成PasswordSalt
</summary>
<returns>返回string</returns>
</member>
<member name="M:Yi.Framework.Core.Helper.MD5Helper.SHA2Encode(System.String,System.String,System.Int32)">
<summary>
加密密码
</summary>
<param name="pass">密码</param>
<param name="passwordFormat">加密类型</param>
<param name="salt">PasswordSalt</param>
<returns>加密后的密码</returns>
</member>
<member name="M:Yi.Framework.Core.Helper.MD5Helper.MD5Encrypt16(System.String)">
<summary>
16位MD5加密
</summary>
<param name="password"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.MD5Helper.MD5Encrypt32(System.String)">
<summary>
32位MD5加密
</summary>
<param name="password"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.MD5Helper.MD5Encrypt64(System.String)">
<summary>
64位MD5加密
</summary>
<param name="password"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RandomHelper.GenerateRandomLetter(System.Int32)">
<summary>
随机生成字母
</summary>
<param name="Length"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RandomHelper.GenerateCheckCodeNum(System.Int32)">
<summary>
随机生成数字
</summary>
<param name="codeCount"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RandomHelper.RandChina(System.Int32)">
<summary>
此函数为生成指定数目的汉字
</summary>
<param name="charLen">汉字数目</param>
<returns>所有汉字</returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ReflexHelper.GetModelValue(System.String,System.Object)">
<summary>
取对象属性值
</summary>
<param name="FieldName"></param>
<param name="obj"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ReflexHelper.SetModelValue(System.String,System.Object,System.Object)">
<summary>
设置对象属性值
</summary>
<param name="FieldName"></param>
<param name="Value"></param>
<param name="obj"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.Core.Helper.RSAHelper">
<summary>
RSA加解密 使用OpenSSL的公钥加密/私钥解密
公私钥请使用openssl生成
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.RSAHelper.#ctor(Yi.Framework.Core.Helper.RSAType,System.Text.Encoding,System.String,System.String)">
<summary>
实例化RSAHelper
</summary>
<param name="rsaType">加密算法类型 RSA SHA1;RSA2 SHA256 密钥长度至少为2048</param>
<param name="encoding">编码类型</param>
<param name="privateKey">私钥</param>
<param name="publicKey">公钥</param>
</member>
<member name="M:Yi.Framework.Core.Helper.RSAHelper.Sign(System.String)">
<summary>
使用私钥签名
</summary>
<param name="data">原始数据</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RSAHelper.Verify(System.String,System.String)">
<summary>
使用公钥验签
</summary>
<param name="data">原始数据</param>
<param name="sign">签名</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RSAHelper.Decrypt(System.String)">
<summary>
私钥解密(支持大量数据)
</summary>
<param name="cipherText"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RSAHelper.Encrypt(System.String)">
<summary>
公钥加密(支持大量数据)
</summary>
<param name="text"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RSAHelper.CreateRsaProviderFromPrivateKey(System.String)">
<summary>
使用私钥创建RSA实例
</summary>
<param name="privateKey"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.RSAHelper.CreateRsaProviderFromPublicKey(System.String)">
<summary>
使用公钥创建RSA实例
</summary>
<param name="publicKeyString"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.Core.Helper.RSAType">
<summary>
RSA算法类型
</summary>
</member>
<member name="F:Yi.Framework.Core.Helper.RSAType.RSA">
<summary>
SHA1
</summary>
</member>
<member name="F:Yi.Framework.Core.Helper.RSAType.RSA2">
<summary>
RSA2 密钥长度至少为2048
SHA256
</summary>
</member>
<member name="M:Yi.Framework.Core.Helper.ShellHelper.Bash(System.String)">
<summary>
linux 系统命令
</summary>
<param name="command"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.ShellHelper.Cmd(System.String,System.String)">
<summary>
windows系统命令
</summary>
<param name="fileName"></param>
<param name="args"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.StringHelper.GetTopDataBySeparator(System.String,System.String,System.Int32,System.Boolean)">
<summary>
根据分隔符返回前n条数据
</summary>
<param name="content">数据内容</param>
<param name="separator">分隔符</param>
<param name="top">前n条</param>
<param name="isDesc">是否倒序默认false</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.StringHelper.GetPars(System.Collections.Generic.Dictionary{System.String,System.Object})">
<summary>
根据字段拼接get参数
</summary>
<param name="dic"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.StringHelper.GetPars(System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
根据字段拼接get参数
</summary>
<param name="dic"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.StringHelper.GetGUID(System.String)">
<summary>
获取一个GUID
</summary>
<param name="format">格式-默认为N</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.StringHelper.GetGuidToLongID">
<summary>
根据GUID获取19位的唯一数字序列
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.StringHelper.GetCusLine(System.String,System.Int32)">
<summary>
获取字符串最后X行
</summary>
<param name="resourceStr"></param>
<param name="length"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.UnicodeHelper.StringToUnicode(System.String)">
<summary>
字符串转Unicode码
</summary>
<returns>The to unicode.</returns>
<param name="value">Value.</param>
</member>
<member name="M:Yi.Framework.Core.Helper.UnicodeHelper.UnicodeToString(System.String)">
<summary>
Unicode转字符串
</summary>
<returns>The to string.</returns>
<param name="unicode">Unicode.</param>
</member>
<member name="M:Yi.Framework.Core.Helper.UrlHelper.UrlEncode(System.String)">
<summary>
UrlEncode编码
</summary>
<param name="url">url</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.UrlHelper.UrlDecode(System.String)">
<summary>
UrlEncode解码
</summary>
<param name="data">数据</param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Core.Helper.XmlHelper.GetXML``1(System.Object)">
<summary>
转换对象为JSON格式数据
</summary>
<typeparam name="T"></typeparam>
<param name="obj">对象</param>
<returns>字符格式的JSON数据</returns>
</member>
<member name="M:Yi.Framework.Core.Helper.XmlHelper.ParseFormByXml``1(System.String,System.String)">
<summary>
Xml格式字符转换为T类型的对象
</summary>
<typeparam name="T"></typeparam>
<param name="xml"></param>
<returns></returns>
</member>
</members>
</doc>

View File

@@ -0,0 +1,9 @@
using Volo.Abp.Modularity;
namespace Yi.Framework.Core
{
public class YiFrameworkCoreModule:AbpModule
{
}
}

View File

@@ -0,0 +1,10 @@
using Volo.Abp;
using Volo.Abp.Application.Services;
namespace Yi.Framework.Ddd.Application.Contracts
{
public interface IDeletesAppService<in TKey> : IDeleteAppService< TKey> , IApplicationService, IRemoteService
{
Task DeleteAsync(IEnumerable<TKey> ids);
}
}

View File

@@ -0,0 +1,10 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Ddd.Application.Contracts
{
public interface IPageTimeResultRequestDto : IPagedAndSortedResultRequest
{
DateTime? StartTime { get; set; }
DateTime? EndTime { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Ddd.Application.Contracts
{
public interface IPagedAllResultRequestDto : IPageTimeResultRequestDto, IPagedAndSortedResultRequest
{
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Yi.Framework.Ddd.Application.Contracts
{
public interface IYiCrudAppService<TEntityDto, in TKey> : ICrudAppService<TEntityDto, TKey>
{
}
public interface IYiCrudAppService<TEntityDto, in TKey, in TGetListInput> : ICrudAppService<TEntityDto, TKey, TGetListInput>
{
}
public interface IYiCrudAppService<TEntityDto, in TKey, in TGetListInput, in TCreateInput> : ICrudAppService<TEntityDto, TKey, TGetListInput, TCreateInput>
{
}
public interface IYiCrudAppService<TEntityDto, in TKey, in TGetListInput, in TCreateInput, in TUpdateInput> : ICrudAppService<TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
{
}
public interface IYiCrudAppService<TGetOutputDto, TGetListOutputDto, in TKey, in TGetListInput, in TCreateInput, in TUpdateInput> : ICrudAppService<TGetOutputDto, TGetListOutputDto, TKey, TGetListInput, TCreateInput, TUpdateInput>, IDeletesAppService<TKey>
{
}
}

View File

@@ -0,0 +1,17 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Ddd.Application.Contracts
{
public class PagedAllResultRequestDto : PagedAndSortedResultRequestDto, IPagedAllResultRequestDto
{
/// <summary>
/// 查询开始时间条件
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 查询结束时间条件
/// </summary>
public DateTime? EndTime { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="7.4.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Ddd.Application.Contracts</name>
</assembly>
<members>
<member name="P:Yi.Framework.Ddd.Application.Contracts.PagedAllResultRequestDto.StartTime">
<summary>
查询开始时间条件
</summary>
</member>
<member name="P:Yi.Framework.Ddd.Application.Contracts.PagedAllResultRequestDto.EndTime">
<summary>
查询结束时间条件
</summary>
</member>
</members>
</doc>

View File

@@ -0,0 +1,10 @@
using Volo.Abp.Application;
using Volo.Abp.Modularity;
namespace Yi.Framework.Ddd.Application.Contracts
{
[DependsOn(typeof(AbpDddApplicationContractsModule))]
public class YiFrameworkDddApplicationContractsModule : AbpModule
{
}
}

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application" Version="7.4.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Ddd.Application.Contracts\Yi.Framework.Ddd.Application.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Ddd.Application</name>
</assembly>
<members>
<member name="M:Yi.Framework.Ddd.Application.YiCrudAppService`7.DeleteAsync(System.Collections.Generic.IEnumerable{`3})">
<summary>
偷梁换柱
</summary>
<param name="id"></param>
<returns></returns>
</member>
</members>
</doc>

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
namespace Yi.Framework.Ddd.Application
{
public abstract class YiCrudAppService<TEntity, TEntityDto, TKey> : YiCrudAppService<TEntity, TEntityDto, TKey, PagedAndSortedResultRequestDto>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
protected YiCrudAppService(IRepository<TEntity, TKey> repository) : base(repository)
{
}
}
public abstract class YiCrudAppService<TEntity, TEntityDto, TKey, TGetListInput>
: YiCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TEntityDto>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
protected YiCrudAppService(IRepository<TEntity, TKey> repository) : base(repository)
{
}
}
public abstract class YiCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput>
: YiCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TCreateInput>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
protected YiCrudAppService(IRepository<TEntity, TKey> repository) : base(repository)
{
}
}
public abstract class YiCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
: YiCrudAppService<TEntity, TEntityDto, TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
protected YiCrudAppService(IRepository<TEntity, TKey> repository) : base(repository)
{
}
}
public abstract class YiCrudAppService<TEntity, TGetOutputDto, TGetListOutputDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
: CrudAppService<TEntity, TGetOutputDto, TGetListOutputDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
where TEntity : class, IEntity<TKey>
where TGetOutputDto : IEntityDto<TKey>
where TGetListOutputDto : IEntityDto<TKey>
{
protected YiCrudAppService(IRepository<TEntity, TKey> repository) : base(repository)
{
}
/// <summary>
/// 偷梁换柱
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[RemoteService(isEnabled: true)]
public async Task DeleteAsync(IEnumerable<TKey> id)
{
await Repository.DeleteManyAsync(id);
}
[RemoteService(isEnabled:false)]
public override Task DeleteAsync(TKey id)
{
return base.DeleteAsync(id);
}
}
}

View File

@@ -0,0 +1,13 @@
using Volo.Abp.Application;
using Volo.Abp.Modularity;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Ddd.Application
{
[DependsOn(typeof(AbpDddApplicationModule),
typeof(YiFrameworkDddApplicationContractsModule))]
public class YiFrameworkDddApplicationModule : AbpModule
{
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mapster;
using Volo.Abp.ObjectMapping;
namespace Yi.Framework.Mapster
{
public class MapsterAutoObjectMappingProvider : IAutoObjectMappingProvider
{
public TDestination Map<TSource, TDestination>(object source)
{
var sss = typeof(TDestination).Name;
return source.Adapt<TDestination>();
}
public TDestination Map<TSource, TDestination>(TSource source, TDestination destination)
{
return source.Adapt<TSource, TDestination>(destination);
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
namespace Yi.Framework.Mapster
{
public class MapsterObjectMapper : IObjectMapper
{
public IAutoObjectMappingProvider AutoObjectMappingProvider => throw new NotImplementedException();
public TDestination Map<TSource, TDestination>(TSource source)
{
throw new NotImplementedException();
}
public TDestination Map<TSource, TDestination>(TSource source, TDestination destination)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Volo.Abp.ObjectMapping" Version="7.4.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Mapster</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -0,0 +1,21 @@
using MapsterMapper;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectMapping;
using Yi.Framework.Core;
namespace Yi.Framework.Mapster
{
[DependsOn(typeof(YiFrameworkCoreModule),
typeof(AbpObjectMappingModule)
)]
public class YiFrameworkMapsterModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient<IAutoObjectMappingProvider, MapsterAutoObjectMappingProvider>();
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using Volo.Abp.DependencyInjection;
namespace Yi.Framework.SqlSugarCore.Abstractions
{
public interface ISqlSugarDbContext
{
// IAbpLazyServiceProvider LazyServiceProvider { get; set; }
ISqlSugarClient SqlSugarClient { get; }
}
}

View File

@@ -0,0 +1,88 @@
using System.Linq.Expressions;
using SqlSugar;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
namespace Yi.Framework.SqlSugarCore.Abstractions
{
public interface ISqlSugarRepository<TEntity>:IRepository<TEntity> where TEntity : class, IEntity,new ()
{
ISqlSugarClient _Db { get; }
ISugarQueryable<TEntity> _DbQueryable { get; }
Task<ISqlSugarClient> GetDbContextAsync();
Task<IDeleteable<TEntity>> AsDeleteable();
Task<IInsertable<TEntity>> AsInsertable(List<TEntity> insertObjs);
Task<IInsertable<TEntity>> AsInsertable(TEntity insertObj);
Task<IInsertable<TEntity>> AsInsertable(TEntity[] insertObjs);
Task<ISugarQueryable<TEntity>> AsQueryable();
Task<ISqlSugarClient> AsSugarClient();
Task<ITenant> AsTenant();
Task<IUpdateable<TEntity>> AsUpdateable(List<TEntity> updateObjs);
Task<IUpdateable<TEntity>> AsUpdateable(TEntity updateObj);
Task<IUpdateable<TEntity>> AsUpdateable();
Task<IUpdateable<TEntity>> AsUpdateable(TEntity[] updateObjs);
#region
//单查
Task<TEntity> GetByIdAsync(dynamic id);
Task<TEntity> GetSingleAsync(Expression<Func<TEntity, bool>> whereExpression);
Task<TEntity> GetFirstAsync(Expression<Func<TEntity, bool>> whereExpression);
Task<bool> IsAnyAsync(Expression<Func<TEntity, bool>> whereExpression);
Task<int> CountAsync(Expression<Func<TEntity, bool>> whereExpression);
#endregion
#region
//多查
Task<List<TEntity>> GetListAsync();
Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> whereExpression);
#endregion
#region
//分页查
Task<List<TEntity>> GetPageListAsync(Expression<Func<TEntity, bool>> whereExpression, int pageNum, int pageSize);
Task<List<TEntity>> GetPageListAsync(Expression<Func<TEntity, bool>> whereExpression, int pageNum, int pageSize, Expression<Func<TEntity, object>>? orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
#endregion
#region
//插入
Task<bool> InsertAsync(TEntity insertObj);
Task<bool> InsertOrUpdateAsync(TEntity data);
Task<bool> InsertOrUpdateAsync(List<TEntity> datas);
Task<int> InsertReturnIdentityAsync(TEntity insertObj);
Task<long> InsertReturnBigIdentityAsync(TEntity insertObj);
Task<long> InsertReturnSnowflakeIdAsync(TEntity insertObj);
Task<TEntity> InsertReturnEntityAsync(TEntity insertObj);
Task<bool> InsertRangeAsync(List<TEntity> insertObjs);
#endregion
#region
//更新
Task<bool> UpdateAsync(TEntity updateObj);
Task<bool> UpdateRangeAsync(List<TEntity> updateObjs);
Task<bool> UpdateAsync(Expression<Func<TEntity, TEntity>> columns, Expression<Func<TEntity, bool>> whereExpression);
#endregion
#region
//删除
Task<bool> DeleteAsync(TEntity deleteObj);
Task<bool> DeleteAsync(List<TEntity> deleteObjs);
Task<bool> DeleteAsync(Expression<Func<TEntity, bool>> whereExpression);
Task<bool> DeleteByIdAsync(dynamic id);
Task<bool> DeleteByIdsAsync(dynamic[] ids);
#endregion
}
public interface ISqlSugarRepository<TEntity, TKey> : ISqlSugarRepository<TEntity>,IRepository<TEntity, TKey> where TEntity : class, IEntity<TKey>, new()
{
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.SqlSugarCore.Abstractions
{
public interface ISugarDbContextProvider<TDbContext>
where TDbContext : ISqlSugarDbContext
{
Task<TDbContext> GetDbContextAsync();
}
}

View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.124" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="7.4.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.SqlSugarCore.Abstractions</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -0,0 +1,11 @@
using Volo.Abp.Modularity;
using Yi.Framework.Core;
namespace Yi.Framework.SqlSugarCore.Abstractions
{
[DependsOn(typeof(YiFrameworkCoreModule))]
public class YiFrameworkSqlSugarCoreAbstractionsModule : AbpModule
{
}
}

View File

@@ -1,11 +1,6 @@
using SqlSugar; using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Sqlsugar namespace Yi.Framework.SqlSugarCore
{ {
public class DbConnOptions public class DbConnOptions
{ {
@@ -34,6 +29,11 @@ namespace Yi.Framework.Infrastructure.Sqlsugar
/// </summary> /// </summary>
public bool EnabledCodeFirst { get; set; } = false; public bool EnabledCodeFirst { get; set; } = false;
/// <summary>
/// 开启sql日志
/// </summary>
public bool EnabledSqlLog { get; set; } = true;
/// <summary> /// <summary>
/// 实体程序集 /// 实体程序集
/// </summary> /// </summary>

View File

@@ -0,0 +1,362 @@
using System.Linq.Expressions;
using SqlSugar;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Linq;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore.Repositories
{
public class SqlSugarRepository<TEntity> : ISqlSugarRepository<TEntity>, IRepository<TEntity> where TEntity : class, IEntity, new()
{
public ISqlSugarClient _Db => GetDbContextAsync().Result;
public ISugarQueryable<TEntity> _DbQueryable => GetDbContextAsync().Result.Queryable<TEntity>();
private ISugarDbContextProvider<ISqlSugarDbContext> _sugarDbContextProvider;
public IAsyncQueryableExecuter AsyncExecuter { get; }
public SqlSugarRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider)
{
_sugarDbContextProvider = sugarDbContextProvider;
}
/// <summary>
/// 获取DB
/// </summary>
/// <returns></returns>
public virtual async Task<ISqlSugarClient> GetDbContextAsync()
{
var db = (await _sugarDbContextProvider.GetDbContextAsync()).SqlSugarClient;
await Console.Out.WriteLineAsync("获取的id" + db.ContextID);
return db;
}
/// <summary>
/// 获取简单Db
/// </summary>
/// <returns></returns>
public virtual async Task<SimpleClient<TEntity>> GetDbSimpleClientAsync()
{
var db = await GetDbContextAsync();
return new SimpleClient<TEntity>(db);
}
#region Abp模块
public async Task<TEntity?> FindAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = default)
{
return await GetFirstAsync(predicate);
}
public async Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = default)
{
return await GetFirstAsync(predicate);
}
public async Task DeleteAsync(Expression<Func<TEntity, bool>> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
await DeleteAsync(predicate);
}
public async Task DeleteDirectAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default)
{
await DeleteAsync(predicate);
}
public IQueryable<TEntity> WithDetails()
{
throw new NotImplementedException();
}
public IQueryable<TEntity> WithDetails(params Expression<Func<TEntity, object>>[] propertySelectors)
{
throw new NotImplementedException();
}
public Task<IQueryable<TEntity>> WithDetailsAsync()
{
throw new NotImplementedException();
}
public Task<IQueryable<TEntity>> WithDetailsAsync(params Expression<Func<TEntity, object>>[] propertySelectors)
{
throw new NotImplementedException();
}
public Task<IQueryable<TEntity>> GetQueryableAsync()
{
throw new NotImplementedException();
}
public async Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate, bool includeDetails = false, CancellationToken cancellationToken = default)
{
return await GetListAsync(predicate);
}
public async Task<TEntity> InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
return await InsertReturnEntityAsync(entity);
}
public async Task InsertManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default)
{
await InsertRangeAsync(entities.ToList());
}
public async Task<TEntity> UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
await UpdateAsync(entity);
return entity;
}
public async Task UpdateManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default)
{
await UpdateRangeAsync(entities.ToList());
}
public async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
await DeleteAsync(entity);
}
public async Task DeleteManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default)
{
await DeleteAsync(entities.ToList());
}
public async Task<List<TEntity>> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
return await GetListAsync();
}
public async Task<long> GetCountAsync(CancellationToken cancellationToken = default)
{
return await this.CountAsync();
}
public async Task<List<TEntity>> GetPagedListAsync(int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default)
{
return await GetPageListAsync(_ => true, skipCount, maxResultCount);
}
#endregion
#region DB快捷操作
public async Task<IDeleteable<TEntity>> AsDeleteable()
{
return (await GetDbSimpleClientAsync()).AsDeleteable();
}
public async Task<IInsertable<TEntity>> AsInsertable(List<TEntity> insertObjs)
{
return (await GetDbSimpleClientAsync()).AsInsertable(insertObjs);
}
public async Task<IInsertable<TEntity>> AsInsertable(TEntity insertObj)
{
return (await GetDbSimpleClientAsync()).AsInsertable(insertObj);
}
public async Task<IInsertable<TEntity>> AsInsertable(TEntity[] insertObjs)
{
return (await GetDbSimpleClientAsync()).AsInsertable(insertObjs);
}
public async Task<ISugarQueryable<TEntity>> AsQueryable()
{
return (await GetDbSimpleClientAsync()).AsQueryable();
}
public async Task<ISqlSugarClient> AsSugarClient()
{
return (await GetDbSimpleClientAsync()).AsSugarClient();
}
public async Task<ITenant> AsTenant()
{
return (await GetDbSimpleClientAsync()).AsTenant();
}
public async Task<IUpdateable<TEntity>> AsUpdateable(List<TEntity> updateObjs)
{
return (await GetDbSimpleClientAsync()).AsUpdateable(updateObjs);
}
public async Task<IUpdateable<TEntity>> AsUpdateable(TEntity updateObj)
{
return (await GetDbSimpleClientAsync()).AsUpdateable(updateObj);
}
public async Task<IUpdateable<TEntity>> AsUpdateable()
{
return (await GetDbSimpleClientAsync()).AsUpdateable();
}
public async Task<IUpdateable<TEntity>> AsUpdateable(TEntity[] updateObjs)
{
return (await GetDbSimpleClientAsync()).AsUpdateable(updateObjs);
}
#endregion
#region SimpleClient模块
public async Task<int> CountAsync(Expression<Func<TEntity, bool>> whereExpression)
{
return await (await GetDbSimpleClientAsync()).CountAsync(whereExpression);
}
public async Task<bool> DeleteAsync(TEntity deleteObj)
{
return await (await GetDbSimpleClientAsync()).DeleteAsync(deleteObj);
}
public async Task<bool> DeleteAsync(List<TEntity> deleteObjs)
{
return await (await GetDbSimpleClientAsync()).DeleteAsync(deleteObjs);
}
public async Task<bool> DeleteAsync(Expression<Func<TEntity, bool>> whereExpression)
{
return await (await GetDbSimpleClientAsync()).DeleteAsync(whereExpression);
}
public async Task<bool> DeleteByIdAsync(dynamic id)
{
return await (await GetDbSimpleClientAsync()).DeleteByIdAsync(id);
}
public async Task<bool> DeleteByIdsAsync(dynamic[] ids)
{
return await (await GetDbSimpleClientAsync()).DeleteByIdAsync(ids);
}
public async Task<TEntity> GetByIdAsync(dynamic id)
{
return await (await GetDbSimpleClientAsync()).GetByIdAsync(id);
}
public async Task<TEntity> GetFirstAsync(Expression<Func<TEntity, bool>> whereExpression)
{
return await (await GetDbSimpleClientAsync()).GetFirstAsync(whereExpression);
}
public async Task<List<TEntity>> GetListAsync()
{
return await (await GetDbSimpleClientAsync()).GetListAsync();
}
public async Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> whereExpression)
{
return await (await GetDbSimpleClientAsync()).GetListAsync(whereExpression);
}
public async Task<List<TEntity>> GetPageListAsync(Expression<Func<TEntity, bool>> whereExpression, int pageNum, int pageSize)
{
return await (await GetDbSimpleClientAsync()).GetPageListAsync(whereExpression, new PageModel() { PageIndex = pageNum, PageSize = pageSize });
}
public async Task<List<TEntity>> GetPageListAsync(Expression<Func<TEntity, bool>> whereExpression, int pageNum, int pageSize, Expression<Func<TEntity, object>>? orderByExpression = null, OrderByType orderByType = OrderByType.Asc)
{
return await (await GetDbSimpleClientAsync()).GetPageListAsync(whereExpression, new PageModel { PageIndex = pageNum, PageSize = pageSize }, orderByExpression, orderByType);
}
public async Task<TEntity> GetSingleAsync(Expression<Func<TEntity, bool>> whereExpression)
{
return await (await GetDbSimpleClientAsync()).GetSingleAsync(whereExpression);
}
public async Task<bool> InsertAsync(TEntity insertObj)
{
return await (await GetDbSimpleClientAsync()).InsertAsync(insertObj);
}
public async Task<bool> InsertOrUpdateAsync(TEntity data)
{
return await (await GetDbSimpleClientAsync()).InsertOrUpdateAsync(data);
}
public async Task<bool> InsertOrUpdateAsync(List<TEntity> datas)
{
return await (await GetDbSimpleClientAsync()).InsertOrUpdateAsync(datas);
}
public async Task<bool> InsertRangeAsync(List<TEntity> insertObjs)
{
return await (await GetDbSimpleClientAsync()).InsertRangeAsync(insertObjs);
}
public async Task<long> InsertReturnBigIdentityAsync(TEntity insertObj)
{
return await (await GetDbSimpleClientAsync()).InsertReturnBigIdentityAsync(insertObj);
}
public async Task<TEntity> InsertReturnEntityAsync(TEntity insertObj)
{
return await (await GetDbSimpleClientAsync()).InsertReturnEntityAsync(insertObj);
}
public async Task<int> InsertReturnIdentityAsync(TEntity insertObj)
{
return await (await GetDbSimpleClientAsync()).InsertReturnIdentityAsync(insertObj);
}
public async Task<long> InsertReturnSnowflakeIdAsync(TEntity insertObj)
{
return await (await GetDbSimpleClientAsync()).InsertReturnSnowflakeIdAsync(insertObj);
}
public async Task<bool> IsAnyAsync(Expression<Func<TEntity, bool>> whereExpression)
{
return await (await GetDbSimpleClientAsync()).IsAnyAsync(whereExpression);
}
public async Task<bool> UpdateAsync(TEntity updateObj)
{
return await (await GetDbSimpleClientAsync()).UpdateAsync(updateObj);
}
public async Task<bool> UpdateAsync(Expression<Func<TEntity, TEntity>> columns, Expression<Func<TEntity, bool>> whereExpression)
{
return await (await GetDbSimpleClientAsync()).UpdateAsync(columns, whereExpression);
}
public async Task<bool> UpdateRangeAsync(List<TEntity> updateObjs)
{
return await (await GetDbSimpleClientAsync()).UpdateRangeAsync(updateObjs);
}
#endregion
}
public class SqlSugarRepository<TEntity, TKey> : SqlSugarRepository<TEntity>, ISqlSugarRepository<TEntity,TKey>, IRepository<TEntity, TKey> where TEntity : class, IEntity<TKey>, new()
{
public SqlSugarRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(sugarDbContextProvider)
{
}
public async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default)
{
await DeleteByIdAsync(id);
}
public async Task DeleteManyAsync(IEnumerable<TKey> ids, bool autoSave = false, CancellationToken cancellationToken = default)
{
await DeleteByIdsAsync(ids.Select(x => (object)x).ToArray());
}
public async Task<TEntity?> FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
return await GetByIdAsync(id);
}
public async Task<TEntity> GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{
return await GetByIdAsync(id);
}
}
}

View File

@@ -0,0 +1,239 @@
using System.Reflection;
using System.Text;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Users;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore
{
public class SqlSugarDbContext : ISqlSugarDbContext
{
/// <summary>
/// SqlSugar 客户端
/// </summary>
public ISqlSugarClient SqlSugarClient { get; }
public ICurrentUser CurrentUser => LazyServiceProvider.GetRequiredService<ICurrentUser>();
private IAbpLazyServiceProvider LazyServiceProvider { get; }
private IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetRequiredService<IGuidGenerator>();
protected ILoggerFactory Logger => LazyServiceProvider.LazyGetRequiredService<ILoggerFactory>();
private ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService<ICurrentTenant>();
public IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService<IDataFilter>();
protected virtual bool IsMultiTenantFilterEnabled => DataFilter?.IsEnabled<IMultiTenant>() ?? false;
protected virtual bool IsSoftDeleteFilterEnabled => DataFilter?.IsEnabled<ISoftDelete>() ?? false;
public IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService<IEntityChangeEventHelper>(NullEntityChangeEventHelper.Instance);
protected DbConnOptions Options => LazyServiceProvider.LazyGetRequiredService<IOptions<DbConnOptions>>().Value;
public SqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider)
{
LazyServiceProvider = lazyServiceProvider;
var dbConnOptions = Options;
#region options
if (dbConnOptions.DbType is null)
{
throw new ArgumentException("DbType配置为空");
}
var slavaConFig = new List<SlaveConnectionConfig>();
if (dbConnOptions.EnabledReadWrite)
{
if (dbConnOptions.ReadUrl is null)
{
throw new ArgumentException("读写分离为空");
}
var readCon = dbConnOptions.ReadUrl;
readCon.ForEach(s =>
{
//如果是动态saas分库这里的连接串都不能写死需要动态添加这里只配置共享库的连接
slavaConFig.Add(new SlaveConnectionConfig() { ConnectionString = s });
});
}
#endregion
SqlSugarClient = new SqlSugarClient(new ConnectionConfig()
{
//准备添加分表分库
DbType = dbConnOptions.DbType ?? DbType.Sqlite,
ConnectionString = dbConnOptions.Url,
IsAutoCloseConnection = true,
SlaveConnectionConfigs = slavaConFig,
//设置codefirst非空值判断
ConfigureExternalServices = new ConfigureExternalServices
{
EntityService = (c, p) =>
{
if (new NullabilityInfoContext()
.Create(c).WriteState is NullabilityState.Nullable)
{
p.IsNullable = true;
}
}
}
},
db =>
{
db.Aop.DataExecuting = DataExecuting;
db.Aop.DataExecuted = DataExecuted;
db.Aop.OnLogExecuting = OnLogExecuting;
db.Aop.OnLogExecuted = OnLogExecuted;
//扩展
OnSqlSugarClientConfig(db);
});
}
/// <summary>
/// 上下文对象扩展
/// </summary>
/// <param name="sqlSugarClient"></param>
protected virtual void OnSqlSugarClientConfig(ISqlSugarClient sqlSugarClient)
{
//需自定义扩展
if (IsSoftDeleteFilterEnabled)
{
sqlSugarClient.QueryFilter.AddTableFilter<ISoftDelete>(u => u.IsDeleted == false);
}
if (IsMultiTenantFilterEnabled)
{
sqlSugarClient.QueryFilter.AddTableFilter<IMultiTenant>(u => u.TenantId == GuidGenerator.Create());
}
CustomDataFilter();
}
protected virtual void CustomDataFilter()
{
}
protected virtual void DataExecuted(object oldValue, DataAfterModel entityInfo)
{
}
/// <summary>
/// 数据
/// </summary>
/// <param name="oldValue"></param>
/// <param name="entityInfo"></param>
protected virtual void DataExecuting(object oldValue, DataFilterModel entityInfo)
{
//审计日志
switch (entityInfo.OperationType)
{
case DataFilterType.UpdateByObject:
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModificationTime)))
{
if (!DateTime.MinValue.Equals(oldValue))
{
entityInfo.SetValue(DateTime.Now);
}
}
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModifierId)))
{
if (CurrentUser != null)
{
entityInfo.SetValue(CurrentUser.Id);
}
}
break;
case DataFilterType.InsertByObject:
if (entityInfo.PropertyName.Equals(nameof(IEntity<Guid>.Id)))
{
//主键为空或者为默认最小值
if (Guid.Empty.Equals(oldValue))
{
entityInfo.SetValue(GuidGenerator.Create());
}
}
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreationTime)))
{
//为空或者为默认最小值
if (oldValue is null || DateTime.MinValue.Equals((DateTime)oldValue))
{
entityInfo.SetValue(DateTime.Now);
}
}
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreatorId)))
{
if (CurrentUser != null)
{
entityInfo.SetValue(CurrentUser.Id);
}
}
//插入时需要租户id,先预留
if (entityInfo.PropertyName.Equals(nameof(IMultiTenant.TenantId)))
{
if (CurrentTenant is not null)
{
entityInfo.SetValue(CurrentTenant.Id);
}
}
break;
}
//领域事件
switch (entityInfo.OperationType)
{
case DataFilterType.InsertByObject:
if (entityInfo.PropertyName == nameof(IEntity<object>.Id))
{
EntityChangeEventHelper.PublishEntityCreatedEvent(entityInfo.EntityValue);
}
break;
case DataFilterType.UpdateByObject:
if (entityInfo.PropertyName == nameof(IEntity<object>.Id))
{
EntityChangeEventHelper.PublishEntityUpdatedEvent(entityInfo.EntityValue);
}
break;
case DataFilterType.DeleteByObject:
if (entityInfo.PropertyName == nameof(IEntity<object>.Id))
{
EntityChangeEventHelper.PublishEntityDeletedEvent(entityInfo.EntityValue);
}
break;
}
}
/// <summary>
/// 日志
/// </summary>
/// <param name="sql"></param>
/// <param name="pars"></param>
protected virtual void OnLogExecuting(string sql , SugarParameter[] pars)
{
if (Options.EnabledSqlLog)
{
Logger.CreateLogger<SqlSugarDbContext>().LogDebug(UtilMethods.GetSqlString(DbType.SqlServer, sql, pars));
}
}
/// <summary>
/// 日志
/// </summary>
/// <param name="sql"></param>
/// <param name="pars"></param>
protected virtual void OnLogExecuted(string sql, SugarParameter[] pars)
{
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Auditing;
using Volo.Abp.DependencyInjection;
namespace Yi.Framework.SqlSugarCore
{
public class SqlSugarLogAuditingStore : IAuditingStore, ISingletonDependency
{
public Task SaveAsync(AuditLogInfo auditInfo)
{
Console.WriteLine(auditInfo.ExecutionTime);
return Task.CompletedTask;
}
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore
{
public static class SqlsugarCoreExtensions
{
public static IServiceCollection AddYiDbContext<DbContext>(this IServiceCollection service) where DbContext : class, ISqlSugarDbContext
{
service.Replace(new ServiceDescriptor(typeof(ISqlSugarDbContext), typeof(DbContext), ServiceLifetime.Scoped));
return service;
}
public static IServiceCollection AddYiDbContext<DbContext>(this IServiceCollection service,Action<DbConnOptions> options) where DbContext : class, ISqlSugarDbContext
{
service.Configure<DbConnOptions>(ops => {
options.Invoke(ops);
});
service.AddYiDbContext<DbContext>();
return service;
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Uow;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore.Uow
{
public class SqlSugarDatabaseApi : IDatabaseApi
{
public ISqlSugarDbContext DbContext { get; }
public SqlSugarDatabaseApi(ISqlSugarDbContext dbContext)
{
DbContext = dbContext;
}
}
}

View File

@@ -0,0 +1,38 @@
using Volo.Abp.Uow;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore.Uow
{
public class SqlSugarTransactionApi : ITransactionApi, ISupportsRollback
{
private ISqlSugarDbContext _sqlsugarDbContext;
public SqlSugarTransactionApi(ISqlSugarDbContext sqlsugarDbContext)
{
_sqlsugarDbContext = sqlsugarDbContext;
}
public async Task CommitAsync(CancellationToken cancellationToken = default)
{
await Console.Out.WriteLineAsync("事务提交");
Console.WriteLine(_sqlsugarDbContext.SqlSugarClient.ContextID + "---------------");
await _sqlsugarDbContext.SqlSugarClient.Ado.CommitTranAsync();
}
public void Dispose()
{
Console.WriteLine("Dispose");
}
public async Task RollbackAsync(CancellationToken cancellationToken = default)
{
await Console.Out.WriteLineAsync("事务回滚");
Console.WriteLine(_sqlsugarDbContext.SqlSugarClient.ContextID);
await _sqlsugarDbContext.SqlSugarClient.Ado.RollbackTranAsync();
}
}
}

View File

@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging;
using Volo.Abp.Data;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
using Volo.Abp;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore.Uow
{
public class UnitOfWorkSqlsugarDbContextProvider<TDbContext> : ISugarDbContextProvider<TDbContext> where TDbContext : ISqlSugarDbContext
{
public ILogger<UnitOfWorkSqlsugarDbContextProvider<TDbContext>> Logger { get; set; }
protected readonly IUnitOfWorkManager UnitOfWorkManager;
protected readonly IConnectionStringResolver ConnectionStringResolver;
protected readonly ICancellationTokenProvider CancellationTokenProvider;
protected readonly ICurrentTenant CurrentTenant;
public UnitOfWorkSqlsugarDbContextProvider(
IUnitOfWorkManager unitOfWorkManager,
IConnectionStringResolver connectionStringResolver,
ICancellationTokenProvider cancellationTokenProvider,
ICurrentTenant currentTenant
)
{
UnitOfWorkManager = unitOfWorkManager;
ConnectionStringResolver = connectionStringResolver;
CancellationTokenProvider = cancellationTokenProvider;
CurrentTenant = currentTenant;
Logger = NullLogger<UnitOfWorkSqlsugarDbContextProvider<TDbContext>>.Instance;
}
public virtual async Task<TDbContext> GetDbContextAsync()
{
var unitOfWork = UnitOfWorkManager.Current;
if (unitOfWork == null)
{
throw new AbpException("A DbContext can only be created inside a unit of work!");
}
//var sss= unitOfWork.ServiceProvider.GetRequiredService<TDbContext>();
//Console.WriteLine("反户的:"+sss.SqlSugarClient.ContextID);
//return sss;
var connectionStringName = "Default";
var connectionString = await ResolveConnectionStringAsync(connectionStringName);
// var dbContextKey = $"{this.GetType().FullName}_{connectionString}";
var dbContextKey = "Default";
var databaseApi = unitOfWork.FindDatabaseApi(dbContextKey);
if (databaseApi == null)
{
databaseApi = new SqlSugarDatabaseApi(
await CreateDbContextAsync(unitOfWork, connectionStringName, connectionString)
);
unitOfWork.AddDatabaseApi(dbContextKey, databaseApi);
}
return (TDbContext)((SqlSugarDatabaseApi)databaseApi).DbContext; ;
}
protected virtual async Task<TDbContext> CreateDbContextAsync(IUnitOfWork unitOfWork, string connectionStringName, string connectionString)
{
var dbContext = await CreateDbContextAsync(unitOfWork);
Console.WriteLine("111111" + dbContext.SqlSugarClient.ContextID);
return dbContext;
}
protected virtual async Task<TDbContext> CreateDbContextAsync(IUnitOfWork unitOfWork)
{
return unitOfWork.Options.IsTransactional
? await CreateDbContextWithTransactionAsync(unitOfWork)
: unitOfWork.ServiceProvider.GetRequiredService<TDbContext>();
}
protected virtual async Task<TDbContext> CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork)
{
var transactionApiKey = $"Sqlsugar_Default".ToString();
var activeTransaction = unitOfWork.FindTransactionApi(transactionApiKey) as SqlSugarDatabaseApi;
if (activeTransaction == null)
{
var dbContext = unitOfWork.ServiceProvider.GetRequiredService<TDbContext>();
var transaction = new SqlSugarTransactionApi(
dbContext
);
unitOfWork.AddTransactionApi(transactionApiKey, transaction);
await Console.Out.WriteLineAsync("开始新的事务");
Console.WriteLine(dbContext.SqlSugarClient.ContextID);
await dbContext.SqlSugarClient.Ado.BeginTranAsync();
return dbContext;
}
else
{
await Console.Out.WriteLineAsync("继续老的事务");
Console.WriteLine(activeTransaction.DbContext.SqlSugarClient);
await activeTransaction.DbContext.SqlSugarClient.Ado.BeginTranAsync();
return (TDbContext)activeTransaction.DbContext;
}
}
protected virtual async Task<string> ResolveConnectionStringAsync(string connectionStringName)
{
if (typeof(TDbContext).IsDefined(typeof(IgnoreMultiTenancyAttribute), false))
{
using (CurrentTenant.Change(null))
{
return await ConnectionStringResolver.ResolveAsync(connectionStringName);
}
}
return await ConnectionStringResolver.ResolveAsync(connectionStringName);
}
}
}

View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SqlSugarCore" Version="5.1.4.124" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.SqlSugarCore.Abstractions\Yi.Framework.SqlSugarCore.Abstractions.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,92 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.SqlSugarCore</name>
</assembly>
<members>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.Url">
<summary>
连接字符串,必填
</summary>
</member>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.DbType">
<summary>
数据库类型
</summary>
</member>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.EnabledDbSeed">
<summary>
开启种子数据
</summary>
</member>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.EnabledReadWrite">
<summary>
开启读写分离
</summary>
</member>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.EnabledCodeFirst">
<summary>
开启codefirst
</summary>
</member>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.EnabledSqlLog">
<summary>
开启sql日志
</summary>
</member>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.EntityAssembly">
<summary>
实体程序集
</summary>
</member>
<member name="P:Yi.Framework.SqlSugarCore.DbConnOptions.ReadUrl">
<summary>
读写分离
</summary>
</member>
<member name="M:Yi.Framework.SqlSugarCore.Repositories.SqlSugarRepository`1.GetDbContextAsync">
<summary>
获取DB
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.SqlSugarCore.Repositories.SqlSugarRepository`1.GetDbSimpleClientAsync">
<summary>
获取简单Db
</summary>
<returns></returns>
</member>
<member name="P:Yi.Framework.SqlSugarCore.SqlSugarDbContext.SqlSugarClient">
<summary>
SqlSugar 客户端
</summary>
</member>
<member name="M:Yi.Framework.SqlSugarCore.SqlSugarDbContext.OnSqlSugarClientConfig(SqlSugar.ISqlSugarClient)">
<summary>
上下文对象扩展
</summary>
<param name="sqlSugarClient"></param>
</member>
<member name="M:Yi.Framework.SqlSugarCore.SqlSugarDbContext.DataExecuting(System.Object,SqlSugar.DataFilterModel)">
<summary>
数据
</summary>
<param name="oldValue"></param>
<param name="entityInfo"></param>
</member>
<member name="M:Yi.Framework.SqlSugarCore.SqlSugarDbContext.OnLogExecuting(System.String,SqlSugar.SugarParameter[])">
<summary>
日志
</summary>
<param name="sql"></param>
<param name="pars"></param>
</member>
<member name="M:Yi.Framework.SqlSugarCore.SqlSugarDbContext.OnLogExecuted(System.String,SqlSugar.SugarParameter[])">
<summary>
日志
</summary>
<param name="sql"></param>
<param name="pars"></param>
</member>
</members>
</doc>

View File

@@ -0,0 +1,97 @@
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Modularity;
using Yi.Framework.SqlSugarCore.Abstractions;
using Yi.Framework.SqlSugarCore.Repositories;
using Yi.Framework.SqlSugarCore.Uow;
namespace Yi.Framework.SqlSugarCore
{
[DependsOn(typeof(AbpDddDomainModule))]
public class YiFrameworkSqlSugarCoreModule : AbpModule
{
public override Task ConfigureServicesAsync(ServiceConfigurationContext context)
{
var service = context.Services;
var configuration = service.GetConfiguration();
Configure<DbConnOptions>(configuration.GetSection("DbConnOptions"));
service.TryAddScoped<ISqlSugarDbContext, SqlSugarDbContext>();
//不开放sqlsugarClient
//service.AddTransient<ISqlSugarClient>(x => x.GetRequiredService<ISqlsugarDbContext>().SqlSugarClient);
service.AddTransient(typeof(IRepository<>), typeof(SqlSugarRepository<>));
service.AddTransient(typeof(IRepository<,>), typeof(SqlSugarRepository<,>));
service.AddTransient(typeof(ISqlSugarRepository<>), typeof(SqlSugarRepository<>));
service.AddTransient(typeof(ISqlSugarRepository<,>), typeof(SqlSugarRepository<,>));
service.AddTransient<IAuditingStore, SqlSugarLogAuditingStore>();
service.AddTransient(typeof(ISugarDbContextProvider<>), typeof(UnitOfWorkSqlsugarDbContextProvider<>));
return Task.CompletedTask;
}
public override Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
{
var service = context.ServiceProvider;
return base.OnApplicationInitializationAsync(context);
}
public override async void OnPreApplicationInitialization(ApplicationInitializationContext context)
{
//进行CodeFirst
var service = context.ServiceProvider;
var options = service.GetRequiredService<IOptions<DbConnOptions>>().Value;
if (options.EnabledCodeFirst)
{
CodeFirst(service);
}
if (options.EnabledCodeFirst)
{
await DataSeedAsync(service);
}
}
private void CodeFirst(IServiceProvider service)
{
var options = service.GetRequiredService<IOptions<DbConnOptions>>().Value;
if (options.EnabledCodeFirst)
{
var moduleContainer = service.GetRequiredService<IModuleContainer>();
var db = service.GetRequiredService<ISqlSugarDbContext>().SqlSugarClient;
List<Type> types = new List<Type>();
foreach (var module in moduleContainer.Modules)
{
types.AddRange(module.Assembly.GetTypes().Where(x => x.GetCustomAttribute<SugarTable>() != null).Where(x => x.GetCustomAttribute<SplitTableAttribute>() is null));
}
if (types.Count > 0)
{
db.CodeFirst.InitTables(types.ToArray());
}
}
}
private async Task DataSeedAsync(IServiceProvider service)
{
var dataSeeder = service.GetRequiredService<IDataSeeder>();
await dataSeeder.SeedAsync();
}
}
}

View File

@@ -0,0 +1,10 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.AccessLog
{
public class AccessLogDto
{
public Guid Id { get; set; }
public long Number { get; set; }
public DateTime? LastModificationTime { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -1,10 +1,4 @@
using System; namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Argee
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.Dtos.Argee
{ {
public class AgreeDto public class AgreeDto
{ {

View File

@@ -0,0 +1,16 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleAllOutputDto : EntityDto<Guid>
{
//批量查询,不给内容,性能考虑
//public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
public List<ArticleAllOutputDto>? Children { get; set; }
}
}

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.Dtos.Article namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{ {
/// <summary> /// <summary>
/// Article输入创建对象 /// Article输入创建对象
@@ -13,7 +13,7 @@ namespace Yi.Furion.Core.Bbs.Dtos.Article
{ {
public string Content { get; set; } public string Content { get; set; }
public string Name { get; set; } public string Name { get; set; }
public long DiscussId { get; set; } public Guid DiscussId { get; set; }
public long ParentId { get; set; } public Guid ParentId { get; set; }
} }
} }

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleGetListInputVo : PagedAndSortedResultRequestDto
{
public string? Content { get; set; }
public string? Name { get; set; }
public Guid? DiscussId { get; set; }
public Guid? ParentId { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleGetListOutputDto : EntityDto<Guid>
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
//public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public List<ArticleGetListOutputDto>? Children { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleGetOutputDto : EntityDto<Guid>
{
public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleUpdateInputVo
{
public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
}
}

View File

@@ -1,10 +1,4 @@
using System; namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.Dtos.Banner
{ {
/// <summary> /// <summary>
/// Banner输入创建对象 /// Banner输入创建对象

View File

@@ -0,0 +1,9 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{
public class BannerGetListInputVo : PagedAndSortedResultRequestDto
{
public string? Name { get; set; }
}
}

View File

@@ -1,11 +1,9 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract; using Volo.Abp.Application.Dtos;
namespace Yi.Furion.Core.Bbs.Dtos.Banner namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{ {
public class BannerGetListOutputDto : IEntityDto<long> public class BannerGetListOutputDto : EntityDto<Guid>
{ {
public long Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string? Logo { get; set; } public string? Logo { get; set; }
public string? Color { get; set; } public string? Color { get; set; }

View File

@@ -1,11 +1,9 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract; using Volo.Abp.Application.Dtos;
namespace Yi.Furion.Core.Bbs.Dtos.Banner namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{ {
public class BannerGetOutputDto : IEntityDto<long> public class BannerGetOutputDto : EntityDto<Guid>
{ {
public long Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string? Logo { get; set; } public string? Logo { get; set; }
public string? Color { get; set; } public string? Color { get; set; }

View File

@@ -1,4 +1,4 @@
namespace Yi.Furion.Core.Bbs.Dtos.Banner namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{ {
public class BannerUpdateInputVo public class BannerUpdateInputVo
{ {

Some files were not shown because too many files have changed in this diff Show More