1426 changed files with 70621 additions and 122030 deletions
@ -0,0 +1,265 @@ |
|||||
|
## Ignore Visual Studio temporary files, build results, and |
||||
|
## files generated by popular Visual Studio add-ons. |
||||
|
|
||||
|
# User-specific files |
||||
|
*.suo |
||||
|
*.user |
||||
|
*.userosscache |
||||
|
*.sln.docstates |
||||
|
|
||||
|
# User-specific files (MonoDevelop/Xamarin Studio) |
||||
|
*.userprefs |
||||
|
|
||||
|
# Build results |
||||
|
[Dd]ebug/ |
||||
|
[Dd]ebugPublic/ |
||||
|
[Rr]elease/ |
||||
|
[Rr]eleases/ |
||||
|
x64/ |
||||
|
x86/ |
||||
|
bld/ |
||||
|
[Bb]in/ |
||||
|
[Oo]bj/ |
||||
|
[Ll]og/ |
||||
|
|
||||
|
# Visual Studio 2015 cache/options directory |
||||
|
.vs/ |
||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot |
||||
|
#wwwroot/ |
||||
|
|
||||
|
# MSTest test Results |
||||
|
[Tt]est[Rr]esult*/ |
||||
|
[Bb]uild[Ll]og.* |
||||
|
|
||||
|
# NUNIT |
||||
|
*.VisualState.xml |
||||
|
TestResult.xml |
||||
|
|
||||
|
# Build Results of an ATL Project |
||||
|
[Dd]ebugPS/ |
||||
|
[Rr]eleasePS/ |
||||
|
dlldata.c |
||||
|
|
||||
|
# DNX |
||||
|
project.lock.json |
||||
|
artifacts/ |
||||
|
|
||||
|
*_i.c |
||||
|
*_p.c |
||||
|
*_i.h |
||||
|
*.ilk |
||||
|
*.meta |
||||
|
*.obj |
||||
|
*.pch |
||||
|
*.pdb |
||||
|
*.pgc |
||||
|
*.pgd |
||||
|
*.rsp |
||||
|
*.sbr |
||||
|
*.tlb |
||||
|
*.tli |
||||
|
*.tlh |
||||
|
*.tmp |
||||
|
*.tmp_proj |
||||
|
*.log |
||||
|
*.vspscc |
||||
|
*.vssscc |
||||
|
.builds |
||||
|
*.pidb |
||||
|
*.svclog |
||||
|
*.scc |
||||
|
|
||||
|
# Chutzpah Test files |
||||
|
_Chutzpah* |
||||
|
|
||||
|
# Visual C++ cache files |
||||
|
ipch/ |
||||
|
*.aps |
||||
|
*.ncb |
||||
|
*.opendb |
||||
|
*.opensdf |
||||
|
*.sdf |
||||
|
*.cachefile |
||||
|
*.VC.db |
||||
|
*.VC.VC.opendb |
||||
|
|
||||
|
# Visual Studio profiler |
||||
|
*.psess |
||||
|
*.vsp |
||||
|
*.vspx |
||||
|
*.sap |
||||
|
|
||||
|
# TFS 2012 Local Workspace |
||||
|
$tf/ |
||||
|
|
||||
|
# Guidance Automation Toolkit |
||||
|
*.gpState |
||||
|
|
||||
|
# ReSharper is a .NET coding add-in |
||||
|
_ReSharper*/ |
||||
|
*.[Rr]e[Ss]harper |
||||
|
*.DotSettings.user |
||||
|
|
||||
|
# JustCode is a .NET coding add-in |
||||
|
.JustCode |
||||
|
|
||||
|
# TeamCity is a build add-in |
||||
|
_TeamCity* |
||||
|
|
||||
|
# DotCover is a Code Coverage Tool |
||||
|
*.dotCover |
||||
|
|
||||
|
# NCrunch |
||||
|
_NCrunch_* |
||||
|
.*crunch*.local.xml |
||||
|
nCrunchTemp_* |
||||
|
|
||||
|
# MightyMoose |
||||
|
*.mm.* |
||||
|
AutoTest.Net/ |
||||
|
|
||||
|
# Web workbench (sass) |
||||
|
.sass-cache/ |
||||
|
|
||||
|
# Installshield output folder |
||||
|
[Ee]xpress/ |
||||
|
|
||||
|
# DocProject is a documentation generator add-in |
||||
|
DocProject/buildhelp/ |
||||
|
DocProject/Help/*.HxT |
||||
|
DocProject/Help/*.HxC |
||||
|
DocProject/Help/*.hhc |
||||
|
DocProject/Help/*.hhk |
||||
|
DocProject/Help/*.hhp |
||||
|
DocProject/Help/Html2 |
||||
|
DocProject/Help/html |
||||
|
|
||||
|
# Click-Once directory |
||||
|
publish/ |
||||
|
|
||||
|
# Publish Web Output |
||||
|
*.[Pp]ublish.xml |
||||
|
*.azurePubxml |
||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings |
||||
|
# but database connection strings (with potential passwords) will be unencrypted |
||||
|
*.pubxml |
||||
|
*.publishproj |
||||
|
|
||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
||||
|
# checkin your Azure Web App publish settings, but sensitive information contained |
||||
|
# in these scripts will be unencrypted |
||||
|
PublishScripts/ |
||||
|
|
||||
|
# NuGet Packages |
||||
|
*.nupkg |
||||
|
# The packages folder can be ignored because of Package Restore |
||||
|
**/packages/* |
||||
|
# except build/, which is used as an MSBuild target. |
||||
|
!**/packages/build/ |
||||
|
# Uncomment if necessary however generally it will be regenerated when needed |
||||
|
#!**/packages/repositories.config |
||||
|
# NuGet v3's project.json files produces more ignoreable files |
||||
|
*.nuget.props |
||||
|
*.nuget.targets |
||||
|
|
||||
|
# Microsoft Azure Build Output |
||||
|
csx/ |
||||
|
*.build.csdef |
||||
|
|
||||
|
# Microsoft Azure Emulator |
||||
|
ecf/ |
||||
|
rcf/ |
||||
|
|
||||
|
# Windows Store app package directories and files |
||||
|
AppPackages/ |
||||
|
BundleArtifacts/ |
||||
|
Package.StoreAssociation.xml |
||||
|
_pkginfo.txt |
||||
|
|
||||
|
# Visual Studio cache files |
||||
|
# files ending in .cache can be ignored |
||||
|
*.[Cc]ache |
||||
|
# but keep track of directories ending in .cache |
||||
|
!*.[Cc]ache/ |
||||
|
|
||||
|
# Others |
||||
|
ClientBin/ |
||||
|
~$* |
||||
|
*~ |
||||
|
*.dbmdl |
||||
|
*.dbproj.schemaview |
||||
|
*.pfx |
||||
|
*.publishsettings |
||||
|
node_modules/ |
||||
|
orleans.codegen.cs |
||||
|
|
||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components |
||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
||||
|
#bower_components/ |
||||
|
|
||||
|
# RIA/Silverlight projects |
||||
|
Generated_Code/ |
||||
|
|
||||
|
# Backup & report files from converting an old project file |
||||
|
# to a newer Visual Studio version. Backup files are not needed, |
||||
|
# because we have git ;-) |
||||
|
_UpgradeReport_Files/ |
||||
|
Backup*/ |
||||
|
UpgradeLog*.XML |
||||
|
UpgradeLog*.htm |
||||
|
|
||||
|
# SQL Server files |
||||
|
*.mdf |
||||
|
*.ldf |
||||
|
|
||||
|
# Business Intelligence projects |
||||
|
*.rdl.data |
||||
|
*.bim.layout |
||||
|
*.bim_*.settings |
||||
|
|
||||
|
# Microsoft Fakes |
||||
|
FakesAssemblies/ |
||||
|
|
||||
|
# GhostDoc plugin setting file |
||||
|
*.GhostDoc.xml |
||||
|
|
||||
|
# Node.js Tools for Visual Studio |
||||
|
.ntvs_analysis.dat |
||||
|
|
||||
|
# Visual Studio 6 build log |
||||
|
*.plg |
||||
|
|
||||
|
# Visual Studio 6 workspace options file |
||||
|
*.opt |
||||
|
|
||||
|
# Visual Studio LightSwitch build output |
||||
|
**/*.HTMLClient/GeneratedArtifacts |
||||
|
**/*.DesktopClient/GeneratedArtifacts |
||||
|
**/*.DesktopClient/ModelManifest.xml |
||||
|
**/*.Server/GeneratedArtifacts |
||||
|
**/*.Server/ModelManifest.xml |
||||
|
_Pvt_Extensions |
||||
|
|
||||
|
# Paket dependency manager |
||||
|
.paket/paket.exe |
||||
|
paket-files/ |
||||
|
|
||||
|
# FAKE - F# Make |
||||
|
.fake/ |
||||
|
|
||||
|
# JetBrains Rider |
||||
|
.idea/ |
||||
|
*.sln.iml |
||||
|
|
||||
|
# TemplateManagement |
||||
|
content/src/TemplateManagement.Web/Logs/* |
||||
|
content/src/TemplateManagement.Web.Host/Logs/* |
||||
|
content/src/TemplateManagement.IdentityServer/Logs/* |
||||
|
content/src/TemplateManagement.HttpApi.Host/Logs/* |
||||
|
content/src/TemplateManagement.HttpApi.Host/Logs/* |
||||
|
content/src/TemplateManagement.DbMigrator/Logs/* |
||||
|
/content/aspnetcore/src/TemplateManagement.HttpApi.Host/App_Data |
||||
|
.vscode/ |
||||
|
.idea/ |
||||
|
/aspnetcore/host/CompanyName.ProjectName.HttpApi.Host/logs |
||||
|
/host/CompanyName.ProjectName.HttpApi.Host/logs |
||||
@ -1,5 +0,0 @@ |
|||||
{ |
|
||||
"singleQuote": true, |
|
||||
"useTabs": false, |
|
||||
"tabWidth": 4 |
|
||||
} |
|
||||
@ -0,0 +1,141 @@ |
|||||
|
|
||||
|
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
|
# Visual Studio Version 16 |
||||
|
VisualStudioVersion = 16.0.31105.61 |
||||
|
MinimumVisualStudioVersion = 10.0.40219.1 |
||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{89D5BC7F-D114-439A-AC67-769337099E76}" |
||||
|
EndProject |
||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{CD48FBEA-0B6B-4E68-8E46-0680DAFF98A5}" |
||||
|
EndProject |
||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{5578AB16-AFEE-4E14-8C8D-D4E5C346233F}" |
||||
|
EndProject |
||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{BD109692-20BF-44ED-BFAA-533B40B1DAB7}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.Application", "src\CompanyName.ProjectName.Application\CompanyName.ProjectName.Application.csproj", "{1F0143A4-8B93-4A55-B331-1B74AB828188}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.Application.Contracts", "src\CompanyName.ProjectName.Application.Contracts\CompanyName.ProjectName.Application.Contracts.csproj", "{54B2220C-8B33-41F3-94C7-499F540BBA28}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.Domain", "src\CompanyName.ProjectName.Domain\CompanyName.ProjectName.Domain.csproj", "{567B7829-C8C7-49F3-8E37-68792338E53C}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.Domain.Shared", "src\CompanyName.ProjectName.Domain.Shared\CompanyName.ProjectName.Domain.Shared.csproj", "{4CC4BE56-AA1D-47F6-8626-E737296938E3}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.EntityFrameworkCore", "src\CompanyName.ProjectName.EntityFrameworkCore\CompanyName.ProjectName.EntityFrameworkCore.csproj", "{1EEED09F-F2CE-45C1-AC13-C437D6DCCC89}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.EntityFrameworkCore.DbMigrations", "src\CompanyName.ProjectName.EntityFrameworkCore.DbMigrations\CompanyName.ProjectName.EntityFrameworkCore.DbMigrations.csproj", "{93239C2D-4555-4328-9744-76EA9DF389F6}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.HttpApi", "src\CompanyName.ProjectName.HttpApi\CompanyName.ProjectName.HttpApi.csproj", "{F5A9225F-7F9D-4C89-AC39-BAC0D4239C39}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.HttpApi.Client", "src\CompanyName.ProjectName.HttpApi.Client\CompanyName.ProjectName.HttpApi.Client.csproj", "{CF67F74D-C460-4A22-86E9-001E8D76B3BB}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.DbMigrator", "tools\CompanyName.ProjectName.DbMigrator\CompanyName.ProjectName.DbMigrator.csproj", "{EA0E224A-1D62-4E63-B9FE-56F225463519}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.Application.Tests", "test\CompanyName.ProjectName.Application.Tests\CompanyName.ProjectName.Application.Tests.csproj", "{BD47E3FB-D80E-4D0C-8F0B-22130C0A6132}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.Domain.Tests", "test\CompanyName.ProjectName.Domain.Tests\CompanyName.ProjectName.Domain.Tests.csproj", "{B1AF3A73-9229-4803-9F8F-0A9076883B73}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.EntityFrameworkCore.Tests", "test\CompanyName.ProjectName.EntityFrameworkCore.Tests\CompanyName.ProjectName.EntityFrameworkCore.Tests.csproj", "{02DF9409-5200-45B0-9786-B18261ACC459}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.HttpApi.Client.ConsoleTestApp", "test\CompanyName.ProjectName.HttpApi.Client.ConsoleTestApp\CompanyName.ProjectName.HttpApi.Client.ConsoleTestApp.csproj", "{D49278D0-BE89-4F91-AB14-D52B88ACEDC3}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.TestBase", "test\CompanyName.ProjectName.TestBase\CompanyName.ProjectName.TestBase.csproj", "{A0970646-66C1-410E-A79E-9543EF44C26F}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.HttpApi.Host", "host\CompanyName.ProjectName.HttpApi.Host\CompanyName.ProjectName.HttpApi.Host.csproj", "{83C944A1-F73D-4DC5-8045-E07F31D90B8D}" |
||||
|
EndProject |
||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompanyName.ProjectName.PublicApi.Host", "host\CompanyName.ProjectName.PublicApi.Host\CompanyName.ProjectName.PublicApi.Host.csproj", "{14FD618E-EF80-4061-B517-F926C8190A9D}" |
||||
|
EndProject |
||||
|
Global |
||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
|
Debug|Any CPU = Debug|Any CPU |
||||
|
Release|Any CPU = Release|Any CPU |
||||
|
EndGlobalSection |
||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
|
{1F0143A4-8B93-4A55-B331-1B74AB828188}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{1F0143A4-8B93-4A55-B331-1B74AB828188}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{1F0143A4-8B93-4A55-B331-1B74AB828188}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{1F0143A4-8B93-4A55-B331-1B74AB828188}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{54B2220C-8B33-41F3-94C7-499F540BBA28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{54B2220C-8B33-41F3-94C7-499F540BBA28}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{54B2220C-8B33-41F3-94C7-499F540BBA28}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{54B2220C-8B33-41F3-94C7-499F540BBA28}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{567B7829-C8C7-49F3-8E37-68792338E53C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{567B7829-C8C7-49F3-8E37-68792338E53C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{567B7829-C8C7-49F3-8E37-68792338E53C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{567B7829-C8C7-49F3-8E37-68792338E53C}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{4CC4BE56-AA1D-47F6-8626-E737296938E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{4CC4BE56-AA1D-47F6-8626-E737296938E3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{4CC4BE56-AA1D-47F6-8626-E737296938E3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{4CC4BE56-AA1D-47F6-8626-E737296938E3}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{1EEED09F-F2CE-45C1-AC13-C437D6DCCC89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{1EEED09F-F2CE-45C1-AC13-C437D6DCCC89}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{1EEED09F-F2CE-45C1-AC13-C437D6DCCC89}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{1EEED09F-F2CE-45C1-AC13-C437D6DCCC89}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{93239C2D-4555-4328-9744-76EA9DF389F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{93239C2D-4555-4328-9744-76EA9DF389F6}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{93239C2D-4555-4328-9744-76EA9DF389F6}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{93239C2D-4555-4328-9744-76EA9DF389F6}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{F5A9225F-7F9D-4C89-AC39-BAC0D4239C39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{F5A9225F-7F9D-4C89-AC39-BAC0D4239C39}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{F5A9225F-7F9D-4C89-AC39-BAC0D4239C39}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{F5A9225F-7F9D-4C89-AC39-BAC0D4239C39}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{CF67F74D-C460-4A22-86E9-001E8D76B3BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{CF67F74D-C460-4A22-86E9-001E8D76B3BB}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{CF67F74D-C460-4A22-86E9-001E8D76B3BB}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{CF67F74D-C460-4A22-86E9-001E8D76B3BB}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{EA0E224A-1D62-4E63-B9FE-56F225463519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{EA0E224A-1D62-4E63-B9FE-56F225463519}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{EA0E224A-1D62-4E63-B9FE-56F225463519}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{EA0E224A-1D62-4E63-B9FE-56F225463519}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{BD47E3FB-D80E-4D0C-8F0B-22130C0A6132}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{BD47E3FB-D80E-4D0C-8F0B-22130C0A6132}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{BD47E3FB-D80E-4D0C-8F0B-22130C0A6132}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{BD47E3FB-D80E-4D0C-8F0B-22130C0A6132}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{B1AF3A73-9229-4803-9F8F-0A9076883B73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{B1AF3A73-9229-4803-9F8F-0A9076883B73}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{B1AF3A73-9229-4803-9F8F-0A9076883B73}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{B1AF3A73-9229-4803-9F8F-0A9076883B73}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{02DF9409-5200-45B0-9786-B18261ACC459}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{02DF9409-5200-45B0-9786-B18261ACC459}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{02DF9409-5200-45B0-9786-B18261ACC459}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{02DF9409-5200-45B0-9786-B18261ACC459}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{D49278D0-BE89-4F91-AB14-D52B88ACEDC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{D49278D0-BE89-4F91-AB14-D52B88ACEDC3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{D49278D0-BE89-4F91-AB14-D52B88ACEDC3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{D49278D0-BE89-4F91-AB14-D52B88ACEDC3}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{A0970646-66C1-410E-A79E-9543EF44C26F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{A0970646-66C1-410E-A79E-9543EF44C26F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{A0970646-66C1-410E-A79E-9543EF44C26F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{A0970646-66C1-410E-A79E-9543EF44C26F}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{83C944A1-F73D-4DC5-8045-E07F31D90B8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{83C944A1-F73D-4DC5-8045-E07F31D90B8D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{83C944A1-F73D-4DC5-8045-E07F31D90B8D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{83C944A1-F73D-4DC5-8045-E07F31D90B8D}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{14FD618E-EF80-4061-B517-F926C8190A9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{14FD618E-EF80-4061-B517-F926C8190A9D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{14FD618E-EF80-4061-B517-F926C8190A9D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{14FD618E-EF80-4061-B517-F926C8190A9D}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
EndGlobalSection |
||||
|
GlobalSection(SolutionProperties) = preSolution |
||||
|
HideSolutionNode = FALSE |
||||
|
EndGlobalSection |
||||
|
GlobalSection(NestedProjects) = preSolution |
||||
|
{1F0143A4-8B93-4A55-B331-1B74AB828188} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{54B2220C-8B33-41F3-94C7-499F540BBA28} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{567B7829-C8C7-49F3-8E37-68792338E53C} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{4CC4BE56-AA1D-47F6-8626-E737296938E3} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{1EEED09F-F2CE-45C1-AC13-C437D6DCCC89} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{93239C2D-4555-4328-9744-76EA9DF389F6} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{F5A9225F-7F9D-4C89-AC39-BAC0D4239C39} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{CF67F74D-C460-4A22-86E9-001E8D76B3BB} = {89D5BC7F-D114-439A-AC67-769337099E76} |
||||
|
{EA0E224A-1D62-4E63-B9FE-56F225463519} = {5578AB16-AFEE-4E14-8C8D-D4E5C346233F} |
||||
|
{BD47E3FB-D80E-4D0C-8F0B-22130C0A6132} = {BD109692-20BF-44ED-BFAA-533B40B1DAB7} |
||||
|
{B1AF3A73-9229-4803-9F8F-0A9076883B73} = {BD109692-20BF-44ED-BFAA-533B40B1DAB7} |
||||
|
{02DF9409-5200-45B0-9786-B18261ACC459} = {BD109692-20BF-44ED-BFAA-533B40B1DAB7} |
||||
|
{D49278D0-BE89-4F91-AB14-D52B88ACEDC3} = {BD109692-20BF-44ED-BFAA-533B40B1DAB7} |
||||
|
{A0970646-66C1-410E-A79E-9543EF44C26F} = {BD109692-20BF-44ED-BFAA-533B40B1DAB7} |
||||
|
{83C944A1-F73D-4DC5-8045-E07F31D90B8D} = {CD48FBEA-0B6B-4E68-8E46-0680DAFF98A5} |
||||
|
{14FD618E-EF80-4061-B517-F926C8190A9D} = {CD48FBEA-0B6B-4E68-8E46-0680DAFF98A5} |
||||
|
EndGlobalSection |
||||
|
GlobalSection(ExtensibilityGlobals) = postSolution |
||||
|
SolutionGuid = {09E984DB-3FDA-4D86-954E-4C5197470D3F} |
||||
|
EndGlobalSection |
||||
|
EndGlobal |
||||
@ -1,6 +1,10 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<configuration> |
<configuration> |
||||
|
<config> |
||||
|
<add key="yhglobal" value="https://proget.yhglobal.cn/nuget/default/" /> |
||||
|
</config> |
||||
|
|
||||
<packageSources> |
<packageSources> |
||||
<!--<add key="BlazoriseMyGet" value="https://www.myget.org/F/blazorise/api/v3/index.json" />--> |
<add key="yhglobal" value="https://proget.yhglobal.cn/nuget/default/" /> |
||||
</packageSources> |
</packageSources> |
||||
</configuration> |
</configuration> |
||||
@ -1,130 +0,0 @@ |
|||||
|
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|
||||
# Visual Studio Version 16 |
|
||||
VisualStudioVersion = 16.0.29020.237 |
|
||||
MinimumVisualStudioVersion = 10.0.40219.1 |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.Domain", "src\Zzz.Domain\Zzz.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.Application", "src\Zzz.Application\Zzz.Application.csproj", "{1A94A50E-06DC-43C1-80B5-B662820EC3EB}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.EntityFrameworkCore", "src\Zzz.EntityFrameworkCore\Zzz.EntityFrameworkCore.csproj", "{C956DD76-69C8-4A9C-83EA-D17DF83340FD}" |
|
||||
EndProject |
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}" |
|
||||
EndProject |
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.Application.Tests", "test\Zzz.Application.Tests\Zzz.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.EntityFrameworkCore.DbMigrations", "src\Zzz.EntityFrameworkCore.DbMigrations\Zzz.EntityFrameworkCore.DbMigrations.csproj", "{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.Domain.Shared", "src\Zzz.Domain.Shared\Zzz.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.Application.Contracts", "src\Zzz.Application.Contracts\Zzz.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.HttpApi", "src\Zzz.HttpApi\Zzz.HttpApi.csproj", "{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.HttpApi.Client", "src\Zzz.HttpApi.Client\Zzz.HttpApi.Client.csproj", "{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.EntityFrameworkCore.Tests", "test\Zzz.EntityFrameworkCore.Tests\Zzz.EntityFrameworkCore.Tests.csproj", "{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.TestBase", "test\Zzz.TestBase\Zzz.TestBase.csproj", "{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.Domain.Tests", "test\Zzz.Domain.Tests\Zzz.Domain.Tests.csproj", "{E512F4D9-9375-480F-A2F6-A46509F9D824}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.DbMigrator", "src\Zzz.DbMigrator\Zzz.DbMigrator.csproj", "{AA94D832-1CCC-4715-95A9-A483F23A1A5D}" |
|
||||
EndProject |
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zzz.HttpApi.Host", "src\Zzz.HttpApi.Host\Zzz.HttpApi.Host.csproj", "{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}" |
|
||||
EndProject |
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B1908A16-8033-4AE4-9E3D-63B0BE57C0AB}" |
|
||||
ProjectSection(SolutionItems) = preProject |
|
||||
common.props = common.props |
|
||||
NuGet.Config = NuGet.Config |
|
||||
..\..\Readme.md = ..\..\Readme.md |
|
||||
EndProjectSection |
|
||||
EndProject |
|
||||
Global |
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
||||
Debug|Any CPU = Debug|Any CPU |
|
||||
Release|Any CPU = Release|Any CPU |
|
||||
EndGlobalSection |
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|
||||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
EndGlobalSection |
|
||||
GlobalSection(SolutionProperties) = preSolution |
|
||||
HideSolutionNode = FALSE |
|
||||
EndGlobalSection |
|
||||
GlobalSection(NestedProjects) = preSolution |
|
||||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|
||||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{42F719ED-8413-4895-B5B4-5AB56079BC66} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{520659C8-C734-4298-A3DA-B539DB9DFC0B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|
||||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|
||||
{E512F4D9-9375-480F-A2F6-A46509F9D824} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|
||||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|
||||
EndGlobalSection |
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution |
|
||||
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} |
|
||||
EndGlobalSection |
|
||||
EndGlobal |
|
||||
@ -1,23 +0,0 @@ |
|||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceFixedStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForeachStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceIfStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceLockStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceUsingStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceWhileStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">Required</s:String> |
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOREACH/@EntryValue">Required</s:String> |
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_IFELSE/@EntryValue">Required</s:String> |
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_WHILE/@EntryValue">Required</s:String> |
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_REDUNDANT/@EntryValue">False</s:Boolean> |
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean> |
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Async/@EntryIndexedValue">False</s:String> |
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Mutable/@EntryIndexedValue">False</s:String> |
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean> |
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String> |
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String> |
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String> |
|
||||
</wpf:ResourceDictionary> |
|
||||
@ -0,0 +1,80 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk.Web"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net5.0</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
<PreserveCompilationReferences>true</PreserveCompilationReferences> |
||||
|
<UserSecretsId>CompanyNameProjectName-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |
||||
|
<OutputPath>bin\Debug\net5.0\</OutputPath> |
||||
|
<DocumentationFile>bin\Debug\net5.0\CompanyNameProjectName.HttpApi.Host.xml</DocumentationFile> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> |
||||
|
<OutputPath>bin\Debug\net5.0\</OutputPath> |
||||
|
<DocumentationFile>bin\Debug\net5.0\CompanyNameProjectName.HttpApi.Host.xml</DocumentationFile> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<!--只要不是语言包文件夹名称就行--> |
||||
|
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
|
||||
|
<PackageReference Include="nacos-sdk-csharp" Version="1.0.0" /> |
||||
|
<PackageReference Include="nacos-sdk-csharp.AspNetCore" Version="1.0.0" /> |
||||
|
<PackageReference Include="nacos-sdk-csharp.Extensions.Configuration" Version="1.0.0" /> |
||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.5" /> |
||||
|
|
||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" /> |
||||
|
|
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Autofac" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Swashbuckle" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="$(AbpVersion)" /> |
||||
|
|
||||
|
|
||||
|
</ItemGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Compile Remove="App_Data\**" /> |
||||
|
<Compile Remove="Logs\**" /> |
||||
|
<Content Remove="App_Data\**" /> |
||||
|
<Content Remove="Logs\**" /> |
||||
|
<EmbeddedResource Remove="App_Data\**" /> |
||||
|
<EmbeddedResource Remove="Logs\**" /> |
||||
|
<None Remove="App_Data\**" /> |
||||
|
<None Remove="Logs\**" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\src\CompanyName.ProjectName.Application\CompanyName.ProjectName.Application.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\CompanyName.ProjectName.EntityFrameworkCore.DbMigrations\CompanyName.ProjectName.EntityFrameworkCore.DbMigrations.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\CompanyName.ProjectName.HttpApi\CompanyName.ProjectName.HttpApi.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<None Update="Dockerfile"> |
||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
|
</None> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ProjectExtensions> |
||||
|
<VisualStudio> |
||||
|
<UserProperties appsettings_1json__JsonSchema="" /> |
||||
|
</VisualStudio> |
||||
|
</ProjectExtensions> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,11 @@ |
|||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Ui.Branding; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
public class CompanyNameProjectNameBrandingProvider : DefaultBrandingProvider |
||||
|
{ |
||||
|
public override string AppName => "CompanyNameProjectName"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,387 @@ |
|||||
|
using Hangfire; |
||||
|
using Hangfire.Redis; |
||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
||||
|
using Microsoft.AspNetCore.Builder; |
||||
|
using Microsoft.AspNetCore.Cors; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using Microsoft.IdentityModel.Tokens; |
||||
|
using Microsoft.OpenApi.Models; |
||||
|
using Serilog; |
||||
|
using Swashbuckle.AspNetCore.SwaggerUI; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Account.Web; |
||||
|
using Volo.Abp.AspNetCore.Authentication.JwtBearer; |
||||
|
using Volo.Abp.AspNetCore.ExceptionHandling; |
||||
|
using Volo.Abp.AspNetCore.MultiTenancy; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
||||
|
using Volo.Abp.AspNetCore.Serilog; |
||||
|
using Volo.Abp.Auditing; |
||||
|
using Volo.Abp.Autofac; |
||||
|
using Volo.Abp.BackgroundJobs; |
||||
|
using Volo.Abp.Hangfire; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.Settings; |
||||
|
using Volo.Abp.Swashbuckle; |
||||
|
using Volo.Abp.UI.Navigation.Urls; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
using CompanyNameProjectName.EntityFrameworkCore; |
||||
|
using CompanyNameProjectName.Extensions; |
||||
|
using CompanyNameProjectName.Extensions.Filters; |
||||
|
using CompanyNameProjectName.Options; |
||||
|
using Volo.Abp.Identity; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(CompanyNameProjectNameHttpApiModule), |
||||
|
typeof(AbpAutofacModule), |
||||
|
typeof(AbpAspNetCoreMultiTenancyModule), |
||||
|
typeof(CompanyNameProjectNameApplicationModule), |
||||
|
typeof(CompanyNameProjectNameEntityFrameworkCoreDbMigrationsModule), |
||||
|
typeof(AbpAspNetCoreMvcUiBasicThemeModule), |
||||
|
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
||||
|
typeof(AbpAccountWebIdentityServerModule), |
||||
|
typeof(AbpAspNetCoreSerilogModule), |
||||
|
typeof(AbpSwashbuckleModule), |
||||
|
typeof(AbpHangfireModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNameHttpApiHostModule : AbpModule |
||||
|
{ |
||||
|
private const string DefaultCorsPolicyName = "Default"; |
||||
|
|
||||
|
public override void OnPreApplicationInitialization(ApplicationInitializationContext context) |
||||
|
{ |
||||
|
// 应用程序初始化的时候注册hangfire
|
||||
|
var app = context.GetApplicationBuilder(); |
||||
|
app.ApplicationServices.GetService<ISettingDefinitionManager>().Get(LocalizationSettingNames.DefaultLanguage).DefaultValue = "zh-Hans"; |
||||
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions() |
||||
|
{ |
||||
|
Authorization = new[] { new CustomHangfireAuthorizeFilter() } |
||||
|
}); |
||||
|
context.ServiceProvider.CreateRecurringJob(); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
ConfigureOptions(context); |
||||
|
ConfigureBundles(); |
||||
|
ConfigureUrls(configuration); |
||||
|
ConfigureConventionalControllers(); |
||||
|
ConfigureJwtAuthentication(context, configuration); |
||||
|
ConfigureLocalization(); |
||||
|
ConfigureVirtualFileSystem(context); |
||||
|
ConfigureCors(context, configuration); |
||||
|
ConfigureSwaggerServices(context); |
||||
|
ConfigureAbpExcepotions(context); |
||||
|
ConfigureCache(context.Services); |
||||
|
ConfigureAuditLog(); |
||||
|
ConfigureHangfire(context.Services); |
||||
|
} |
||||
|
|
||||
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
||||
|
{ |
||||
|
var app = context.GetApplicationBuilder(); |
||||
|
var env = context.GetEnvironment(); |
||||
|
|
||||
|
if (env.IsDevelopment()) |
||||
|
{ |
||||
|
app.UseDeveloperExceptionPage(); |
||||
|
} |
||||
|
|
||||
|
app.UseAbpRequestLocalization(); |
||||
|
|
||||
|
if (!env.IsDevelopment()) |
||||
|
{ |
||||
|
app.UseErrorPage(); |
||||
|
} |
||||
|
|
||||
|
app.UseCorrelationId(); |
||||
|
app.UseVirtualFiles(); |
||||
|
app.UseRouting(); |
||||
|
app.UseCors(DefaultCorsPolicyName); |
||||
|
app.UseAuthentication(); |
||||
|
app.UseJwtTokenMiddleware(); |
||||
|
|
||||
|
//if (MultiTenancyConsts.IsEnabled)
|
||||
|
//{
|
||||
|
// app.UseMultiTenancy();
|
||||
|
//}
|
||||
|
|
||||
|
//app.UseIdentityServer();
|
||||
|
app.UseAuthorization(); |
||||
|
|
||||
|
app.UseSwagger(); |
||||
|
app.UseAbpSwaggerUI(c => |
||||
|
{ |
||||
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "CompanyNameProjectName API"); |
||||
|
c.DefaultModelExpandDepth(-2); |
||||
|
c.DocExpansion(DocExpansion.None); |
||||
|
}); |
||||
|
|
||||
|
app.UseAuditing(); |
||||
|
app.UseAbpSerilogEnrichers(); |
||||
|
app.UseSerilogRequestLogging(opts => |
||||
|
{ |
||||
|
opts.EnrichDiagnosticContext = SerilogToEsExtensions.EnrichFromRequest; |
||||
|
}); |
||||
|
app.UseConfiguredEndpoints(); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
#region 私有方法
|
||||
|
/// <summary>
|
||||
|
/// 配置options
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
private void ConfigureOptions(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.Configure<JwtOptions>(context.Services.GetConfiguration().GetSection("Jwt")); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 审计日志
|
||||
|
/// </summary>
|
||||
|
private void ConfigureAuditLog() |
||||
|
{ |
||||
|
Configure<AbpAuditingOptions>(options => |
||||
|
{ |
||||
|
options.IsEnabled = false; //Disables the auditing system
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Redis缓存
|
||||
|
/// </summary>
|
||||
|
/// <param name="services"></param>
|
||||
|
private void ConfigureCache(IServiceCollection services) |
||||
|
{ |
||||
|
var redisConnectionString = services.GetConfiguration().GetSection("Cache:Redis:ConnectionString").Value; |
||||
|
var redisDatabaseId = Convert.ToInt32(services.GetConfiguration().GetSection("Cache:Redis:DatabaseId").Value); |
||||
|
services.AddStackExchangeRedisCache(options => |
||||
|
{ |
||||
|
options.Configuration = redisConnectionString + ",defaultdatabase=" + redisDatabaseId; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 异常处理
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
private void ConfigureAbpExcepotions(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
// dev环境显示异常具体信息
|
||||
|
if (context.Services.GetHostingEnvironment().IsDevelopment()) |
||||
|
{ |
||||
|
context.Services.Configure<AbpExceptionHandlingOptions>(options => |
||||
|
{ |
||||
|
options.SendExceptionsDetailsToClients = true; |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private void ConfigureBundles() |
||||
|
{ |
||||
|
Configure<AbpBundlingOptions>(options => |
||||
|
{ |
||||
|
options.StyleBundles.Configure( |
||||
|
BasicThemeBundles.Styles.Global, |
||||
|
bundle => { bundle.AddFiles("/global-styles.css"); } |
||||
|
); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private void ConfigureUrls(IConfiguration configuration) |
||||
|
{ |
||||
|
Configure<AppUrlOptions>(options => |
||||
|
{ |
||||
|
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配置虚拟文件系统
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
private void ConfigureVirtualFileSystem(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<CompanyNameProjectNameHttpApiHostModule>(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 映射Controller
|
||||
|
/// </summary>
|
||||
|
private void ConfigureConventionalControllers() |
||||
|
{ |
||||
|
Configure<AbpAspNetCoreMvcOptions>(options => |
||||
|
{ |
||||
|
options.ConventionalControllers.Create(typeof(CompanyNameProjectNameApplicationModule).Assembly); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配置JWT
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
/// <param name="configuration"></param>
|
||||
|
private void ConfigureJwtAuthentication(ServiceConfigurationContext context, IConfiguration configuration) |
||||
|
{ |
||||
|
context.Services.AddAuthentication(options => |
||||
|
{ |
||||
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; |
||||
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; |
||||
|
}) |
||||
|
.AddJwtBearer(options => |
||||
|
{ |
||||
|
options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters() |
||||
|
{ |
||||
|
// 是否开启签名认证
|
||||
|
ValidateIssuerSigningKey = true, |
||||
|
ValidateIssuer = true, |
||||
|
ValidateAudience = true, |
||||
|
ValidateLifetime = true, |
||||
|
//ClockSkew = TimeSpan.Zero,
|
||||
|
ValidIssuer = configuration["Jwt:Issuer"], |
||||
|
ValidAudience = configuration["Jwt:Audience"], |
||||
|
IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(configuration["Jwt:SecurityKey"])) |
||||
|
}; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配置SwaggerUI
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
private static void ConfigureSwaggerServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddSwaggerGen( |
||||
|
options => |
||||
|
{ |
||||
|
options.SwaggerDoc("v1", new OpenApiInfo { Title = "CompanyNameProjectName API", Version = "v1" }); |
||||
|
|
||||
|
options.DocInclusionPredicate((docName, description) => true); |
||||
|
options.EnableAnnotations();// 启用注解
|
||||
|
// 加载xml文件,不然不会显示备注
|
||||
|
//var xmlapppath = Path.Combine(AppContext.BaseDirectory, "CompanyNameProjectName.Application.xml");
|
||||
|
//var xmlContractspath = Path.Combine(AppContext.BaseDirectory, "CompanyNameProjectName.Application.Contracts.xml");
|
||||
|
//var xmlapipath = Path.Combine(AppContext.BaseDirectory, "CompanyNameProjectName.HttpApi.Host.xml");
|
||||
|
//options.IncludeXmlComments(xmlapppath, true);
|
||||
|
//options.IncludeXmlComments(xmlContractspath, true);
|
||||
|
//options.IncludeXmlComments(xmlapipath, true);
|
||||
|
|
||||
|
//options.OperationFilter<SwaggerTagsFilter>();
|
||||
|
options.DocumentFilter<HiddenAbpDefaultApiFilter>(); |
||||
|
// 在swaggerui界面添加token认证
|
||||
|
options.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme, new OpenApiSecurityScheme() |
||||
|
{ |
||||
|
Description = "Please enter into field the word 'Bearer' followed by a space and the JWT value", |
||||
|
Name = "Authorization", |
||||
|
In = ParameterLocation.Header, |
||||
|
Type = SecuritySchemeType.Http, |
||||
|
Scheme = JwtBearerDefaults.AuthenticationScheme, |
||||
|
BearerFormat = "JWT" |
||||
|
}); |
||||
|
options.AddSecurityRequirement(new OpenApiSecurityRequirement |
||||
|
{ |
||||
|
{ |
||||
|
new OpenApiSecurityScheme |
||||
|
{ |
||||
|
Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Bearer" |
||||
|
} |
||||
|
}, |
||||
|
new List<string>() |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
///配置本地化
|
||||
|
/// </summary>
|
||||
|
private void ConfigureLocalization() |
||||
|
{ |
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Languages.Add(new LanguageInfo("en", "en", "English")); |
||||
|
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配置跨域
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
/// <param name="configuration"></param>
|
||||
|
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) |
||||
|
{ |
||||
|
context.Services.AddCors(options => |
||||
|
{ |
||||
|
options.AddPolicy(DefaultCorsPolicyName, builder => |
||||
|
{ |
||||
|
builder |
||||
|
.WithOrigins( |
||||
|
configuration["App:CorsOrigins"] |
||||
|
.Split(",", StringSplitOptions.RemoveEmptyEntries) |
||||
|
.Select(o => o.RemovePostFix("/")) |
||||
|
.ToArray() |
||||
|
) |
||||
|
.WithAbpExposedHeaders() |
||||
|
.SetIsOriginAllowedToAllowWildcardSubdomains() |
||||
|
.AllowAnyHeader() |
||||
|
.AllowAnyMethod() |
||||
|
.AllowCredentials(); |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配置Hangfire服务
|
||||
|
/// </summary>
|
||||
|
/// <param name="services"></param>
|
||||
|
private void ConfigureHangfire(IServiceCollection services) |
||||
|
{ |
||||
|
Configure<AbpBackgroundJobOptions>(options => |
||||
|
{ |
||||
|
options.IsJobExecutionEnabled = false; |
||||
|
}); |
||||
|
|
||||
|
var redisConnectionString = services.GetConfiguration().GetSection("Cache:Redis:ConnectionString").Value; |
||||
|
var redisDatabaseId = Convert.ToInt32(services.GetConfiguration().GetSection("Cache:Redis:DatabaseId").Value); |
||||
|
|
||||
|
// 启用Hangfire 并使用Redis作为持久化
|
||||
|
services.AddHangfire(config => |
||||
|
{ |
||||
|
config.UseRedisStorage(redisConnectionString, new RedisStorageOptions { Db = redisDatabaseId }); |
||||
|
}); |
||||
|
|
||||
|
JobStorage.Current = new RedisStorage(redisConnectionString, new RedisStorageOptions { Db = redisDatabaseId }); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Controllers |
||||
|
{ |
||||
|
public class HomeController : AbpController |
||||
|
{ |
||||
|
public ActionResult Index() |
||||
|
{ |
||||
|
return Redirect("~/swagger/index.html"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
FROM mcr.microsoft.com/dotnet/aspnet:5.0 |
||||
|
|
||||
|
# ´´½¨Ä¿Â¼ |
||||
|
RUN mkdir /apps |
||||
|
|
||||
|
COPY . /apps |
||||
|
|
||||
|
# ÉèÖù¤×÷Ŀ¼ |
||||
|
WORKDIR /apps |
||||
|
|
||||
|
# ±©Â¶80¶Ë¿Ú |
||||
|
EXPOSE 80 |
||||
|
|
||||
|
# ÉèÖû·¾³±äÁ¿ |
||||
|
ENV ASPNETCORE_ENVIRONMENT=Development |
||||
|
|
||||
|
ENTRYPOINT ["dotnet", "CompanyNameProjectName.HttpApi.Host.dll"] |
||||
@ -0,0 +1,16 @@ |
|||||
|
using Hangfire.Dashboard; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Extensions.Filters |
||||
|
{ |
||||
|
public class CustomHangfireAuthorizeFilter : IDashboardAuthorizationFilter |
||||
|
{ |
||||
|
public bool Authorize(DashboardContext context) |
||||
|
{ |
||||
|
//var currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>();
|
||||
|
//return currentUser.IsAuthenticated;
|
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc.ApiExplorer; |
||||
|
using Microsoft.OpenApi.Models; |
||||
|
using Swashbuckle.AspNetCore.SwaggerGen; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Reflection; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Extensions.Filters |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 在使用nswag的时候,原生默认的api导致生产的代理类存在问题
|
||||
|
/// 所有隐藏原生的api,重写路由
|
||||
|
/// </summary>
|
||||
|
public class HiddenAbpDefaultApiFilter : IDocumentFilter |
||||
|
{ |
||||
|
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) |
||||
|
{ |
||||
|
|
||||
|
foreach (ApiDescription apiDescription in context.ApiDescriptions) |
||||
|
{ |
||||
|
if (apiDescription.TryGetMethodInfo(out MethodInfo method)) |
||||
|
{ |
||||
|
string key = "/" + apiDescription.RelativePath; |
||||
|
var reuslt = IsHidden(key); |
||||
|
if(reuslt) swaggerDoc.Paths.Remove(key); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private bool IsHidden(string key) |
||||
|
{ |
||||
|
var list = GetHiddenAbpDefaultApiList(); |
||||
|
foreach (var item in list) |
||||
|
{ |
||||
|
if (key.Contains(item)) return true; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
private List<string> GetHiddenAbpDefaultApiList() |
||||
|
{ |
||||
|
return new List<string>() { |
||||
|
"/api/abp/multi-tenancy/tenants", |
||||
|
"/api/account", |
||||
|
"/api/feature-management/features", |
||||
|
"/api/permission-management/permissions", |
||||
|
"/api/identity/my-profile", |
||||
|
"/api/identity", |
||||
|
"/api/multi-tenancy/tenants" |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc.Controllers; |
||||
|
using Microsoft.OpenApi.Models; |
||||
|
using Swashbuckle.AspNetCore.SwaggerGen; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Extensions.Filters |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 把abp vnext 提供的api 归档
|
||||
|
/// </summary>
|
||||
|
public class SwaggerTagsFilter : IOperationFilter |
||||
|
{ |
||||
|
public const string DefaultTagName = "ABP Vnext 默认 Api"; |
||||
|
|
||||
|
public void Apply(OpenApiOperation operation, OperationFilterContext context) |
||||
|
{ |
||||
|
var tag = GetChineseTag(context.ApiDescription.ActionDescriptor as ControllerActionDescriptor); |
||||
|
if (null != tag) |
||||
|
operation.Tags = new List<OpenApiTag> { tag }; |
||||
|
} |
||||
|
|
||||
|
private static OpenApiTag GetChineseTag(ControllerActionDescriptor description) |
||||
|
{ |
||||
|
if (null != description?.ControllerTypeInfo?.Namespace) |
||||
|
{ |
||||
|
if (description.ControllerTypeInfo.Namespace.StartsWith("Volo.Abp") || description.ControllerTypeInfo.Namespace.StartsWith("Pages.Abp.MultiTenancy")) |
||||
|
return new OpenApiTag { Name = DefaultTagName }; |
||||
|
return null; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using Hangfire; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using System; |
||||
|
using CompanyNameProjectName.Jobs; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Extensions |
||||
|
{ |
||||
|
public static class RecurringJobsExtensions |
||||
|
{ |
||||
|
public static void CreateRecurringJob(this IServiceProvider service) |
||||
|
{ |
||||
|
var job = service.GetService<TestJob>(); |
||||
|
RecurringJob.AddOrUpdate("测试Job", () => job.ExecuteAsync(), CronTypeHelper.Minute(1)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,135 @@ |
|||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Serilog; |
||||
|
using Serilog.Exceptions; |
||||
|
using Serilog.Exceptions.Core; |
||||
|
using Serilog.Sinks.Elasticsearch; |
||||
|
using System; |
||||
|
using System.IO; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Extensions |
||||
|
{ |
||||
|
public static class SerilogToEsExtensions |
||||
|
{ |
||||
|
|
||||
|
public static void SetSerilogConfiguration(LoggerConfiguration loggerConfiguration, IConfiguration configuration) |
||||
|
{ |
||||
|
// 默认读取 configuration 中 "Serilog" 节点下的配置
|
||||
|
loggerConfiguration.ReadFrom.Configuration(configuration) |
||||
|
.Enrich.WithExceptionDetails() |
||||
|
.Enrich.WithExceptionDetails(new DestructuringOptionsBuilder() |
||||
|
.WithDefaultDestructurers() |
||||
|
) |
||||
|
.Enrich.FromLogContext() |
||||
|
.WriteTo.Console() |
||||
|
.WriteTo.File("logs/logs.txt", rollingInterval: RollingInterval.Day); |
||||
|
|
||||
|
var writeToElasticSearch = configuration.GetValue("LogToElasticSearch:Enabled", false); |
||||
|
|
||||
|
// LogToElasticSearch:Enabled = true 才输出至ES
|
||||
|
if (!writeToElasticSearch) |
||||
|
return; |
||||
|
|
||||
|
var applicationName = "CompanyNameProjectName.HttpApi.Host"; |
||||
|
|
||||
|
var esUrl = configuration["LogToElasticSearch:ElasticSearch:Url"]; |
||||
|
// 需要设置ES URL
|
||||
|
if (string.IsNullOrEmpty(esUrl)) |
||||
|
return; |
||||
|
|
||||
|
|
||||
|
var indexFormat = configuration["LogToElasticSearch:ElasticSearch:IndexFormat"]; |
||||
|
|
||||
|
// 需要设置ES URL
|
||||
|
if (string.IsNullOrEmpty(indexFormat)) |
||||
|
return; |
||||
|
|
||||
|
var esUserName = configuration["LogToElasticSearch:ElasticSearch:UserName"]; |
||||
|
var esPassword = configuration["LogToElasticSearch:ElasticSearch:Password"]; |
||||
|
|
||||
|
loggerConfiguration.Enrich.FromLogContext().Enrich.WithExceptionDetails().WriteTo.Elasticsearch(BuildElasticSearchSinkOptions(esUrl, indexFormat, esUserName, esPassword)); |
||||
|
loggerConfiguration.Enrich.WithProperty("Application", applicationName); |
||||
|
} |
||||
|
|
||||
|
// 创建Es连接
|
||||
|
private static ElasticsearchSinkOptions BuildElasticSearchSinkOptions( |
||||
|
string url, |
||||
|
string indexFormat, |
||||
|
string userName, |
||||
|
string password) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(userName)) |
||||
|
{ |
||||
|
return new ElasticsearchSinkOptions(new Uri(url)) |
||||
|
{ |
||||
|
AutoRegisterTemplate = true, |
||||
|
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7, |
||||
|
IndexFormat = indexFormat |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
return new ElasticsearchSinkOptions(new Uri(url)) |
||||
|
{ |
||||
|
AutoRegisterTemplate = true, |
||||
|
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7, |
||||
|
IndexFormat = indexFormat, |
||||
|
ModifyConnectionSettings = x => x.BasicAuthentication(userName, password) |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
public static void EnrichFromRequest(IDiagnosticContext diagnosticContext, HttpContext httpContext) |
||||
|
{ |
||||
|
var request = httpContext.Request; |
||||
|
|
||||
|
// 为每个请求都设置通用的属性
|
||||
|
diagnosticContext.Set("Host", request.Host); |
||||
|
diagnosticContext.Set("Protocol", request.Protocol); |
||||
|
diagnosticContext.Set("Scheme", request.Scheme); |
||||
|
diagnosticContext.Set("RemoteIpAddress", httpContext.Connection.RemoteIpAddress); |
||||
|
// 如果要记录 Request Body 或 Response Body
|
||||
|
// 参考 https://stackoverflow.com/questions/60076922/serilog-logging-web-api-methods-adding-context-properties-inside-middleware
|
||||
|
string requestBody = ReadRequestBody(httpContext.Request).Result; |
||||
|
if (!string.IsNullOrEmpty(requestBody)) |
||||
|
{ |
||||
|
diagnosticContext.Set("RequestBody", requestBody); |
||||
|
} |
||||
|
|
||||
|
// string responseBody = ReadResponseBody(httpContext.Response).Result;
|
||||
|
// if (!string.IsNullOrEmpty(responseBody))
|
||||
|
// {
|
||||
|
// diagnosticContext.Set("ResponseBody", requestBody);
|
||||
|
// }
|
||||
|
|
||||
|
if (request.QueryString.HasValue) |
||||
|
{ |
||||
|
diagnosticContext.Set("QueryString", request.QueryString.Value); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private static async Task<string> ReadRequestBody(HttpRequest request) |
||||
|
{ |
||||
|
HttpRequestRewindExtensions.EnableBuffering(request); |
||||
|
|
||||
|
var body = request.Body; |
||||
|
var buffer = new byte[Convert.ToInt32(request.ContentLength)]; |
||||
|
await request.Body.ReadAsync(buffer, 0, buffer.Length); |
||||
|
string requestBody = Encoding.UTF8.GetString(buffer); |
||||
|
body.Seek(0, SeekOrigin.Begin); |
||||
|
request.Body = body; |
||||
|
|
||||
|
return $"{requestBody}"; |
||||
|
} |
||||
|
|
||||
|
private static async Task<string> ReadResponseBody(HttpResponse response) |
||||
|
{ |
||||
|
response.Body.Seek(0, SeekOrigin.Begin); |
||||
|
string responseBody = await new StreamReader(response.Body).ReadToEndAsync(); |
||||
|
response.Body.Seek(0, SeekOrigin.Begin); |
||||
|
|
||||
|
return $"{responseBody}"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using System; |
||||
|
using Microsoft.AspNetCore.Hosting; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using Serilog; |
||||
|
using Serilog.Events; |
||||
|
using CompanyNameProjectName.Extensions; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public class Program |
||||
|
{ |
||||
|
public static void Main(string[] args) |
||||
|
{ |
||||
|
CreateHostBuilder(args).Build().Run(); |
||||
|
} |
||||
|
|
||||
|
public static IHostBuilder CreateHostBuilder(string[] args) => |
||||
|
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) |
||||
|
.ConfigureWebHostDefaults(webBuilder => |
||||
|
{ |
||||
|
webBuilder.UseStartup<Startup>(); |
||||
|
}) |
||||
|
//.ConfigureAppConfiguration((context, builder) => {
|
||||
|
// // 配置nacos
|
||||
|
// builder.AddNacosConfiguration(builder.Build().GetSection("NacosConfig"));
|
||||
|
//})
|
||||
|
.UseSerilog((context, loggerConfiguration) => |
||||
|
{ |
||||
|
SerilogToEsExtensions.SetSerilogConfiguration( |
||||
|
loggerConfiguration, |
||||
|
context.Configuration); |
||||
|
}).UseAutofac(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
{ |
||||
|
"profiles": { |
||||
|
"CompanyNameProjectName.HttpApi.Host": { |
||||
|
"commandName": "Project", |
||||
|
"launchBrowser": true, |
||||
|
"launchUrl": "swagger/index.html", |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
|
}, |
||||
|
"applicationUrl": "http://localhost:50010/" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using Microsoft.AspNetCore.Builder; |
||||
|
using Microsoft.AspNetCore.Hosting; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public class Startup |
||||
|
{ |
||||
|
public void ConfigureServices(IServiceCollection services) |
||||
|
{ |
||||
|
services.AddApplication<CompanyNameProjectNameHttpApiHostModule>(); |
||||
|
} |
||||
|
|
||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) |
||||
|
{ |
||||
|
app.InitializeApplication(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
{ |
||||
|
"App": { |
||||
|
"SelfUrl": "https://localhost:44363", |
||||
|
"CorsOrigins": "https://*.CompanyNameProjectName.com,http://localhost:8083,http://localhost:8081,https://localhost:44307," |
||||
|
}, |
||||
|
"StringEncryption": { |
||||
|
"DefaultPassPhrase": "MY2bTgp2iaHUEp66" |
||||
|
}, |
||||
|
"Settings": { |
||||
|
"Abp.Mailing.Smtp.Host": "127.0.0.1", |
||||
|
"Abp.Mailing.Smtp.Port": "25", |
||||
|
"Abp.Mailing.Smtp.UserName": "", |
||||
|
"Abp.Mailing.Smtp.Password": "", |
||||
|
"Abp.Mailing.Smtp.Domain": "", |
||||
|
"Abp.Mailing.Smtp.EnableSsl": "false", |
||||
|
"Abp.Mailing.Smtp.UseDefaultCredentials": "true", |
||||
|
"Abp.Mailing.DefaultFromAddress": "noreply@abp.io", |
||||
|
"Abp.Mailing.DefaultFromDisplayName": "ABP application" |
||||
|
}, |
||||
|
"Serilog": { |
||||
|
"MinimumLevel": { |
||||
|
"Default": "Information", |
||||
|
"Override": { |
||||
|
"Microsoft": "Information", |
||||
|
"Microsoft.AspNetCore": "Information", |
||||
|
"System": "Warning", |
||||
|
"Microsoft.Hosting.Lifetime": "Information", |
||||
|
"Microsoft.AspNetCore.Routing": "Information", |
||||
|
"Microsoft.AspNetCore.Hosting.Diagnostics": "Error" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Data Source=mysql.development.cn;Database=CompanyNameProjectName;uid=root;pwd=mysql@;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" |
||||
|
}, |
||||
|
"Cache": { |
||||
|
"Redis": { |
||||
|
"ConnectionString": "redis.development.yhglobal.cn,password=OD5VbzIuAWsHOZV5ncYx9xaDsAMsKXn7", |
||||
|
"DatabaseId": 231 |
||||
|
} |
||||
|
}, |
||||
|
"AuthServer": { |
||||
|
"Authority": "https://localhost:44363", |
||||
|
"RequireHttpsMetadata": "false" |
||||
|
}, |
||||
|
"Jwt": { |
||||
|
"Audience": "http://localhost:5010", //客户端标识 |
||||
|
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=", |
||||
|
"Issuer": "CompanyNameProjectName", //签发者 |
||||
|
"ExpirationTime": 2 //过期时间 hour |
||||
|
}, |
||||
|
"LogToElasticSearch": { |
||||
|
"Enabled": "true", |
||||
|
"ElasticSearch": { |
||||
|
"Url": "http://es.cn", |
||||
|
"IndexFormat": "CompanyNameProjectName.admin.api.dev-{0:yyyy.MM.dd}", |
||||
|
"UserName": "CompanyNameProjectName", |
||||
|
"Password": "TCYobkZxWu0ELYZY" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
{ |
||||
|
"App": { |
||||
|
"SelfUrl": "https://localhost:44363", |
||||
|
"CorsOrigins": "https://*.CompanyNameProjectName.com,http://localhost:8083,http://localhost:8081,https://localhost:44307," |
||||
|
}, |
||||
|
"StringEncryption": { |
||||
|
"DefaultPassPhrase": "MY2bTgp2iaHUEp66" |
||||
|
}, |
||||
|
"Settings": { |
||||
|
"Abp.Mailing.Smtp.Host": "127.0.0.1", |
||||
|
"Abp.Mailing.Smtp.Port": "25", |
||||
|
"Abp.Mailing.Smtp.UserName": "", |
||||
|
"Abp.Mailing.Smtp.Password": "", |
||||
|
"Abp.Mailing.Smtp.Domain": "", |
||||
|
"Abp.Mailing.Smtp.EnableSsl": "false", |
||||
|
"Abp.Mailing.Smtp.UseDefaultCredentials": "true", |
||||
|
"Abp.Mailing.DefaultFromAddress": "noreply@abp.io", |
||||
|
"Abp.Mailing.DefaultFromDisplayName": "ABP application" |
||||
|
}, |
||||
|
"Serilog": { |
||||
|
"MinimumLevel": { |
||||
|
"Default": "Information", |
||||
|
"Override": { |
||||
|
"Microsoft": "Information", |
||||
|
"Microsoft.AspNetCore": "Information", |
||||
|
"System": "Warning", |
||||
|
"Microsoft.Hosting.Lifetime": "Information", |
||||
|
"Microsoft.AspNetCore.Routing": "Information", |
||||
|
"Microsoft.AspNetCore.Hosting.Diagnostics": "Error" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Data Source=mysql.development.cn;Database=CompanyNameProjectName;uid=root;pwd=mysql@;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" |
||||
|
}, |
||||
|
"Cache": { |
||||
|
"Redis": { |
||||
|
"ConnectionString": "redis.development.yhglobal.cn,password=OD5VbzIuAWsHOZV5ncYx9xaDsAMsKXn7", |
||||
|
"DatabaseId": 231 |
||||
|
} |
||||
|
}, |
||||
|
"AuthServer": { |
||||
|
"Authority": "https://localhost:44363", |
||||
|
"RequireHttpsMetadata": "false" |
||||
|
}, |
||||
|
"Jwt": { |
||||
|
"Audience": "http://localhost:5010", //客户端标识 |
||||
|
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=", |
||||
|
"Issuer": "CompanyNameProjectName", //签发者 |
||||
|
"ExpirationTime": 2 //过期时间 hour |
||||
|
}, |
||||
|
"LogToElasticSearch": { |
||||
|
"Enabled": "true", |
||||
|
"ElasticSearch": { |
||||
|
"Url": "http://es.cn", |
||||
|
"IndexFormat": "CompanyNameProjectName.admin.api.dev-{0:yyyy.MM.dd}", |
||||
|
"UserName": "CompanyNameProjectName", |
||||
|
"Password": "TCYobkZxWu0ELYZY" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
{ |
||||
|
"App": { |
||||
|
"SelfUrl": "https://localhost:44363", |
||||
|
"CorsOrigins": "https://*.CompanyNameProjectName.com,http://localhost:8083,http://localhost:3100,https://localhost:44307," |
||||
|
}, |
||||
|
"StringEncryption": { |
||||
|
"DefaultPassPhrase": "MY2bTgp2iaHUEp66" |
||||
|
}, |
||||
|
"Settings": { |
||||
|
"Abp.Mailing.Smtp.Host": "127.0.0.1", |
||||
|
"Abp.Mailing.Smtp.Port": "25", |
||||
|
"Abp.Mailing.Smtp.UserName": "", |
||||
|
"Abp.Mailing.Smtp.Password": "", |
||||
|
"Abp.Mailing.Smtp.Domain": "", |
||||
|
"Abp.Mailing.Smtp.EnableSsl": "false", |
||||
|
"Abp.Mailing.Smtp.UseDefaultCredentials": "true", |
||||
|
"Abp.Mailing.DefaultFromAddress": "noreply@abp.io", |
||||
|
"Abp.Mailing.DefaultFromDisplayName": "ABP application" |
||||
|
}, |
||||
|
"Serilog": { |
||||
|
"MinimumLevel": { |
||||
|
"Default": "Information", |
||||
|
"Override": { |
||||
|
"Microsoft": "Information", |
||||
|
"Microsoft.AspNetCore": "Information", |
||||
|
"System": "Warning", |
||||
|
"Microsoft.Hosting.Lifetime": "Information", |
||||
|
"Microsoft.AspNetCore.Routing": "Information", |
||||
|
"Microsoft.AspNetCore.Hosting.Diagnostics": "Error" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Data Source=mysql.platform.development.cn;Database=CompanyNameProjectName;uid=root;pwd=mysql@dmin;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" |
||||
|
}, |
||||
|
"Cache": { |
||||
|
"Redis": { |
||||
|
"ConnectionString": "redis.platform.development.cn,password=OD5VbzIuAWsHOZV5ncYx9xaDsAMsKXn7", |
||||
|
"DatabaseId": 234 |
||||
|
} |
||||
|
}, |
||||
|
"AuthServer": { |
||||
|
"Authority": "https://localhost:44363", |
||||
|
"RequireHttpsMetadata": "false" |
||||
|
}, |
||||
|
"Jwt": { |
||||
|
"Audience": "http://localhost:5010", //客户端标识 |
||||
|
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=", |
||||
|
"Issuer": "CompanyNameProjectName", //签发者 |
||||
|
"ExpirationTime": 24 //过期时间 hour |
||||
|
}, |
||||
|
"LogToElasticSearch": { |
||||
|
"Enabled": "true", |
||||
|
"ElasticSearch": { |
||||
|
"Url": "http://es.cn", |
||||
|
"IndexFormat": "CompanyNameProjectName.admin.api.dev-{0:yyyy.MM.dd}", |
||||
|
"UserName": "CompanyNameProjectName", |
||||
|
"Password": "TCYobkZxWu0ELYZY" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
{"KeyId":"5eb863b25811a7099f9bc925c0fdf680","Parameters":{"D":"gqn7NAeMkug4twJJHFz/qPseDzQCx7R+6Maj649xrG4vPsMANV9mfR78Er2SuHUS0ZihM2MQEILI5Sf41Uuubv8swCNSE3Dw7GQrBIbTAJ7BZKbQMVgtGkMDtHrtri6d9cOi3EOTSJINICk9r80M49oBMOZihEKascfBSIUYVQvWLEMYfryEiDeFUPbobr10OxF5tZ1unvEKgZe190BdNKWQuFhJelcgsZumjEYNsOz5DHrK73WLhfTy01DmsTKx8i1XVnLtq6W89MqAhMZP9QO9Vj8lR0ANnmdOsY6hJfwUbXiI36t4V9rAZvXR5ESorjb4mnXzT6QPuOfy1fbdSQ==","DP":"ItYIpEqw6aDjDc/swDifUe0Dq6yl4yim3UyQ4B9NBPQR5M6b7D3vbCnvwql4zJK4s+0N4lRViBtkF+20Td1yc2v8S+THCYZCVxCf2e9Q7Ff/sKecJ9/JmdzHkztCfs0xb+4X3CPEQP+JIYtMGmwOLQgE5XgmUYKr0ahZDhYTCwE=","DQ":"v35mgxfyF/nwnWwWlR9cF3mg0v7SyPfKkwdxGaVnGH6G8nPWpPlO+zueflA5QDXEwGtk/1k3PAzI/OLUwJiKBubx/UMhsqt5+/bKTrFDNHxLANCvGNZggMZIzFZBYRucuXRZbiBe5qpCkKkniUct7w6jd/V1mnsESiJZ7btcxU0=","Exponent":"AQAB","InverseQ":"Vbg2a+wtaYvhTV8AzqJsVvaz0kfC4HFbmwEgA8+BAbS3GEoS3RHFSfB3DHndpnNihIg72DctDNLmV2GMMiTu18uyI+7AUaYNR836fByxptfyhPtSQfw4kINZ3V0GWKJGCompanyNameProjectName5NAOct4/FpRl8xliHetayCfUIuK9jwk0z9i6V6bA=","Modulus":"xlzmN1sBi2V1971MsPD5MTND9dAGncIzYqxa3H+9jx1mNDivY6JgKijUWm5a3D2Y1UPMB3kx6qUf3iH6pZHjq5bk938qRhxrPy9muW55U03HTiW4V5/ga0+OqXj5Tj4lz+29OiQHPErxLRgfXT+WBgrGb75ElzkHajKpJnPgzAZuarlUCwupJNQlav/crwOFrgkhGsnaOW13M8htiSLZozw5lxkbhYIei7YTTQZ3l6rVH1dPL8CvzRJJOTwbnU8k0sUmWiuOhrLzuinlr6uuOTocAVgbj943/witVFtN5B0yhetxEVgFCwxRDTOO1EKVHFtCiAyZBUOlK4gwZ+SbGQ==","P":"7dFfbAkZSdx/ieSMYJHoY1DKC4dLg80RObEEmuJ72MaVJLTtFuBPoRpYOrMUNuupIyPjZZsW8fHRlPRhKW7xFv+Q2aDudh1UaJzFZs3xYKoiXTU/j0B3TB3nrifVLMqsS+8kHOWOojwA4dMjI6GCYCpKmYVvMOE1cuJrQ9EYxoM=","Q":"1YdN8mLchLVoTEwD34Pi3T2U7EjjBDgDCzhjl7x5FBG73TyKMz1n7/KXkXcJ2rqIAsnLqCWpYUeRcWl+IQEQxFKoMwkvmQ33lRkOE0SBZ+FnUAMivRyxOD5qM9z4ccqx0ga4ZRgb1lR85f7VYtMSfIosOuSFxWAbV1e29utxhTM="}} |
||||
@ -0,0 +1,89 @@ |
|||||
|
2021-04-11 22:11:50.691 +08:00 [INF] User profile is available. Using 'C:\Users\wangjun\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. |
||||
|
2021-04-11 22:11:50.873 +08:00 [INF] Loaded ABP modules: |
||||
|
2021-04-11 22:11:50.875 +08:00 [INF] - Volo.Abp.Localization.AbpLocalizationAbstractionsModule |
||||
|
2021-04-11 22:11:50.875 +08:00 [INF] - Volo.Abp.Validation.AbpValidationAbstractionsModule |
||||
|
2021-04-11 22:11:50.876 +08:00 [INF] - Volo.Abp.ObjectExtending.AbpObjectExtendingModule |
||||
|
2021-04-11 22:11:50.876 +08:00 [INF] - Volo.Abp.Uow.AbpUnitOfWorkModule |
||||
|
2021-04-11 22:11:50.878 +08:00 [INF] - Volo.Abp.Data.AbpDataModule |
||||
|
2021-04-11 22:11:50.879 +08:00 [INF] - Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemModule |
||||
|
2021-04-11 22:11:50.880 +08:00 [INF] - Volo.Abp.Security.AbpSecurityModule |
||||
|
2021-04-11 22:11:50.880 +08:00 [INF] - Volo.Abp.MultiTenancy.AbpMultiTenancyModule |
||||
|
2021-04-11 22:11:50.881 +08:00 [INF] - Volo.Abp.Settings.AbpSettingsModule |
||||
|
2021-04-11 22:11:50.890 +08:00 [INF] - Volo.Abp.Localization.AbpLocalizationModule |
||||
|
2021-04-11 22:11:50.891 +08:00 [INF] - Volo.Abp.Timing.AbpTimingModule |
||||
|
2021-04-11 22:11:50.891 +08:00 [INF] - Volo.Abp.Json.AbpJsonModule |
||||
|
2021-04-11 22:11:50.893 +08:00 [INF] - Volo.Abp.Threading.AbpThreadingModule |
||||
|
2021-04-11 22:11:50.893 +08:00 [INF] - Volo.Abp.Auditing.AbpAuditingModule |
||||
|
2021-04-11 22:11:50.894 +08:00 [INF] - Volo.Abp.Http.AbpHttpAbstractionsModule |
||||
|
2021-04-11 22:11:50.894 +08:00 [INF] - Volo.Abp.Minify.AbpMinifyModule |
||||
|
2021-04-11 22:11:50.895 +08:00 [INF] - Volo.Abp.Http.AbpHttpModule |
||||
|
2021-04-11 22:11:50.895 +08:00 [INF] - Volo.Abp.Authorization.AbpAuthorizationModule |
||||
|
2021-04-11 22:11:50.896 +08:00 [INF] - Volo.Abp.Validation.AbpValidationModule |
||||
|
2021-04-11 22:11:50.897 +08:00 [INF] - Volo.Abp.ExceptionHandling.AbpExceptionHandlingModule |
||||
|
2021-04-11 22:11:50.898 +08:00 [INF] - Volo.Abp.AspNetCore.AbpAspNetCoreModule |
||||
|
2021-04-11 22:11:50.899 +08:00 [INF] - Volo.Abp.ApiVersioning.AbpApiVersioningAbstractionsModule |
||||
|
2021-04-11 22:11:50.900 +08:00 [INF] - Volo.Abp.Application.AbpDddApplicationContractsModule |
||||
|
2021-04-11 22:11:50.900 +08:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcContractsModule |
||||
|
2021-04-11 22:11:50.902 +08:00 [INF] - Volo.Abp.UI.AbpUiModule |
||||
|
2021-04-11 22:11:50.903 +08:00 [INF] - Volo.Abp.UI.Navigation.AbpUiNavigationModule |
||||
|
2021-04-11 22:11:50.903 +08:00 [INF] - Volo.Abp.GlobalFeatures.AbpGlobalFeaturesModule |
||||
|
2021-04-11 22:11:50.904 +08:00 [INF] - Volo.Abp.EventBus.AbpEventBusModule |
||||
|
2021-04-11 22:11:50.905 +08:00 [INF] - Volo.Abp.Guids.AbpGuidsModule |
||||
|
2021-04-11 22:11:50.906 +08:00 [INF] - Volo.Abp.ObjectMapping.AbpObjectMappingModule |
||||
|
2021-04-11 22:11:50.907 +08:00 [INF] - Volo.Abp.Specifications.AbpSpecificationsModule |
||||
|
2021-04-11 22:11:50.908 +08:00 [INF] - Volo.Abp.Domain.AbpDddDomainModule |
||||
|
2021-04-11 22:11:50.909 +08:00 [INF] - Volo.Abp.Features.AbpFeaturesModule |
||||
|
2021-04-11 22:11:50.910 +08:00 [INF] - Volo.Abp.Application.AbpDddApplicationModule |
||||
|
2021-04-11 22:11:50.913 +08:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule |
||||
|
2021-04-11 22:11:50.915 +08:00 [INF] - Volo.Abp.Castle.AbpCastleCoreModule |
||||
|
2021-04-11 22:11:50.916 +08:00 [INF] - Volo.Abp.Autofac.AbpAutofacModule |
||||
|
2021-04-11 22:11:50.918 +08:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainSharedModule |
||||
|
2021-04-11 22:11:50.919 +08:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsDomainSharedModule |
||||
|
2021-04-11 22:11:50.920 +08:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementDomainSharedModule |
||||
|
2021-04-11 22:11:50.921 +08:00 [INF] - Volo.Abp.Users.AbpUsersDomainSharedModule |
||||
|
2021-04-11 22:11:50.923 +08:00 [INF] - Volo.Abp.Identity.AbpIdentityDomainSharedModule |
||||
|
2021-04-11 22:11:50.926 +08:00 [INF] - Volo.Abp.IdentityServer.AbpIdentityServerDomainSharedModule |
||||
|
2021-04-11 22:11:50.928 +08:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainSharedModule |
||||
|
2021-04-11 22:11:50.928 +08:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainSharedModule |
||||
|
2021-04-11 22:11:50.929 +08:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementDomainSharedModule |
||||
|
2021-04-11 22:11:50.931 +08:00 [INF] - EasyAbp.Abp.SettingUi.SettingUiDomainSharedModule |
||||
|
2021-04-11 22:11:50.932 +08:00 [INF] - CompanyNameProjectName.CompanyNameProjectNameDomainSharedModule |
||||
|
2021-04-11 22:11:50.933 +08:00 [INF] - Volo.Abp.Users.AbpUsersAbstractionModule |
||||
|
2021-04-11 22:11:50.935 +08:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementApplicationContractsModule |
||||
|
2021-04-11 22:11:50.936 +08:00 [INF] - Volo.Abp.Identity.AbpIdentityApplicationContractsModule |
||||
|
2021-04-11 22:11:50.937 +08:00 [INF] - Volo.Abp.Account.AbpAccountApplicationContractsModule |
||||
|
2021-04-11 22:11:50.938 +08:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementApplicationContractsModule |
||||
|
2021-04-11 22:11:50.941 +08:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementApplicationContractsModule |
||||
|
2021-04-11 22:11:50.943 +08:00 [INF] - EasyAbp.Abp.SettingUi.SettingUiApplicationContractsModule |
||||
|
2021-04-11 22:11:50.945 +08:00 [INF] - CompanyNameProjectName.CompanyNameProjectNameApplicationContractsModule |
||||
|
2021-04-11 22:11:50.946 +08:00 [INF] - Volo.Abp.Http.Client.AbpHttpClientModule |
||||
|
2021-04-11 22:11:50.958 +08:00 [INF] - Volo.Abp.Account.AbpAccountHttpApiClientModule |
||||
|
2021-04-11 22:11:50.959 +08:00 [INF] - Volo.Abp.Identity.AbpIdentityHttpApiClientModule |
||||
|
2021-04-11 22:11:50.960 +08:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementHttpApiClientModule |
||||
|
2021-04-11 22:11:50.962 +08:00 [INF] - Volo.Abp.TenantManagement.AbpTenantManagementHttpApiClientModule |
||||
|
2021-04-11 22:11:50.964 +08:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementHttpApiClientModule |
||||
|
2021-04-11 22:11:50.965 +08:00 [INF] - CompanyNameProjectName.CompanyNameProjectNameHttpApiClientModule |
||||
|
2021-04-11 22:11:50.966 +08:00 [INF] - CompanyNameProjectName.PublicApi.CompanyNameProjectNamePublicApiModule |
||||
|
2021-04-11 22:11:51.566 +08:00 [INF] Initialized all ABP modules. |
||||
|
2021-04-11 22:11:51.601 +08:00 [INF] Now listening on: http://localhost:50011 |
||||
|
2021-04-11 22:11:51.602 +08:00 [INF] Application started. Press Ctrl+C to shut down. |
||||
|
2021-04-11 22:11:51.604 +08:00 [INF] Hosting environment: Development |
||||
|
2021-04-11 22:11:51.605 +08:00 [INF] Content root path: E:\study\github\abp-vnext-pro-t\aspnetcore\host\CompanyName.ProjectName.PublicApi.Host |
||||
|
2021-04-11 22:11:56.709 +08:00 [INF] Request starting HTTP/1.1 GET http://localhost:50011/swagger - - |
||||
|
2021-04-11 22:11:56.830 +08:00 [INF] Request finished HTTP/1.1 GET http://localhost:50011/swagger - - - 301 0 - 125.7433ms |
||||
|
2021-04-11 22:11:56.851 +08:00 [INF] Request starting HTTP/1.1 GET http://localhost:50011/swagger/index.html - - |
||||
|
2021-04-11 22:11:56.947 +08:00 [INF] Request finished HTTP/1.1 GET http://localhost:50011/swagger/index.html - - - 200 - text/html;charset=utf-8 95.4839ms |
||||
|
2021-04-11 22:11:59.147 +08:00 [INF] Request starting HTTP/1.1 GET http://localhost:50011/swagger/swagger-ui-bundle.js - - |
||||
|
2021-04-11 22:11:59.149 +08:00 [INF] Request starting HTTP/1.1 GET http://localhost:50011/swagger/swagger-ui-standalone-preset.js - - |
||||
|
2021-04-11 22:11:59.151 +08:00 [INF] Request starting HTTP/1.1 GET http://localhost:50011/swagger/swagger-ui.css - - |
||||
|
2021-04-11 22:11:59.201 +08:00 [INF] Sending file. Request path: '/swagger-ui.css'. Physical path: 'N/A' |
||||
|
2021-04-11 22:11:59.204 +08:00 [INF] Sending file. Request path: '/swagger-ui-standalone-preset.js'. Physical path: 'N/A' |
||||
|
2021-04-11 22:11:59.206 +08:00 [INF] Sending file. Request path: '/swagger-ui-bundle.js'. Physical path: 'N/A' |
||||
|
2021-04-11 22:11:59.210 +08:00 [INF] Request finished HTTP/1.1 GET http://localhost:50011/swagger/swagger-ui.css - - - 200 142933 text/css 58.5102ms |
||||
|
2021-04-11 22:11:59.210 +08:00 [INF] Request finished HTTP/1.1 GET http://localhost:50011/swagger/swagger-ui-standalone-preset.js - - - 200 311804 application/javascript 61.1681ms |
||||
|
2021-04-11 22:11:59.212 +08:00 [INF] Request finished HTTP/1.1 GET http://localhost:50011/swagger/swagger-ui-bundle.js - - - 200 986342 application/javascript 64.4272ms |
||||
|
2021-04-11 22:11:59.412 +08:00 [INF] Request starting HTTP/1.1 GET http://localhost:50011/swagger/v1/swagger.json - - |
||||
|
2021-04-11 22:11:59.437 +08:00 [INF] Request starting HTTP/1.1 GET http://localhost:50011/swagger/favicon-32x32.png - - |
||||
|
2021-04-11 22:11:59.439 +08:00 [INF] Sending file. Request path: '/favicon-32x32.png'. Physical path: 'N/A' |
||||
|
2021-04-11 22:11:59.441 +08:00 [INF] Request finished HTTP/1.1 GET http://localhost:50011/swagger/favicon-32x32.png - - - 200 628 image/png 3.5332ms |
||||
|
2021-04-11 22:11:59.474 +08:00 [INF] Request finished HTTP/1.1 GET http://localhost:50011/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 61.8611ms |
||||
@ -0,0 +1,44 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk.Web"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net5.0</TargetFramework> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Compile Remove="App_Data\**" /> |
||||
|
<Content Remove="App_Data\**" /> |
||||
|
<EmbeddedResource Remove="App_Data\**" /> |
||||
|
<None Remove="App_Data\**" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" /> |
||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" /> |
||||
|
<PackageReference Include="Volo.Abp.Autofac" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(AbpVersion)" /> |
||||
|
|
||||
|
|
||||
|
<PackageReference Include="Serilog" Version="2.10.0" /> |
||||
|
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" /> |
||||
|
<PackageReference Include="Serilog.Exceptions" Version="5.7.0" /> |
||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" /> |
||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" /> |
||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> |
||||
|
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" /> |
||||
|
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" /> |
||||
|
|
||||
|
|
||||
|
<PackageReference Include="nacos-sdk-csharp" Version="1.0.0" /> |
||||
|
<PackageReference Include="nacos-sdk-csharp.AspNetCore" Version="1.0.0" /> |
||||
|
<PackageReference Include="nacos-sdk-csharp.Extensions.Configuration" Version="1.0.0" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\src\CompanyName.ProjectName.HttpApi.Client\CompanyName.ProjectName.HttpApi.Client.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,14 @@ |
|||||
|
namespace CompanyNameProjectName.PublicApi.Host |
||||
|
{ |
||||
|
public class CompanyNameProjectNamePublicApiConsts |
||||
|
{ |
||||
|
public const string Policy_Read = "Policy_Read"; |
||||
|
|
||||
|
public const string Policy_Write = "Policy_Write"; |
||||
|
|
||||
|
|
||||
|
public const string Scope_Read = "CompanyNameProjectNamePublicApi.Read"; |
||||
|
|
||||
|
public const string Scope_Write = "CompanyNameProjectNamePublicApi.Write"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,90 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Builder; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using Microsoft.IdentityModel.Logging; |
||||
|
using Microsoft.OpenApi.Models; |
||||
|
using Serilog; |
||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Autofac; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using CompanyNameProjectName.Extensions; |
||||
|
using CompanyNameProjectName.PublicApi.Host; |
||||
|
|
||||
|
namespace CompanyNameProjectName.PublicApi |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpAspNetCoreMvcModule), |
||||
|
typeof(AbpAutofacModule), |
||||
|
typeof(CompanyNameProjectNameHttpApiClientModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNamePublicApiModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
ConfigureSwagger(context); |
||||
|
ConfigureAuthentication(context); |
||||
|
} |
||||
|
|
||||
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
||||
|
{ |
||||
|
var app = context.GetApplicationBuilder(); |
||||
|
var env = context.GetEnvironment(); |
||||
|
if (env.IsDevelopment()) |
||||
|
{ |
||||
|
app.UseDeveloperExceptionPage(); |
||||
|
app.UseSwagger(); |
||||
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "CompanyNameProjectName.PublicApi.Host v1")); |
||||
|
} |
||||
|
|
||||
|
app.UseAuthentication(); |
||||
|
app.UseRouting(); |
||||
|
app.UseAuthorization(); |
||||
|
app.UseSerilogRequestLogging(opts => |
||||
|
{ |
||||
|
opts.EnrichDiagnosticContext = SerilogToEsExtensions.EnrichFromRequest; |
||||
|
}); |
||||
|
app.UseConfiguredEndpoints(); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureAuthentication(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
IdentityModelEventSource.ShowPII = true; |
||||
|
context.Services.AddAuthentication("Bearer") |
||||
|
.AddJwtBearer("Bearer", options => |
||||
|
{ |
||||
|
//token颁发者
|
||||
|
options.Authority = configuration["AuthServer:Authority"]; |
||||
|
options.Audience = configuration["AuthServer:ApiName"]; |
||||
|
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]); |
||||
|
}); |
||||
|
|
||||
|
context.Services.AddAuthorization(options => |
||||
|
{ |
||||
|
// 为了掩饰 分读写权限
|
||||
|
options.AddPolicy(CompanyNameProjectNamePublicApiConsts.Policy_Read, builder => |
||||
|
builder.RequireScope(new string[] { |
||||
|
CompanyNameProjectNamePublicApiConsts.Scope_Read }) |
||||
|
); |
||||
|
|
||||
|
options.AddPolicy(CompanyNameProjectNamePublicApiConsts.Policy_Write, builder => |
||||
|
builder.RequireScope(new string[] { |
||||
|
CompanyNameProjectNamePublicApiConsts.Scope_Write }) |
||||
|
); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void ConfigureSwagger(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var services = context.Services; |
||||
|
|
||||
|
services.AddSwaggerGen(c => |
||||
|
{ |
||||
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "CompanyNameProjectName.PublicApi.Host", Version = "v1" }); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace CompanyNameProjectName.PublicApi.Host.Controllers |
||||
|
{ |
||||
|
[Route("api/[controller]")]
|
||||
|
[ApiController] |
||||
|
public class SampleController : AbpController |
||||
|
{ |
||||
|
private readonly IConfiguration _configuration; |
||||
|
|
||||
|
public SampleController( |
||||
|
IConfiguration configuration) |
||||
|
{ |
||||
|
_configuration = configuration; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
[HttpGet("write")] |
||||
|
[Authorize(Policy = CompanyNameProjectNamePublicApiConsts.Policy_Write)] |
||||
|
public async Task<IActionResult> WriteAsync() |
||||
|
{ |
||||
|
await Task.CompletedTask; |
||||
|
return Ok("Write权限通过"); |
||||
|
} |
||||
|
|
||||
|
[HttpGet("read")] |
||||
|
[Authorize(Policy = CompanyNameProjectNamePublicApiConsts.Policy_Read)] |
||||
|
public async Task<IActionResult> ReadAsync() |
||||
|
{ |
||||
|
await Task.CompletedTask; |
||||
|
return Ok("Read权限通过"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,135 @@ |
|||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Serilog; |
||||
|
using Serilog.Exceptions; |
||||
|
using Serilog.Exceptions.Core; |
||||
|
using Serilog.Sinks.Elasticsearch; |
||||
|
using System; |
||||
|
using System.IO; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Extensions |
||||
|
{ |
||||
|
public static class SerilogToEsExtensions |
||||
|
{ |
||||
|
|
||||
|
public static void SetSerilogConfiguration(LoggerConfiguration loggerConfiguration, IConfiguration configuration) |
||||
|
{ |
||||
|
// 默认读取 configuration 中 "Serilog" 节点下的配置
|
||||
|
loggerConfiguration.ReadFrom.Configuration(configuration) |
||||
|
.Enrich.WithExceptionDetails() |
||||
|
.Enrich.WithExceptionDetails(new DestructuringOptionsBuilder() |
||||
|
.WithDefaultDestructurers() |
||||
|
) |
||||
|
.Enrich.FromLogContext() |
||||
|
.WriteTo.Console() |
||||
|
.WriteTo.File("App_Data/logs/logs.txt", rollingInterval: RollingInterval.Day); |
||||
|
|
||||
|
var writeToElasticSearch = configuration.GetValue("LogToElasticSearch:Enabled", false); |
||||
|
|
||||
|
// LogToElasticSearch:Enabled = true 才输出至ES
|
||||
|
if (!writeToElasticSearch) |
||||
|
return; |
||||
|
|
||||
|
var applicationName = "CompanyNameProjectName.HttpApi.Host"; |
||||
|
|
||||
|
var esUrl = configuration["LogToElasticSearch:ElasticSearch:Url"]; |
||||
|
// 需要设置ES URL
|
||||
|
if (string.IsNullOrEmpty(esUrl)) |
||||
|
return; |
||||
|
|
||||
|
|
||||
|
var indexFormat = configuration["LogToElasticSearch:ElasticSearch:IndexFormat"]; |
||||
|
|
||||
|
// 需要设置ES URL
|
||||
|
if (string.IsNullOrEmpty(indexFormat)) |
||||
|
return; |
||||
|
|
||||
|
var esUserName = configuration["LogToElasticSearch:ElasticSearch:UserName"]; |
||||
|
var esPassword = configuration["LogToElasticSearch:ElasticSearch:Password"]; |
||||
|
|
||||
|
loggerConfiguration.Enrich.FromLogContext().Enrich.WithExceptionDetails().WriteTo.Elasticsearch(BuildElasticSearchSinkOptions(esUrl, indexFormat, esUserName, esPassword)); |
||||
|
loggerConfiguration.Enrich.WithProperty("Application", applicationName); |
||||
|
} |
||||
|
|
||||
|
// 创建Es连接
|
||||
|
private static ElasticsearchSinkOptions BuildElasticSearchSinkOptions( |
||||
|
string url, |
||||
|
string indexFormat, |
||||
|
string userName, |
||||
|
string password) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(userName)) |
||||
|
{ |
||||
|
return new ElasticsearchSinkOptions(new Uri(url)) |
||||
|
{ |
||||
|
AutoRegisterTemplate = true, |
||||
|
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7, |
||||
|
IndexFormat = indexFormat |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
return new ElasticsearchSinkOptions(new Uri(url)) |
||||
|
{ |
||||
|
AutoRegisterTemplate = true, |
||||
|
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7, |
||||
|
IndexFormat = indexFormat, |
||||
|
ModifyConnectionSettings = x => x.BasicAuthentication(userName, password) |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
public static void EnrichFromRequest(IDiagnosticContext diagnosticContext, HttpContext httpContext) |
||||
|
{ |
||||
|
var request = httpContext.Request; |
||||
|
|
||||
|
// 为每个请求都设置通用的属性
|
||||
|
diagnosticContext.Set("Host", request.Host); |
||||
|
diagnosticContext.Set("Protocol", request.Protocol); |
||||
|
diagnosticContext.Set("Scheme", request.Scheme); |
||||
|
diagnosticContext.Set("RemoteIpAddress", httpContext.Connection.RemoteIpAddress); |
||||
|
// 如果要记录 Request Body 或 Response Body
|
||||
|
// 参考 https://stackoverflow.com/questions/60076922/serilog-logging-web-api-methods-adding-context-properties-inside-middleware
|
||||
|
string requestBody = ReadRequestBody(httpContext.Request).Result; |
||||
|
if (!string.IsNullOrEmpty(requestBody)) |
||||
|
{ |
||||
|
diagnosticContext.Set("RequestBody", requestBody); |
||||
|
} |
||||
|
|
||||
|
// string responseBody = ReadResponseBody(httpContext.Response).Result;
|
||||
|
// if (!string.IsNullOrEmpty(responseBody))
|
||||
|
// {
|
||||
|
// diagnosticContext.Set("ResponseBody", requestBody);
|
||||
|
// }
|
||||
|
|
||||
|
if (request.QueryString.HasValue) |
||||
|
{ |
||||
|
diagnosticContext.Set("QueryString", request.QueryString.Value); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private static async Task<string> ReadRequestBody(HttpRequest request) |
||||
|
{ |
||||
|
HttpRequestRewindExtensions.EnableBuffering(request); |
||||
|
|
||||
|
var body = request.Body; |
||||
|
var buffer = new byte[Convert.ToInt32(request.ContentLength)]; |
||||
|
await request.Body.ReadAsync(buffer, 0, buffer.Length); |
||||
|
string requestBody = Encoding.UTF8.GetString(buffer); |
||||
|
body.Seek(0, SeekOrigin.Begin); |
||||
|
request.Body = body; |
||||
|
|
||||
|
return $"{requestBody}"; |
||||
|
} |
||||
|
|
||||
|
private static async Task<string> ReadResponseBody(HttpResponse response) |
||||
|
{ |
||||
|
response.Body.Seek(0, SeekOrigin.Begin); |
||||
|
string responseBody = await new StreamReader(response.Body).ReadToEndAsync(); |
||||
|
response.Body.Seek(0, SeekOrigin.Begin); |
||||
|
|
||||
|
return $"{responseBody}"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
using Microsoft.AspNetCore.Hosting; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using Serilog; |
||||
|
using CompanyNameProjectName.Extensions; |
||||
|
|
||||
|
namespace CompanyNameProjectName.PublicApi.Host |
||||
|
{ |
||||
|
public class Program |
||||
|
{ |
||||
|
public static void Main(string[] args) |
||||
|
{ |
||||
|
CreateHostBuilder(args).Build().Run(); |
||||
|
} |
||||
|
|
||||
|
public static IHostBuilder CreateHostBuilder(string[] args) => |
||||
|
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) |
||||
|
.ConfigureWebHostDefaults(webBuilder => |
||||
|
{ |
||||
|
webBuilder.UseStartup<Startup>(); |
||||
|
}) |
||||
|
//.ConfigureAppConfiguration((context, builder) => {
|
||||
|
// // ÅäÖÃnacos
|
||||
|
// builder.AddNacosConfiguration(builder.Build().GetSection("NacosConfig"));
|
||||
|
//})
|
||||
|
.UseSerilog((context, loggerConfiguration) => |
||||
|
{ |
||||
|
SerilogToEsExtensions.SetSerilogConfiguration( |
||||
|
loggerConfiguration, |
||||
|
context.Configuration); |
||||
|
}).UseAutofac(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
{ |
||||
|
"$schema": "http://json.schemastore.org/launchsettings.json", |
||||
|
|
||||
|
"profiles": { |
||||
|
"CompanyNameProjectName.PublicApi.Host": { |
||||
|
"commandName": "Project", |
||||
|
"dotnetRunMessages": "true", |
||||
|
"launchBrowser": true, |
||||
|
"launchUrl": "swagger", |
||||
|
"applicationUrl": "http://localhost:50011", |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using Microsoft.AspNetCore.Builder; |
||||
|
using Microsoft.AspNetCore.Hosting; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
|
||||
|
namespace CompanyNameProjectName.PublicApi.Host |
||||
|
{ |
||||
|
public class Startup |
||||
|
{ |
||||
|
public void ConfigureServices(IServiceCollection services) |
||||
|
{ |
||||
|
services.AddApplication<CompanyNameProjectNamePublicApiModule>(); |
||||
|
} |
||||
|
|
||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
||||
|
{ |
||||
|
app.InitializeApplication(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
{ |
||||
|
"Logging": { |
||||
|
"LogLevel": { |
||||
|
"Default": "Information", |
||||
|
"Microsoft": "Warning", |
||||
|
"Microsoft.Hosting.Lifetime": "Information" |
||||
|
} |
||||
|
}, |
||||
|
"AllowedHosts": "*", |
||||
|
"LogToElasticSearch": { |
||||
|
"Enabled": "true", |
||||
|
"ElasticSearch": { |
||||
|
"Url": "http://es.platform.cn", |
||||
|
"IndexFormat": "CompanyNameProjectName.public.api.dev-{0:yyyy.MM.dd}", |
||||
|
"UserName": "erp", |
||||
|
"Password": "TCYobkZxWu0ELYZY" |
||||
|
} |
||||
|
}, |
||||
|
"AuthServer": { |
||||
|
"Authority": "http://sts.vnext.identity.development.cn", |
||||
|
"RequireHttpsMetadata": "false", |
||||
|
"ApiName": "CompanyNameProjectNamePublicApi" |
||||
|
}, |
||||
|
"RemoteServices": { |
||||
|
"CompanyNameProjectName": { |
||||
|
"BaseUrl": "http://localhost:50000/" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
{ |
||||
|
"Logging": { |
||||
|
"LogLevel": { |
||||
|
"Default": "Information", |
||||
|
"Microsoft": "Warning", |
||||
|
"Microsoft.Hosting.Lifetime": "Information" |
||||
|
} |
||||
|
}, |
||||
|
"AllowedHosts": "*", |
||||
|
"LogToElasticSearch": { |
||||
|
"Enabled": "true", |
||||
|
"ElasticSearch": { |
||||
|
"Url": "http://es.platform.cn", |
||||
|
"IndexFormat": "CompanyNameProjectName.public.api.dev-{0:yyyy.MM.dd}", |
||||
|
"UserName": "erp", |
||||
|
"Password": "TCYobkZxWu0ELYZY" |
||||
|
} |
||||
|
}, |
||||
|
"AuthServer": { |
||||
|
"Authority": "http://sts.vnext.identity.development.cn", |
||||
|
"RequireHttpsMetadata": "false", |
||||
|
"ApiName": "CompanyNameProjectNamePublicApi" |
||||
|
}, |
||||
|
"RemoteServices": { |
||||
|
"CompanyNameProjectName": { |
||||
|
"BaseUrl": "http://localhost:50000/" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1 @@ |
|||||
|
{"alg":"RS256","d":"lNH0OzXPRnDsV767u7a3LZCHUTUVfyvDOPqKBWjVKs03hHvpbPm6xxyJxR_2MDUFaDxHmVKjXZxOPZFuAiKbKWXNsjmpirtF2U42TjjnCvEb2Nb-G6SIC_JeaNo8kV3OUE4UzFWw_rpTF6CKpGdOhCVDAPdyGU-9GM7h6bcFLg3jbThUC7CrYSl57bQswUhiXwYxiA20dXkwh0sDSIMXlZOfurWz8w0etYQq1LTSIlhpZ021x4csQyTQM2X0rFVZnS8f75oDyYBI0E9xU9ogC9LpaxrPBnxNhqXQ8LnTgK_5Nmi3m-GLKxC6ImGxItQlV7pf5iP8E1lEQ3U63dvabQ","dp":"LbtXHqBYBs3VapOkZIrXAJrNux9fAqrq_2FDjiHxL76uXlTk2rq0Em-aVkQv9M-QzzaJNR-r1fSIscibQvS1VhWMha3-vR04pAy7KvA1T9bfZa7QWiAN-Po1IDH7hPe1U9Du2prJ9XPjaHLDffvI_bMfFdSdxZeaghivyh92K6U","dq":"pHr9BRS6ArlmPqSwmw2eQhcVsDAfOu22WEK7wD26wDRG4riV4uJticVQOHCpwTn0-5kCcp2LfBhX0uanFTh5dGT62B1Ib6DKpjT39hcSF1V1-GJl0fyrmvXku7cyeRTqooLCHrXovZ4EV0uDRAeAkZ03BCpTW5MxGqKA7doWWOE","e":"AQAB","kid":"9F6E0CA233DC806A58A0821E58521B17","kty":"RSA","n":"pEaiCVTAe6F6hBpi6ozmA3let7sBJwGcKoo1Vm0t1EvqiMLsBuU1lB9pVUzxPb8zFpAKpgrgpA58u7Pv0erZ_9_zRYAQ2jxglp9bPJmTtga2cY-emPzl_0cDgsTTYiTh4c9btgB2eYgLAyaAeM9K82vblTs-0HPK7o7zQJvX6-iv_-B8XY7DLOHwAp_Ua_DiAwx4sarULRpCPULD2HHtFl990NpunCj1Bo1kcZcF9SKQxM9KM2UEd5P6GbQJjkU549tO2kK22oHNJz1krbDyfLC0G8VWFN6Z-fb44hoerHpILyQvdpCTdarJG3JUlkhsCLx8FAYqz5cuQ5KhQ8YWiQ","p":"1mrTYqHNXPY5XlbKtUyn-GoMDLGdzGNxCuIzfUMOIhACSh-h7gsvv5msOiPKZLiRB0b1Qu_v_H2KGNu4Rb209jMbyYrLfo1rh4QIfetFx3K-oJ86Evs0EZXQf-RgY2WdPVJar1YgBKYqM-gLJh4XGnwdBxBdqgU0AfaVkiwuEBs","q":"xCJwPOWJ6NaHwEGBc7tncSghuFUIUu8psDlUc-78ClrOi_WII7y0Q0-kLB_COdmlxhVOO58bLDZZL8PBFH4q_Mm9qFHVSBxLJ97AoQxVxed31Eqq6SG_3iv4LqKI6EKk9nLLBKh3L1sn0nafHORfNp4vtCNJSZatkCbh5I0GRis","qi":"ud4nssqZ00XTbkObwyoWEHMzgYQifdBInXk_j6KRaKt_fPYzxVWnHoVAaLSgKJTU1aqxiJHd3Mb5sCvM_W-MocKAeWxeGij0R-kv16El8eTNgsukcr3mdAOeaUsZlVuXOeO9ol-e6VOTIziIqLJmTjflruh0ZskDUw0AJ8xVIro"} |
||||
@ -0,0 +1,39 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.1</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |
||||
|
<DocumentationFile>bin\Debug\netstandard2.1\CompanyNameProjectName.Application.Contracts.xml</DocumentationFile> |
||||
|
<OutputPath>bin\Debug\netstandard2.1\</OutputPath> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> |
||||
|
<OutputPath>bin\Debug\netstandard2.1\</OutputPath> |
||||
|
<DocumentationFile>bin\Debug\netstandard2.1\CompanyNameProjectName.Application.Contracts.xml</DocumentationFile> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="EasyAbp.Abp.SettingUi.Application.Contracts" Version="1.3.1" /> |
||||
|
<PackageReference Include="Volo.Abp.ObjectExtending" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Account.Application.Contracts" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.Application.Contracts" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.TenantManagement.Application.Contracts" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.FeatureManagement.Application.Contracts" Version="$(AbpVersion)" /> |
||||
|
|
||||
|
</ItemGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.Domain.Shared\CompanyName.ProjectName.Domain.Shared.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,28 @@ |
|||||
|
using Volo.Abp.Account; |
||||
|
using Volo.Abp.FeatureManagement; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.ObjectExtending; |
||||
|
using Volo.Abp.PermissionManagement; |
||||
|
using Volo.Abp.TenantManagement; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(CompanyNameProjectNameDomainSharedModule), |
||||
|
typeof(AbpAccountApplicationContractsModule), |
||||
|
typeof(AbpFeatureManagementApplicationContractsModule), |
||||
|
typeof(AbpIdentityApplicationContractsModule), |
||||
|
typeof(AbpPermissionManagementApplicationContractsModule), |
||||
|
typeof(AbpTenantManagementApplicationContractsModule), |
||||
|
typeof(AbpObjectExtendingModule), |
||||
|
typeof(EasyAbp.Abp.SettingUi.SettingUiApplicationContractsModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNameApplicationContractsModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
CompanyNameProjectNameDtoExtensions.Configure(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using Volo.Abp.Threading; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameDtoExtensions |
||||
|
{ |
||||
|
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
||||
|
|
||||
|
public static void Configure() |
||||
|
{ |
||||
|
OneTimeRunner.Run(() => |
||||
|
{ |
||||
|
/* You can add extension properties to Dtos |
||||
|
* defined in the depended modules. |
||||
|
* |
||||
|
* Example: |
||||
|
* |
||||
|
* ObjectExtensionManager.Instance |
||||
|
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title"); |
||||
|
* |
||||
|
* See the documentation for more: |
||||
|
* https://docs.abp.io/en/abp/latest/Object-Extensions
|
||||
|
*/ |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Jobs |
||||
|
{ |
||||
|
public interface IRecurringJob : ITransientDependency |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 执行任务
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
Task ExecuteAsync(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Options |
||||
|
{ |
||||
|
public class JwtOptions |
||||
|
{ |
||||
|
public int ExpirationTime { get; set; } |
||||
|
|
||||
|
public string Audience { get; set; } |
||||
|
|
||||
|
public string SecurityKey { get; set; } |
||||
|
|
||||
|
public string Issuer { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
namespace CompanyNameProjectName.Pages.Dtos |
||||
|
{ |
||||
|
public class CustomeRequestDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 当前页面
|
||||
|
/// </summary>
|
||||
|
public int pageIndex { get; set; } = 1; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 每页多少条
|
||||
|
/// </summary>
|
||||
|
public int PageSize { get; set; } = 10; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using CompanyNameProjectName.Localization; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Permissions |
||||
|
{ |
||||
|
public class CompanyNameProjectNamePermissionDefinitionProvider : PermissionDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IPermissionDefinitionContext context) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
//Define your own permissions here. Example:
|
||||
|
//myGroup.AddPermission(CompanyNameProjectNamePermissions.MyPermission1, L("Permission:MyPermission1"));
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
private static LocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<CompanyNameProjectNameResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
namespace CompanyNameProjectName.Permissions |
||||
|
{ |
||||
|
public static class CompanyNameProjectNamePermissions |
||||
|
{ |
||||
|
public const string GroupName = "CompanyNameProjectName"; |
||||
|
|
||||
|
//Add your own permission names. Example:
|
||||
|
//public const string MyPermission1 = GroupName + ".MyPermission1";
|
||||
|
|
||||
|
public const string DicGroupName = "Dic"; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 字典权限
|
||||
|
/// </summary>
|
||||
|
public static class Dic |
||||
|
{ |
||||
|
public const string Default = GroupName + ".Dic"; |
||||
|
public const string Query = Default + ".Query"; |
||||
|
public const string Create = Default + ".Create"; |
||||
|
public const string Update = Default + ".Update"; |
||||
|
public const string Delete = Default + ".Delete"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using CompanyNameProjectName.Pages.Dtos; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Roles.Dtos |
||||
|
{ |
||||
|
public class GetRoleListInput : CustomeRequestDto |
||||
|
{ |
||||
|
public string filter { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Identity; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Roles.Dtos |
||||
|
{ |
||||
|
public class UpdateRoleInput |
||||
|
{ |
||||
|
public Guid RoleId { get; set; } |
||||
|
|
||||
|
public IdentityRoleUpdateDto RoleInfo { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Volo.Abp.PermissionManagement; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Roles.Dtos |
||||
|
{ |
||||
|
public class UpdateRolePermissionsDto |
||||
|
{ |
||||
|
[Required] |
||||
|
public string ProviderName { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
public string ProviderKey { get; set; } |
||||
|
|
||||
|
public UpdatePermissionsDto UpdatePermissionsDto { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using CompanyNameProjectName.Pages.Dtos; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Users.Dtos |
||||
|
{ |
||||
|
public class GetUserListInput: CustomeRequestDto |
||||
|
{ |
||||
|
public string filter { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Dtos.Users |
||||
|
{ |
||||
|
public class GetUsersInput : PagedAndSortedResultRequestDto |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Dtos.Users |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 登录
|
||||
|
/// </summary>
|
||||
|
public class LoginInputDto : IValidatableObject |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 用户名或者邮箱
|
||||
|
/// </summary>
|
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 密码
|
||||
|
/// </summary>
|
||||
|
public string Password { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
if (Name.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult("Email can not be null", new[] { "Email" }); |
||||
|
} |
||||
|
|
||||
|
if (Password.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
yield return new ValidationResult("Password can not be null", new[] { "Password" }); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Dtos.Users |
||||
|
{ |
||||
|
public class LoginOutputDto |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string UserName { get; set; } |
||||
|
|
||||
|
public string Token { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
public DateTime Expiration { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using Volo.Abp.Identity; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Users.Dtos |
||||
|
{ |
||||
|
public class UpdateUserInput |
||||
|
{ |
||||
|
public Guid UserId { get; set; } |
||||
|
|
||||
|
public IdentityUserUpdateDto UserInfo { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using CompanyNameProjectName.Dtos.Users; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
|
||||
|
namespace CompanyNameProjectName.Users |
||||
|
{ |
||||
|
public interface ILoginAppService: IApplicationService |
||||
|
{ |
||||
|
Task<LoginOutputDto> PostAsync(LoginInputDto input); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net5.0</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |
||||
|
<DocumentationFile>bin\Debug\net5.0\CompanyNameProjectName.Application.xml</DocumentationFile> |
||||
|
<OutputPath>bin\Debug\net5.0\</OutputPath> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> |
||||
|
<OutputPath>bin\Debug\net5.0\</OutputPath> |
||||
|
<DocumentationFile>bin\Debug\net5.0\CompanyNameProjectName.Application.xml</DocumentationFile> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
|
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.Application.Contracts\CompanyName.ProjectName.Application.Contracts.csproj" /> |
||||
|
|
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.Domain\CompanyName.ProjectName.Domain.csproj" /> |
||||
|
|
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.EntityFrameworkCore\CompanyName.ProjectName.EntityFrameworkCore.csproj" /> |
||||
|
|
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Hangfire.Redis.StackExchange.StrongName" Version="1.7.0" /> |
||||
|
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" /> |
||||
|
<PackageReference Include="EasyAbp.Abp.SettingUi.Application" Version="1.3.1" /> |
||||
|
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.6.3" /> |
||||
|
<PackageReference Include="Volo.Abp.Account.Application" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Identity.Application" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.BackgroundJobs.HangFire" Version="$(AbpVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using CompanyNameProjectName.Localization; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
/* Inherit your application services from this class. |
||||
|
*/ |
||||
|
public abstract class CompanyNameProjectNameAppService : ApplicationService |
||||
|
{ |
||||
|
protected CompanyNameProjectNameAppService() |
||||
|
{ |
||||
|
LocalizationResource = typeof(CompanyNameProjectNameResource); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using AutoMapper; |
||||
|
using CompanyNameProjectName.Dtos.Users; |
||||
|
using Volo.Abp.Identity; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public class CompanyNameProjectNameApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
public CompanyNameProjectNameApplicationAutoMapperProfile() |
||||
|
{ |
||||
|
/* You can configure your AutoMapper mapping configuration here. |
||||
|
* Alternatively, you can split your mapping configurations |
||||
|
* into multiple profile classes for a better organization. */ |
||||
|
|
||||
|
CreateMap<IdentityUser, LoginOutputDto>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
using Volo.Abp.Account; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Volo.Abp.FeatureManagement; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.PermissionManagement; |
||||
|
using Volo.Abp.TenantManagement; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(CompanyNameProjectNameDomainModule), |
||||
|
typeof(AbpAccountApplicationModule), |
||||
|
typeof(CompanyNameProjectNameApplicationContractsModule), |
||||
|
typeof(AbpIdentityApplicationModule), |
||||
|
typeof(AbpPermissionManagementApplicationModule), |
||||
|
typeof(AbpTenantManagementApplicationModule), |
||||
|
typeof(AbpFeatureManagementApplicationModule), |
||||
|
typeof(EasyAbp.Abp.SettingUi.SettingUiApplicationModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNameApplicationModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
|
||||
|
Configure<AbpAutoMapperOptions>(options => |
||||
|
{ |
||||
|
options.AddMaps<CompanyNameProjectNameApplicationModule>(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,81 @@ |
|||||
|
using Hangfire; |
||||
|
using System; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Jobs |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Cron类型
|
||||
|
/// </summary>
|
||||
|
public static class CronTypeHelper |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 周期性为分钟的任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="interval">执行周期的间隔,默认为每分钟一次</param>
|
||||
|
/// <returns></returns>
|
||||
|
public static string Minute(int interval = 1) |
||||
|
{ |
||||
|
return "1 0/" + interval.ToString() + " * * * ? "; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 周期性为小时的任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="minute">第几分钟开始,默认为第一分钟</param>
|
||||
|
/// <param name="interval">执行周期的间隔,默认为每小时一次</param>
|
||||
|
/// <returns></returns>
|
||||
|
public static string Hour(int minute = 1, int interval = 1) |
||||
|
{ |
||||
|
return "1 " + minute + " 0/" + interval.ToString() + " * * ? "; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 周期性为天的任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="hour">第几小时开始,默认从1点开始</param>
|
||||
|
/// <param name="minute">第几分钟开始,默认从第1分钟开始</param>
|
||||
|
/// <param name="interval">执行周期的间隔,默认为每天一次</param>
|
||||
|
/// <returns></returns>
|
||||
|
public static string Day(int hour = 1, int minute = 1, int interval = 1) |
||||
|
{ |
||||
|
return "1 " + minute.ToString() + " " + hour.ToString() + " 1/" + interval.ToString() + " * ? "; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 周期性为周的任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="dayOfWeek">星期几开始,默认从星期一点开始</param>
|
||||
|
/// <param name="hour">第几小时开始,默认从1点开始</param>
|
||||
|
/// <param name="minute">第几分钟开始,默认从第1分钟开始</param>
|
||||
|
/// <returns></returns>
|
||||
|
public static string Week(DayOfWeek dayOfWeek = DayOfWeek.Monday, int hour = 1, int minute = 1) |
||||
|
{ |
||||
|
return Cron.Weekly(dayOfWeek, hour, minute); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 周期性为月的任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="day">几号开始,默认从一号开始</param>
|
||||
|
/// <param name="hour">第几小时开始,默认从1点开始</param>
|
||||
|
/// <param name="minute">第几分钟开始,默认从第1分钟开始</param>
|
||||
|
/// <returns></returns>
|
||||
|
public static string Month(int day = 1, int hour = 1, int minute = 1) |
||||
|
{ |
||||
|
return Cron.Monthly(day, hour, minute); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 周期性为年的任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="month">几月开始,默认从一月开始</param>
|
||||
|
/// <param name="day">几号开始,默认从一号开始</param>
|
||||
|
/// <param name="hour">第几小时开始,默认从1点开始</param>
|
||||
|
/// <param name="minute">第几分钟开始,默认从第1分钟开始</param>
|
||||
|
/// <returns></returns>
|
||||
|
public static string Year(int month = 1, int day = 1, int hour = 1, int minute = 1) |
||||
|
{ |
||||
|
return Cron.Yearly(month, day, hour, minute); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using Serilog; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Jobs |
||||
|
{ |
||||
|
public class TestJob : IRecurringJob |
||||
|
{ |
||||
|
public async Task ExecuteAsync() |
||||
|
{ |
||||
|
await Task.CompletedTask; |
||||
|
Log.Information("TestJob"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
using System.Runtime.CompilerServices; |
||||
|
[assembly:InternalsVisibleToAttribute("CompanyNameProjectName.Application.Tests")] |
||||
@ -0,0 +1,86 @@ |
|||||
|
using CompanyNameProjectName.Roles.Dtos; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Swashbuckle.AspNetCore.Annotations; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.PermissionManagement; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Roles |
||||
|
{ |
||||
|
public class RoleAppService : ApplicationService |
||||
|
{ |
||||
|
private readonly IIdentityRoleAppService _identityRoleAppService; |
||||
|
private readonly IPermissionAppService _permissionAppService; |
||||
|
protected IIdentityRoleRepository _roleRepository; |
||||
|
public RoleAppService(IIdentityRoleAppService identityRoleAppService, IPermissionAppService permissionAppService, IIdentityRoleRepository roleRepository) |
||||
|
{ |
||||
|
_identityRoleAppService = identityRoleAppService; |
||||
|
_permissionAppService = permissionAppService; |
||||
|
_roleRepository = roleRepository; |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
[SwaggerOperation(summary: "获取所有角色", Tags = new[] { "Role" })] |
||||
|
public async Task<ListResultDto<IdentityRoleDto>> AllListAsync() |
||||
|
{ |
||||
|
List<IdentityRole> source = await _roleRepository.GetListAsync().ConfigureAwait(continueOnCapturedContext: false); |
||||
|
return new ListResultDto<IdentityRoleDto>(base.ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(source)); |
||||
|
//return await _identityRoleAppService.GetAllListAsync();
|
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
[SwaggerOperation(summary: "分页获取角色列表", Tags = new[] { "Role" })] |
||||
|
public async Task<PagedResultDto<IdentityRoleDto>> ListAsync(GetRoleListInput input) |
||||
|
{ |
||||
|
var request = new GetIdentityRolesInput(); |
||||
|
request.Filter = input.filter?.Trim(); |
||||
|
request.MaxResultCount = input.PageSize; |
||||
|
request.SkipCount = (input.pageIndex - 1) * input.PageSize; |
||||
|
return await _identityRoleAppService.GetListAsync(request); |
||||
|
} |
||||
|
|
||||
|
[Authorize("AbpIdentity.Roles.Create")] |
||||
|
[HttpPost] |
||||
|
[SwaggerOperation(summary: "创建角色", Tags = new[] { "Role" })] |
||||
|
public async Task<IdentityRoleDto> CreateAsync(IdentityRoleCreateDto input) |
||||
|
{ |
||||
|
return await _identityRoleAppService.CreateAsync(input); |
||||
|
} |
||||
|
|
||||
|
[Authorize("AbpIdentity.Roles.Update")] |
||||
|
[HttpPost] |
||||
|
[SwaggerOperation(summary: "更新角色", Tags = new[] { "Role" })] |
||||
|
public async Task<IdentityRoleDto> UpdateAsync(UpdateRoleInput input) |
||||
|
{ |
||||
|
return await _identityRoleAppService.UpdateAsync(input.RoleId, input.RoleInfo); |
||||
|
} |
||||
|
|
||||
|
[Authorize("AbpIdentity.Roles.Delete")] |
||||
|
[SwaggerOperation(summary: "删除角色", Tags = new[] { "Role" })] |
||||
|
public async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
await _identityRoleAppService.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
[SwaggerOperation(summary: "获取角色权限", Tags = new[] { "Role" })] |
||||
|
public async Task<GetPermissionListResultDto> GetPermissionAsync(string providerName, string providerKey) |
||||
|
{ |
||||
|
return await _permissionAppService.GetAsync(providerName, providerKey); |
||||
|
} |
||||
|
|
||||
|
[SwaggerOperation(summary: "修改角色权限", Tags = new[] { "Role" })] |
||||
|
[HttpPost] |
||||
|
[Authorize("AbpIdentity.Roles.ManagePermissions")] |
||||
|
public async Task UpdatePermissionAsync(UpdateRolePermissionsDto input) |
||||
|
{ |
||||
|
await _permissionAppService.UpdateAsync(input.ProviderName, input.ProviderKey, input.UpdatePermissionsDto); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
using CompanyNameProjectName.Dtos.Users; |
||||
|
using CompanyNameProjectName.Options; |
||||
|
using IdentityModel; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Microsoft.IdentityModel.Tokens; |
||||
|
using Swashbuckle.AspNetCore.Annotations; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IdentityModel.Tokens.Jwt; |
||||
|
using System.Linq; |
||||
|
using System.Security.Claims; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Identity; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Users |
||||
|
{ |
||||
|
|
||||
|
public class LoginAppService : ApplicationService, ILoginAppService |
||||
|
{ |
||||
|
private readonly IdentityUserManager _userManager; |
||||
|
private readonly JwtOptions _jwtOptions; |
||||
|
private readonly Microsoft.AspNetCore.Identity.SignInManager<Volo.Abp.Identity.IdentityUser> _signInManager; |
||||
|
|
||||
|
public LoginAppService( |
||||
|
IdentityUserManager userManager, |
||||
|
IOptionsSnapshot<JwtOptions> jwtOptions, |
||||
|
Microsoft.AspNetCore.Identity.SignInManager<IdentityUser> signInManager) |
||||
|
{ |
||||
|
_userManager = userManager; |
||||
|
_jwtOptions = jwtOptions.Value; |
||||
|
_signInManager = signInManager; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
[SwaggerOperation(summary: "登录", Tags = new[] { "Login" })] |
||||
|
public async Task<LoginOutputDto> PostAsync(LoginInputDto input) |
||||
|
{ |
||||
|
var result = await _signInManager.PasswordSignInAsync(input.Name, input.Password, false, true); |
||||
|
if (!result.Succeeded) throw new BusinessException("Login Faild"); |
||||
|
|
||||
|
var user = await _userManager.FindByNameAsync(input.Name); |
||||
|
if (user != null) |
||||
|
{ |
||||
|
|
||||
|
if (user == null) throw new BusinessException("Login Faild"); |
||||
|
var roles = await _userManager.GetRolesAsync(user); |
||||
|
if (roles == null || roles.Count == 0) throw new BusinessException("Login Faild"); |
||||
|
var token = GenerateJwt(user, roles.ToList()); |
||||
|
var loginOutputDto = ObjectMapper.Map<IdentityUser, LoginOutputDto>(user); |
||||
|
loginOutputDto.Token = token; |
||||
|
loginOutputDto.Expiration = DateTime.Now.AddHours(_jwtOptions.ExpirationTime); |
||||
|
return loginOutputDto; |
||||
|
} |
||||
|
throw new BusinessException("Login Faild"); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生成jwt token
|
||||
|
/// </summary>
|
||||
|
/// <param name="user"></param>
|
||||
|
/// <param name="roles"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private string GenerateJwt(IdentityUser user, List<string> roles) |
||||
|
{ |
||||
|
var dateNow = DateTime.Now; |
||||
|
var expirationTime = dateNow + TimeSpan.FromHours(_jwtOptions.ExpirationTime); |
||||
|
var key = Encoding.ASCII.GetBytes(_jwtOptions.SecurityKey); |
||||
|
|
||||
|
var claims = new List<Claim> { |
||||
|
new Claim(JwtClaimTypes.Audience, _jwtOptions.Audience), |
||||
|
new Claim(JwtClaimTypes.Issuer, _jwtOptions.Issuer), |
||||
|
new Claim(JwtClaimTypes.Subject, user.Id.ToString()), |
||||
|
new Claim(JwtClaimTypes.Name, user.Name), |
||||
|
new Claim(JwtClaimTypes.Email, user.Email), |
||||
|
new Claim("TenantId", user.TenantId.ToString()) |
||||
|
}; |
||||
|
|
||||
|
foreach (var item in roles) |
||||
|
{ |
||||
|
claims.Add(new Claim(JwtClaimTypes.Role, item)); |
||||
|
} |
||||
|
var tokenDescriptor = new SecurityTokenDescriptor() |
||||
|
{ |
||||
|
Subject = new ClaimsIdentity(claims), |
||||
|
Expires = expirationTime, |
||||
|
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) |
||||
|
}; |
||||
|
var handler = new JwtSecurityTokenHandler(); |
||||
|
var token = handler.CreateToken(tokenDescriptor); |
||||
|
return handler.WriteToken(token); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,69 @@ |
|||||
|
using CompanyNameProjectName.Users.Dtos; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Swashbuckle.AspNetCore.Annotations; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Identity; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Users |
||||
|
{ |
||||
|
public class UserAppService : ApplicationService |
||||
|
{ |
||||
|
private readonly IIdentityUserAppService _identityUserAppService; |
||||
|
|
||||
|
public UserAppService(IIdentityUserAppService identityUserAppService) |
||||
|
{ |
||||
|
_identityUserAppService = identityUserAppService; |
||||
|
} |
||||
|
|
||||
|
[SwaggerOperation(summary: "分页获取用户信息", Tags = new[] { "User" })] |
||||
|
[Authorize("AbpIdentity.Users")] |
||||
|
[HttpPost] |
||||
|
public async Task<PagedResultDto<IdentityUserDto>> ListAsync(GetUserListInput input) |
||||
|
{ |
||||
|
var request = new GetIdentityUsersInput(); |
||||
|
request.Filter = input.filter?.Trim(); |
||||
|
request.MaxResultCount = input.PageSize; |
||||
|
request.SkipCount = (input.pageIndex - 1) * input.PageSize; |
||||
|
request.Sorting= " LastModificationTime desc"; |
||||
|
return await _identityUserAppService.GetListAsync(request); |
||||
|
} |
||||
|
|
||||
|
[SwaggerOperation(summary: "创建用户", Tags = new[] { "User" })] |
||||
|
[Authorize("AbpIdentity.Users.Create")] |
||||
|
[HttpPost] |
||||
|
public async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input) |
||||
|
{ |
||||
|
return await _identityUserAppService.CreateAsync(input); |
||||
|
} |
||||
|
|
||||
|
[SwaggerOperation(summary: "更新用户", Tags = new[] { "User" })] |
||||
|
[Authorize("AbpIdentity.Users.Update")] |
||||
|
[HttpPost] |
||||
|
public virtual async Task<IdentityUserDto> UpdateAsync(UpdateUserInput input) |
||||
|
{ |
||||
|
return await _identityUserAppService.UpdateAsync(input.UserId,input.UserInfo); |
||||
|
} |
||||
|
|
||||
|
[SwaggerOperation(summary: "删除用户", Tags = new[] { "User" })] |
||||
|
[Authorize("AbpIdentity.Users.Delete")] |
||||
|
public virtual async Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
await _identityUserAppService.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
[SwaggerOperation(summary: "获取用户角色", Tags = new[] { "User" })] |
||||
|
[Authorize("AbpIdentity.Users")] |
||||
|
[HttpPost("/api/app/user/role/{userId}")] |
||||
|
public async Task<ListResultDto<IdentityRoleDto>> GetRoleByUserId(Guid userId) |
||||
|
{ |
||||
|
return await _identityUserAppService.GetRolesAsync(userId); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.1</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
|
||||
|
<PackageReference Include="EasyAbp.Abp.SettingUi.Domain.Shared" Version="1.3.1" /> |
||||
|
|
||||
|
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0" /> |
||||
|
|
||||
|
<PackageReference Include="Volo.Abp.Identity.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.AuditLogging.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.TenantManagement.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.FeatureManagement.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="$(AbpVersion)" /> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<PackageReference Include="Serilog" Version="2.10.0" /> |
||||
|
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" /> |
||||
|
<PackageReference Include="Serilog.Exceptions" Version="5.7.0" /> |
||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" /> |
||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" /> |
||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> |
||||
|
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" /> |
||||
|
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" /> |
||||
|
|
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="Localization\CompanyNameProjectName\*.json" /> |
||||
|
<Content Remove="Localization\CompanyNameProjectName\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="5.0.*" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameDomainErrorCodes |
||||
|
{ |
||||
|
/* You can add your business exception error codes here, as constants */ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
using Volo.Abp.AuditLogging; |
||||
|
using Volo.Abp.BackgroundJobs; |
||||
|
using Volo.Abp.FeatureManagement; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.IdentityServer; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Localization.ExceptionHandling; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.PermissionManagement; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
using Volo.Abp.TenantManagement; |
||||
|
using Volo.Abp.Validation.Localization; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
using CompanyNameProjectName.Localization; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpAuditLoggingDomainSharedModule), |
||||
|
typeof(AbpBackgroundJobsDomainSharedModule), |
||||
|
typeof(AbpFeatureManagementDomainSharedModule), |
||||
|
typeof(AbpIdentityDomainSharedModule), |
||||
|
typeof(AbpIdentityServerDomainSharedModule), |
||||
|
typeof(AbpPermissionManagementDomainSharedModule), |
||||
|
typeof(AbpSettingManagementDomainSharedModule), |
||||
|
typeof(AbpTenantManagementDomainSharedModule), |
||||
|
typeof(EasyAbp.Abp.SettingUi.SettingUiDomainSharedModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNameDomainSharedModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
CompanyNameProjectNameGlobalFeatureConfigurator.Configure(); |
||||
|
CompanyNameProjectNameModuleExtensionConfigurator.Configure(); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<CompanyNameProjectNameDomainSharedModule>(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
// 设置默认语言
|
||||
|
options.Resources |
||||
|
.Add<CompanyNameProjectNameResource>("zh-Hans") |
||||
|
.AddBaseTypes(typeof(AbpValidationResource)) |
||||
|
.AddVirtualJson("/Localization/CompanyNameProjectName"); |
||||
|
|
||||
|
options.DefaultResourceType = typeof(CompanyNameProjectNameResource); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpExceptionLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.MapCodeNamespace("CompanyNameProjectName", typeof(CompanyNameProjectNameResource)); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using Volo.Abp.Threading; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameGlobalFeatureConfigurator |
||||
|
{ |
||||
|
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
||||
|
|
||||
|
public static void Configure() |
||||
|
{ |
||||
|
OneTimeRunner.Run(() => |
||||
|
{ |
||||
|
/* You can configure (enable/disable) global features of the used modules here. |
||||
|
* |
||||
|
* YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! |
||||
|
* |
||||
|
* Please refer to the documentation to lear more about the Global Features System: |
||||
|
* https://docs.abp.io/en/abp/latest/Global-Features
|
||||
|
*/ |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,72 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.ObjectExtending; |
||||
|
using Volo.Abp.Threading; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameModuleExtensionConfigurator |
||||
|
{ |
||||
|
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
||||
|
|
||||
|
public static void Configure() |
||||
|
{ |
||||
|
OneTimeRunner.Run(() => |
||||
|
{ |
||||
|
ConfigureExistingProperties(); |
||||
|
ConfigureExtraProperties(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private static void ConfigureExistingProperties() |
||||
|
{ |
||||
|
/* You can change max lengths for properties of the |
||||
|
* entities defined in the modules used by your application. |
||||
|
* |
||||
|
* Example: Change user and role name max lengths |
||||
|
|
||||
|
IdentityUserConsts.MaxNameLength = 99; |
||||
|
IdentityRoleConsts.MaxNameLength = 99; |
||||
|
|
||||
|
* Notice: It is not suggested to change property lengths |
||||
|
* unless you really need it. Go with the standard values wherever possible. |
||||
|
* |
||||
|
* If you are using EF Core, you will need to run the add-migration command after your changes. |
||||
|
*/ |
||||
|
} |
||||
|
|
||||
|
private static void ConfigureExtraProperties() |
||||
|
{ |
||||
|
/* You can configure extra properties for the |
||||
|
* entities defined in the modules used by your application. |
||||
|
* |
||||
|
* This class can be used to define these extra properties |
||||
|
* with a high level, easy to use API. |
||||
|
* |
||||
|
* Example: Add a new property to the user entity of the identity module |
||||
|
|
||||
|
ObjectExtensionManager.Instance.Modules() |
||||
|
.ConfigureIdentity(identity => |
||||
|
{ |
||||
|
identity.ConfigureUser(user => |
||||
|
{ |
||||
|
user.AddOrUpdateProperty<string>( //property type: string
|
||||
|
"SocialSecurityNumber", //property name
|
||||
|
property => |
||||
|
{ |
||||
|
//validation rules
|
||||
|
property.Attributes.Add(new RequiredAttribute()); |
||||
|
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); |
||||
|
|
||||
|
//...other configurations for this property
|
||||
|
} |
||||
|
); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
* See the documentation for more: |
||||
|
* https://docs.abp.io/en/latest/Module-Entity-Extensions
|
||||
|
*/ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
{ |
||||
|
"culture": "en", |
||||
|
"texts": { |
||||
|
"Menu:Home": "Home", |
||||
|
"Welcome": "Welcome", |
||||
|
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.", |
||||
|
"DataExistence": "Existence", |
||||
|
"DataNotExistence": "Not Existence", |
||||
|
"TestSettings": "TestSettings" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
{ |
||||
|
"culture": "zh-Hans", |
||||
|
"texts": { |
||||
|
"Menu:Home": "首页", |
||||
|
"Welcome": "欢迎", |
||||
|
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io.", |
||||
|
"DataExistence": "已存在", |
||||
|
"DataNotExistence": "不存在", |
||||
|
"Permission:Query": "查询", |
||||
|
"TestSettings": "测试Settings" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Localization |
||||
|
{ |
||||
|
[LocalizationResourceName("CompanyNameProjectName")] |
||||
|
public class CompanyNameProjectNameResource |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace CompanyNameProjectName.MultiTenancy |
||||
|
{ |
||||
|
public static class MultiTenancyConsts |
||||
|
{ |
||||
|
/* Enable/disable multi-tenancy easily in a single point. |
||||
|
* If you will never need to multi-tenancy, you can remove |
||||
|
* related modules and code parts, including this file. |
||||
|
*/ |
||||
|
public const bool IsEnabled = false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net5.0</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="EasyAbp.Abp.SettingUi.Domain" Version="1.3.1" /> |
||||
|
<PackageReference Include="Volo.Abp.Emailing" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Identity.Domain" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.TenantManagement.Domain" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Caching" Version="$(AbpVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.Domain.Shared\CompanyName.ProjectName.Domain.Shared.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameConsts |
||||
|
{ |
||||
|
public const string DbTablePrefix = "App"; |
||||
|
|
||||
|
public const string DbSchema = null; |
||||
|
|
||||
|
public const string CompanyNameProjectNameDbTablePrefix = "CompanyNameProjectName"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,49 @@ |
|||||
|
using Microsoft.Extensions.Caching.Distributed; |
||||
|
using System; |
||||
|
using Volo.Abp.AuditLogging; |
||||
|
using Volo.Abp.BackgroundJobs; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Volo.Abp.FeatureManagement; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.IdentityServer; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
using Volo.Abp.PermissionManagement.Identity; |
||||
|
using Volo.Abp.PermissionManagement.IdentityServer; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
using Volo.Abp.TenantManagement; |
||||
|
using CompanyNameProjectName.MultiTenancy; |
||||
|
|
||||
|
namespace CompanyNameProjectName |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(CompanyNameProjectNameDomainSharedModule), |
||||
|
typeof(AbpAuditLoggingDomainModule), |
||||
|
typeof(AbpBackgroundJobsDomainModule), |
||||
|
typeof(AbpFeatureManagementDomainModule), |
||||
|
typeof(AbpIdentityDomainModule), |
||||
|
typeof(AbpPermissionManagementDomainIdentityModule), |
||||
|
typeof(AbpIdentityServerDomainModule), |
||||
|
typeof(AbpPermissionManagementDomainIdentityServerModule), |
||||
|
typeof(AbpSettingManagementDomainModule), |
||||
|
typeof(AbpTenantManagementDomainModule), |
||||
|
typeof(EasyAbp.Abp.SettingUi.SettingUiDomainModule), |
||||
|
typeof(AbpCachingModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNameDomainModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpMultiTenancyOptions>(options => |
||||
|
{ |
||||
|
options.IsEnabled = MultiTenancyConsts.IsEnabled; |
||||
|
}); |
||||
|
|
||||
|
// 设置全局默认缓存时间
|
||||
|
//Configure<AbpDistributedCacheOptions>(option =>
|
||||
|
//{
|
||||
|
// option.GlobalCacheEntryOptions.SetSlidingExpiration(TimeSpan.FromSeconds(7200));
|
||||
|
//});
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,93 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Microsoft.Extensions.Logging.Abstractions; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
using Volo.Abp.TenantManagement; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Data |
||||
|
{ |
||||
|
public class CompanyNameProjectNameDbMigrationService : ITransientDependency |
||||
|
{ |
||||
|
public ILogger<CompanyNameProjectNameDbMigrationService> Logger { get; set; } |
||||
|
|
||||
|
private readonly IDataSeeder _dataSeeder; |
||||
|
private readonly IEnumerable<ICompanyNameProjectNameDbSchemaMigrator> _dbSchemaMigrators; |
||||
|
private readonly ITenantRepository _tenantRepository; |
||||
|
private readonly ICurrentTenant _currentTenant; |
||||
|
|
||||
|
public CompanyNameProjectNameDbMigrationService( |
||||
|
IDataSeeder dataSeeder, |
||||
|
IEnumerable<ICompanyNameProjectNameDbSchemaMigrator> dbSchemaMigrators, |
||||
|
ITenantRepository tenantRepository, |
||||
|
ICurrentTenant currentTenant) |
||||
|
{ |
||||
|
_dataSeeder = dataSeeder; |
||||
|
_dbSchemaMigrators = dbSchemaMigrators; |
||||
|
_tenantRepository = tenantRepository; |
||||
|
_currentTenant = currentTenant; |
||||
|
|
||||
|
Logger = NullLogger<CompanyNameProjectNameDbMigrationService>.Instance; |
||||
|
} |
||||
|
|
||||
|
public async Task MigrateAsync() |
||||
|
{ |
||||
|
Logger.LogInformation("Started database migrations..."); |
||||
|
|
||||
|
await MigrateDatabaseSchemaAsync(); |
||||
|
await SeedDataAsync(); |
||||
|
|
||||
|
Logger.LogInformation($"Successfully completed host database migrations."); |
||||
|
|
||||
|
var tenants = await _tenantRepository.GetListAsync(includeDetails: true); |
||||
|
|
||||
|
var migratedDatabaseSchemas = new HashSet<string>(); |
||||
|
foreach (var tenant in tenants) |
||||
|
{ |
||||
|
using (_currentTenant.Change(tenant.Id)) |
||||
|
{ |
||||
|
if (tenant.ConnectionStrings.Any()) |
||||
|
{ |
||||
|
var tenantConnectionStrings = tenant.ConnectionStrings |
||||
|
.Select(x => x.Value) |
||||
|
.ToList(); |
||||
|
|
||||
|
if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings)) |
||||
|
{ |
||||
|
await MigrateDatabaseSchemaAsync(tenant); |
||||
|
|
||||
|
migratedDatabaseSchemas.AddIfNotContains(tenantConnectionStrings); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
await SeedDataAsync(tenant); |
||||
|
} |
||||
|
|
||||
|
Logger.LogInformation($"Successfully completed {tenant.Name} tenant database migrations."); |
||||
|
} |
||||
|
|
||||
|
Logger.LogInformation("Successfully completed database migrations."); |
||||
|
} |
||||
|
|
||||
|
private async Task MigrateDatabaseSchemaAsync(Tenant tenant = null) |
||||
|
{ |
||||
|
Logger.LogInformation( |
||||
|
$"Migrating schema for {(tenant == null ? "host" : tenant.Name + " tenant")} database..."); |
||||
|
|
||||
|
foreach (var migrator in _dbSchemaMigrators) |
||||
|
{ |
||||
|
await migrator.MigrateAsync(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private async Task SeedDataAsync(Tenant tenant = null) |
||||
|
{ |
||||
|
Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); |
||||
|
|
||||
|
await _dataSeeder.SeedAsync(tenant?.Id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Data |
||||
|
{ |
||||
|
public interface ICompanyNameProjectNameDbSchemaMigrator |
||||
|
{ |
||||
|
Task MigrateAsync(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Data |
||||
|
{ |
||||
|
/* This is used if database provider does't define |
||||
|
* ICompanyNameProjectNameDbSchemaMigrator implementation. |
||||
|
*/ |
||||
|
public class NullCompanyNameProjectNameDbSchemaMigrator : ICompanyNameProjectNameDbSchemaMigrator, ITransientDependency |
||||
|
{ |
||||
|
public Task MigrateAsync() |
||||
|
{ |
||||
|
return Task.CompletedTask; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
using System.Runtime.CompilerServices; |
||||
|
[assembly:InternalsVisibleToAttribute("CompanyNameProjectName.Domain.Tests")] |
||||
|
[assembly:InternalsVisibleToAttribute("CompanyNameProjectName.TestBase")] |
||||
@ -0,0 +1,32 @@ |
|||||
|
|
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Settings; |
||||
|
using CompanyNameProjectName.Localization; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Settings |
||||
|
{ |
||||
|
public class CompanyNameProjectNameSettingDefinitionProvider : SettingDefinitionProvider |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
public override void Define(ISettingDefinitionContext context) |
||||
|
{ |
||||
|
//Define your own settings here. Example:
|
||||
|
//context.Add(new SettingDefinition(CompanyNameProjectNameSettings.MySetting1));
|
||||
|
context.Add( |
||||
|
new SettingDefinition( |
||||
|
name:"测试", |
||||
|
defaultValue:"test", |
||||
|
displayName: L("TestSettings") |
||||
|
).WithProviders( |
||||
|
DefaultValueSettingValueProvider.ProviderName, |
||||
|
GlobalSettingValueProvider.ProviderName) |
||||
|
);; |
||||
|
} |
||||
|
|
||||
|
private static LocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<CompanyNameProjectNameResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
namespace CompanyNameProjectName.Settings |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameSettings |
||||
|
{ |
||||
|
private const string Prefix = "CompanyNameProjectName"; |
||||
|
|
||||
|
//Add your own setting names here. Example:
|
||||
|
//public const string MySetting1 = Prefix + ".MySetting1";
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,63 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Users |
||||
|
{ |
||||
|
/* This entity shares the same table/collection ("AbpUsers" by default) with the |
||||
|
* IdentityUser entity of the Identity module. |
||||
|
* |
||||
|
* - You can define your custom properties into this class. |
||||
|
* - You never create or delete this entity, because it is Identity module's job. |
||||
|
* - You can query users from database with this entity. |
||||
|
* - You can update values of your custom properties. |
||||
|
*/ |
||||
|
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser |
||||
|
{ |
||||
|
#region Base properties
|
||||
|
|
||||
|
/* These properties are shared with the IdentityUser entity of the Identity module. |
||||
|
* Do not change these properties through this class. Instead, use Identity module |
||||
|
* services (like IdentityUserManager) to change them. |
||||
|
* So, this properties are designed as read only! |
||||
|
*/ |
||||
|
|
||||
|
public virtual Guid? TenantId { get; private set; } |
||||
|
|
||||
|
public virtual string UserName { get; private set; } |
||||
|
|
||||
|
public virtual string Name { get; private set; } |
||||
|
|
||||
|
public virtual string Surname { get; private set; } |
||||
|
|
||||
|
public virtual string Email { get; private set; } |
||||
|
|
||||
|
public virtual bool EmailConfirmed { get; private set; } |
||||
|
|
||||
|
public virtual string PhoneNumber { get; private set; } |
||||
|
|
||||
|
public virtual bool PhoneNumberConfirmed { get; private set; } |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
/* Add your own properties here. Example: |
||||
|
* |
||||
|
* public string MyProperty { get; set; } |
||||
|
* |
||||
|
* If you add a property and using the EF Core, remember these; |
||||
|
* |
||||
|
* 1. Update CompanyNameProjectNameDbContext.OnModelCreating |
||||
|
* to configure the mapping for your new property |
||||
|
* 2. Update CompanyNameProjectNameEfCoreEntityExtensionMappings to extend the IdentityUser entity |
||||
|
* and add your new property to the migration. |
||||
|
* 3. Use the Add-Migration to add a new database migration. |
||||
|
* 4. Run the .DbMigrator project (or use the Update-Database command) to apply |
||||
|
* schema change to the database. |
||||
|
*/ |
||||
|
|
||||
|
private AppUser() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net5.0</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.*" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.EntityFrameworkCore\CompanyName.ProjectName.EntityFrameworkCore.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,16 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(CompanyNameProjectNameEntityFrameworkCoreModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNameEntityFrameworkCoreDbMigrationsModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddAbpDbContext<CompanyNameProjectNameMigrationsDbContext>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
||||
|
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
||||
|
using Volo.Abp.Identity.EntityFrameworkCore; |
||||
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
||||
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
||||
|
using Volo.Abp.TenantManagement.EntityFrameworkCore; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
/* This DbContext is only used for database migrations. |
||||
|
* It is not used on runtime. See CompanyNameProjectNameDbContext for the runtime DbContext. |
||||
|
* It is a unified model that includes configuration for |
||||
|
* all used modules and your application. |
||||
|
*/ |
||||
|
public class CompanyNameProjectNameMigrationsDbContext : AbpDbContext<CompanyNameProjectNameMigrationsDbContext> |
||||
|
{ |
||||
|
public CompanyNameProjectNameMigrationsDbContext(DbContextOptions<CompanyNameProjectNameMigrationsDbContext> options) |
||||
|
: base(options) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder builder) |
||||
|
{ |
||||
|
base.OnModelCreating(builder); |
||||
|
|
||||
|
/* Include modules to your migration db context */ |
||||
|
|
||||
|
builder.ConfigurePermissionManagement(); |
||||
|
builder.ConfigureSettingManagement(); |
||||
|
builder.ConfigureBackgroundJobs(); |
||||
|
builder.ConfigureAuditLogging(); |
||||
|
builder.ConfigureIdentity(); |
||||
|
//builder.ConfigureIdentityServer();
|
||||
|
builder.ConfigureFeatureManagement(); |
||||
|
builder.ConfigureTenantManagement(); |
||||
|
|
||||
|
/* Configure your own tables/entities inside the ConfigureCompanyNameProjectName method */ |
||||
|
|
||||
|
builder.ConfigureCompanyNameProjectName(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,49 @@ |
|||||
|
using System; |
||||
|
using System.IO; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Microsoft.EntityFrameworkCore.Design; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Pomelo.EntityFrameworkCore.MySql.Infrastructure; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
/* This class is needed for EF Core console commands |
||||
|
* (like Add-Migration and Update-Database commands) */ |
||||
|
public class CompanyNameProjectNameMigrationsDbContextFactory : IDesignTimeDbContextFactory<CompanyNameProjectNameMigrationsDbContext> |
||||
|
{ |
||||
|
public CompanyNameProjectNameMigrationsDbContext CreateDbContext(string[] args) |
||||
|
{ |
||||
|
CompanyNameProjectNameEfCoreEntityExtensionMappings.Configure(); |
||||
|
|
||||
|
var configuration = BuildConfiguration(); |
||||
|
|
||||
|
//var builder = new DbContextOptionsBuilder<CompanyNameProjectNameMigrationsDbContext>()
|
||||
|
// .UseSqlServer(configuration.GetConnectionString("Default"));
|
||||
|
var builder = new DbContextOptionsBuilder<CompanyNameProjectNameMigrationsDbContext>() |
||||
|
.UseMySql(configuration.GetConnectionString("Default"), new MySqlServerVersion(new Version(5, 7)), mySqlOptions => mySqlOptions |
||||
|
.CharSetBehavior(CharSetBehavior.NeverAppend)); |
||||
|
|
||||
|
return new CompanyNameProjectNameMigrationsDbContext(builder.Options); |
||||
|
} |
||||
|
|
||||
|
//private static IConfigurationRoot BuildConfiguration()
|
||||
|
//{
|
||||
|
// var builder = new ConfigurationBuilder()
|
||||
|
// .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../CompanyNameProjectName.DbMigrator/"))
|
||||
|
// .AddJsonFile("appsettings.json", optional: false);
|
||||
|
|
||||
|
// return builder.Build();
|
||||
|
//}
|
||||
|
|
||||
|
private static IConfigurationRoot BuildConfiguration() |
||||
|
{ |
||||
|
var path = Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).FullName).FullName; |
||||
|
var builder = new ConfigurationBuilder() |
||||
|
.SetBasePath(Path.Combine(path, "tools", "CompanyName.ProjectName.DbMigrator")) |
||||
|
.AddJsonFile("appsettings.json", optional: true) |
||||
|
.AddEnvironmentVariables(); |
||||
|
return builder.Build(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using CompanyNameProjectName.Data; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
public class EntityFrameworkCoreCompanyNameProjectNameDbSchemaMigrator |
||||
|
: ICompanyNameProjectNameDbSchemaMigrator, ITransientDependency |
||||
|
{ |
||||
|
private readonly IServiceProvider _serviceProvider; |
||||
|
|
||||
|
public EntityFrameworkCoreCompanyNameProjectNameDbSchemaMigrator( |
||||
|
IServiceProvider serviceProvider) |
||||
|
{ |
||||
|
_serviceProvider = serviceProvider; |
||||
|
} |
||||
|
|
||||
|
public async Task MigrateAsync() |
||||
|
{ |
||||
|
/* We intentionally resolving the CompanyNameProjectNameMigrationsDbContext |
||||
|
* from IServiceProvider (instead of directly injecting it) |
||||
|
* to properly get the connection string of the current tenant in the |
||||
|
* current scope. |
||||
|
*/ |
||||
|
|
||||
|
await _serviceProvider |
||||
|
.GetRequiredService<CompanyNameProjectNameMigrationsDbContext>() |
||||
|
.Database |
||||
|
.MigrateAsync(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,754 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Migrations |
||||
|
{ |
||||
|
public partial class Init : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAuditLogs", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
ApplicationName = table.Column<string>(type: "varchar(96)", maxLength: 96, nullable: true), |
||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
TenantName = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ImpersonatorUserId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ImpersonatorTenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ExecutionTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
ExecutionDuration = table.Column<int>(type: "int", nullable: false), |
||||
|
ClientIpAddress = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
ClientName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true), |
||||
|
ClientId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
CorrelationId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
BrowserInfo = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true), |
||||
|
HttpMethod = table.Column<string>(type: "varchar(16)", maxLength: 16, nullable: true), |
||||
|
Url = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true), |
||||
|
Exceptions = table.Column<string>(type: "longtext", maxLength: 4000, nullable: true), |
||||
|
Comments = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true), |
||||
|
HttpStatusCode = table.Column<int>(type: "int", nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpBackgroundJobs", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
JobName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
JobArgs = table.Column<string>(type: "longtext", maxLength: 1048576, nullable: false), |
||||
|
TryCount = table.Column<short>(type: "smallint", nullable: false, defaultValue: (short)0), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
NextTryTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
LastTryTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
||||
|
IsAbandoned = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
Priority = table.Column<byte>(type: "tinyint unsigned", nullable: false, defaultValue: (byte)15), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpClaimTypes", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
Required = table.Column<bool>(type: "tinyint(1)", nullable: false), |
||||
|
IsStatic = table.Column<bool>(type: "tinyint(1)", nullable: false), |
||||
|
Regex = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true), |
||||
|
RegexDescription = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true), |
||||
|
Description = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true), |
||||
|
ValueType = table.Column<int>(type: "int", nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpFeatureValues", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
Value = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
ProviderName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
ProviderKey = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpFeatureValues", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpLinkUsers", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
SourceUserId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
SourceTenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
TargetUserId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TargetTenantId = table.Column<Guid>(type: "char(36)", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpLinkUsers", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpOrganizationUnits", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ParentId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
Code = table.Column<string>(type: "varchar(95)", maxLength: 95, nullable: false), |
||||
|
DisplayName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", |
||||
|
column: x => x.ParentId, |
||||
|
principalTable: "AbpOrganizationUnits", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Restrict); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpPermissionGrants", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
ProviderName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false), |
||||
|
ProviderKey = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpRoles", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
NormalizedName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
IsDefault = table.Column<bool>(type: "tinyint(1)", nullable: false), |
||||
|
IsStatic = table.Column<bool>(type: "tinyint(1)", nullable: false), |
||||
|
IsPublic = table.Column<bool>(type: "tinyint(1)", nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpRoles", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpSecurityLogs", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ApplicationName = table.Column<string>(type: "varchar(96)", maxLength: 96, nullable: true), |
||||
|
Identity = table.Column<string>(type: "varchar(96)", maxLength: 96, nullable: true), |
||||
|
Action = table.Column<string>(type: "varchar(96)", maxLength: 96, nullable: true), |
||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true), |
||||
|
TenantName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
ClientId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
CorrelationId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
ClientIpAddress = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
BrowserInfo = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpSettings", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
Value = table.Column<string>(type: "longtext", maxLength: 2048, nullable: false), |
||||
|
ProviderName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
ProviderKey = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpSettings", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpTenants", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpTenants", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpUsers", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
NormalizedUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
Surname = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true), |
||||
|
Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
NormalizedEmail = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
EmailConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
PasswordHash = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true), |
||||
|
SecurityStamp = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
IsExternal = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
PhoneNumber = table.Column<string>(type: "varchar(16)", maxLength: 16, nullable: true), |
||||
|
PhoneNumberConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
TwoFactorEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
LockoutEnd = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true), |
||||
|
LockoutEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
AccessFailedCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpUsers", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAuditLogActions", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
AuditLogId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
ServiceName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true), |
||||
|
MethodName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true), |
||||
|
Parameters = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true), |
||||
|
ExecutionTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
ExecutionDuration = table.Column<int>(type: "int", nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", |
||||
|
column: x => x.AuditLogId, |
||||
|
principalTable: "AbpAuditLogs", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpEntityChanges", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
AuditLogId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ChangeTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
ChangeType = table.Column<byte>(type: "tinyint unsigned", nullable: false), |
||||
|
EntityTenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
EntityId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
EntityTypeFullName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", |
||||
|
column: x => x.AuditLogId, |
||||
|
principalTable: "AbpAuditLogs", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpOrganizationUnitRoles", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
RoleId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
OrganizationUnitId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUn~", |
||||
|
column: x => x.OrganizationUnitId, |
||||
|
principalTable: "AbpOrganizationUnits", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", |
||||
|
column: x => x.RoleId, |
||||
|
principalTable: "AbpRoles", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpRoleClaims", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
RoleId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ClaimType = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
ClaimValue = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpRoleClaims_AbpRoles_RoleId", |
||||
|
column: x => x.RoleId, |
||||
|
principalTable: "AbpRoles", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpTenantConnectionStrings", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false), |
||||
|
Value = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", |
||||
|
column: x => x.TenantId, |
||||
|
principalTable: "AbpTenants", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpUserClaims", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ClaimType = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false), |
||||
|
ClaimValue = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpUserClaims", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpUserClaims_AbpUsers_UserId", |
||||
|
column: x => x.UserId, |
||||
|
principalTable: "AbpUsers", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpUserLogins", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
LoginProvider = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
ProviderKey = table.Column<string>(type: "varchar(196)", maxLength: 196, nullable: false), |
||||
|
ProviderDisplayName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpUserLogins_AbpUsers_UserId", |
||||
|
column: x => x.UserId, |
||||
|
principalTable: "AbpUsers", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpUserOrganizationUnits", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
OrganizationUnitId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUn~", |
||||
|
column: x => x.OrganizationUnitId, |
||||
|
principalTable: "AbpOrganizationUnits", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", |
||||
|
column: x => x.UserId, |
||||
|
principalTable: "AbpUsers", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpUserRoles", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
RoleId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpUserRoles_AbpRoles_RoleId", |
||||
|
column: x => x.RoleId, |
||||
|
principalTable: "AbpRoles", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpUserRoles_AbpUsers_UserId", |
||||
|
column: x => x.UserId, |
||||
|
principalTable: "AbpUsers", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpUserTokens", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
LoginProvider = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false), |
||||
|
Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
Value = table.Column<string>(type: "longtext", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpUserTokens_AbpUsers_UserId", |
||||
|
column: x => x.UserId, |
||||
|
principalTable: "AbpUsers", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpEntityPropertyChanges", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: true), |
||||
|
EntityChangeId = table.Column<Guid>(type: "char(36)", nullable: false), |
||||
|
NewValue = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true), |
||||
|
OriginalValue = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true), |
||||
|
PropertyName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false), |
||||
|
PropertyTypeFullName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", |
||||
|
column: x => x.EntityChangeId, |
||||
|
principalTable: "AbpEntityChanges", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAuditLogActions_AuditLogId", |
||||
|
table: "AbpAuditLogActions", |
||||
|
column: "AuditLogId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_Execution~", |
||||
|
table: "AbpAuditLogActions", |
||||
|
columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAuditLogs_TenantId_ExecutionTime", |
||||
|
table: "AbpAuditLogs", |
||||
|
columns: new[] { "TenantId", "ExecutionTime" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", |
||||
|
table: "AbpAuditLogs", |
||||
|
columns: new[] { "TenantId", "UserId", "ExecutionTime" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", |
||||
|
table: "AbpBackgroundJobs", |
||||
|
columns: new[] { "IsAbandoned", "NextTryTime" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpEntityChanges_AuditLogId", |
||||
|
table: "AbpEntityChanges", |
||||
|
column: "AuditLogId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", |
||||
|
table: "AbpEntityChanges", |
||||
|
columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpEntityPropertyChanges_EntityChangeId", |
||||
|
table: "AbpEntityPropertyChanges", |
||||
|
column: "EntityChangeId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey", |
||||
|
table: "AbpFeatureValues", |
||||
|
columns: new[] { "Name", "ProviderName", "ProviderKey" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_Target~", |
||||
|
table: "AbpLinkUsers", |
||||
|
columns: new[] { "SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId" }, |
||||
|
unique: true); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", |
||||
|
table: "AbpOrganizationUnitRoles", |
||||
|
columns: new[] { "RoleId", "OrganizationUnitId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpOrganizationUnits_Code", |
||||
|
table: "AbpOrganizationUnits", |
||||
|
column: "Code"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpOrganizationUnits_ParentId", |
||||
|
table: "AbpOrganizationUnits", |
||||
|
column: "ParentId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", |
||||
|
table: "AbpPermissionGrants", |
||||
|
columns: new[] { "Name", "ProviderName", "ProviderKey" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpRoleClaims_RoleId", |
||||
|
table: "AbpRoleClaims", |
||||
|
column: "RoleId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpRoles_NormalizedName", |
||||
|
table: "AbpRoles", |
||||
|
column: "NormalizedName"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpSecurityLogs_TenantId_Action", |
||||
|
table: "AbpSecurityLogs", |
||||
|
columns: new[] { "TenantId", "Action" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpSecurityLogs_TenantId_ApplicationName", |
||||
|
table: "AbpSecurityLogs", |
||||
|
columns: new[] { "TenantId", "ApplicationName" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpSecurityLogs_TenantId_Identity", |
||||
|
table: "AbpSecurityLogs", |
||||
|
columns: new[] { "TenantId", "Identity" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpSecurityLogs_TenantId_UserId", |
||||
|
table: "AbpSecurityLogs", |
||||
|
columns: new[] { "TenantId", "UserId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpSettings_Name_ProviderName_ProviderKey", |
||||
|
table: "AbpSettings", |
||||
|
columns: new[] { "Name", "ProviderName", "ProviderKey" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpTenants_Name", |
||||
|
table: "AbpTenants", |
||||
|
column: "Name"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUserClaims_UserId", |
||||
|
table: "AbpUserClaims", |
||||
|
column: "UserId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUserLogins_LoginProvider_ProviderKey", |
||||
|
table: "AbpUserLogins", |
||||
|
columns: new[] { "LoginProvider", "ProviderKey" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUserOrganizationUnits_UserId_OrganizationUnitId", |
||||
|
table: "AbpUserOrganizationUnits", |
||||
|
columns: new[] { "UserId", "OrganizationUnitId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUserRoles_RoleId_UserId", |
||||
|
table: "AbpUserRoles", |
||||
|
columns: new[] { "RoleId", "UserId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUsers_Email", |
||||
|
table: "AbpUsers", |
||||
|
column: "Email"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUsers_NormalizedEmail", |
||||
|
table: "AbpUsers", |
||||
|
column: "NormalizedEmail"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUsers_NormalizedUserName", |
||||
|
table: "AbpUsers", |
||||
|
column: "NormalizedUserName"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpUsers_UserName", |
||||
|
table: "AbpUsers", |
||||
|
column: "UserName"); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAuditLogActions"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpBackgroundJobs"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpClaimTypes"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpEntityPropertyChanges"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpFeatureValues"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpLinkUsers"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpOrganizationUnitRoles"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpPermissionGrants"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpRoleClaims"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpSecurityLogs"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpSettings"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpTenantConnectionStrings"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpUserClaims"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpUserLogins"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpUserOrganizationUnits"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpUserRoles"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpUserTokens"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpEntityChanges"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpTenants"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpOrganizationUnits"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpRoles"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpUsers"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAuditLogs"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,29 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net5.0</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
|
||||
|
<PackageReference Include="Volo.Abp.Dapper" Version="$(AbpVersion)" /> |
||||
|
<!--<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="$(AbpVersion)" />--> |
||||
|
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Mysql" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="$(AbpVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.Domain\CompanyName.ProjectName.Domain.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,58 @@ |
|||||
|
using CompanyNameProjectName.Users; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.Users.EntityFrameworkCore; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
/* This is your actual DbContext used on runtime. |
||||
|
* It includes only your entities. |
||||
|
* It does not include entities of the used modules, because each module has already |
||||
|
* its own DbContext class. If you want to share some database tables with the used modules, |
||||
|
* just create a structure like done for AppUser. |
||||
|
* |
||||
|
* Don't use this DbContext for database migrations since it does not contain tables of the |
||||
|
* used modules (as explained above). See CompanyNameProjectNameMigrationsDbContext for migrations. |
||||
|
*/ |
||||
|
[ConnectionStringName("Default")] |
||||
|
public class CompanyNameProjectNameDbContext : AbpDbContext<CompanyNameProjectNameDbContext> |
||||
|
{ |
||||
|
public DbSet<AppUser> Users { get; set; } |
||||
|
|
||||
|
/* Add DbSet properties for your Aggregate Roots / Entities here. |
||||
|
* Also map them inside CompanyNameProjectNameDbContextModelCreatingExtensions.ConfigureCompanyNameProjectName |
||||
|
*/ |
||||
|
|
||||
|
public CompanyNameProjectNameDbContext(DbContextOptions<CompanyNameProjectNameDbContext> options) |
||||
|
: base(options) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder builder) |
||||
|
{ |
||||
|
base.OnModelCreating(builder); |
||||
|
|
||||
|
/* Configure the shared tables (with included modules) here */ |
||||
|
|
||||
|
builder.Entity<AppUser>(b => |
||||
|
{ |
||||
|
b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users"); //Sharing the same table "AbpUsers" with the IdentityUser
|
||||
|
|
||||
|
b.ConfigureByConvention(); |
||||
|
b.ConfigureAbpUser(); |
||||
|
|
||||
|
/* Configure mappings for your additional properties |
||||
|
* Also see the CompanyNameProjectNameEfCoreEntityExtensionMappings class |
||||
|
*/ |
||||
|
}); |
||||
|
|
||||
|
/* Configure your own tables/entities inside the ConfigureCompanyNameProjectName method */ |
||||
|
|
||||
|
builder.ConfigureCompanyNameProjectName(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureCompanyNameProjectName(this ModelBuilder builder) |
||||
|
{ |
||||
|
Check.NotNull(builder, nameof(builder)); |
||||
|
|
||||
|
/* Configure your own tables/entities inside here */ |
||||
|
|
||||
|
//builder.Entity<YourEntity>(b =>
|
||||
|
//{
|
||||
|
// b.ToTable(CompanyNameProjectNameConsts.DbTablePrefix + "YourEntities", CompanyNameProjectNameConsts.DbSchema);
|
||||
|
// b.ConfigureByConvention(); //auto configure for the base class props
|
||||
|
// //...
|
||||
|
//});
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.ObjectExtending; |
||||
|
using Volo.Abp.Threading; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
public static class CompanyNameProjectNameEfCoreEntityExtensionMappings |
||||
|
{ |
||||
|
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
||||
|
|
||||
|
public static void Configure() |
||||
|
{ |
||||
|
CompanyNameProjectNameGlobalFeatureConfigurator.Configure(); |
||||
|
CompanyNameProjectNameModuleExtensionConfigurator.Configure(); |
||||
|
|
||||
|
OneTimeRunner.Run(() => |
||||
|
{ |
||||
|
/* You can configure extra properties for the |
||||
|
* entities defined in the modules used by your application. |
||||
|
* |
||||
|
* This class can be used to map these extra properties to table fields in the database. |
||||
|
* |
||||
|
* USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. |
||||
|
* USE CompanyNameProjectNameModuleExtensionConfigurator CLASS (in the Domain.Shared project) |
||||
|
* FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES |
||||
|
* |
||||
|
* Example: Map a property to a table field: |
||||
|
|
||||
|
ObjectExtensionManager.Instance |
||||
|
.MapEfCoreProperty<IdentityUser, string>( |
||||
|
"MyProperty", |
||||
|
(entityBuilder, propertyBuilder) => |
||||
|
{ |
||||
|
propertyBuilder.HasMaxLength(128); |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
* See the documentation for more: |
||||
|
* https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
|
||||
|
*/ |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,54 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
||||
|
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
||||
|
using Volo.Abp.Dapper; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.MySQL; |
||||
|
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
||||
|
using Volo.Abp.Identity.EntityFrameworkCore; |
||||
|
using Volo.Abp.IdentityServer.EntityFrameworkCore; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
||||
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
||||
|
using Volo.Abp.TenantManagement.EntityFrameworkCore; |
||||
|
|
||||
|
namespace CompanyNameProjectName.EntityFrameworkCore |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(CompanyNameProjectNameDomainModule), |
||||
|
typeof(AbpIdentityEntityFrameworkCoreModule), |
||||
|
typeof(AbpIdentityServerEntityFrameworkCoreModule), |
||||
|
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
||||
|
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
||||
|
typeof(AbpEntityFrameworkCoreMySQLModule), |
||||
|
typeof(AbpBackgroundJobsEntityFrameworkCoreModule), |
||||
|
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
||||
|
typeof(AbpTenantManagementEntityFrameworkCoreModule), |
||||
|
typeof(AbpFeatureManagementEntityFrameworkCoreModule), |
||||
|
typeof(AbpDapperModule) |
||||
|
)] |
||||
|
public class CompanyNameProjectNameEntityFrameworkCoreModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
CompanyNameProjectNameEfCoreEntityExtensionMappings.Configure(); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddAbpDbContext<CompanyNameProjectNameDbContext>(options => |
||||
|
{ |
||||
|
/* Remove "includeAllEntities: true" to create |
||||
|
* default repositories only for aggregate roots */ |
||||
|
options.AddDefaultRepositories(includeAllEntities: true); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpDbContextOptions>(options => |
||||
|
{ |
||||
|
/* The main point to change your DBMS. |
||||
|
* See also CompanyNameProjectNameMigrationsDbContextFactory for EF Core tooling. */ |
||||
|
options.UseMySQL(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
using System.Runtime.CompilerServices; |
||||
|
[assembly:InternalsVisibleToAttribute("CompanyNameProjectName.EntityFrameworkCore.Tests")] |
||||
@ -0,0 +1,12 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Repository |
||||
|
{ |
||||
|
public interface IUserDapperRepository : ITransientDependency |
||||
|
{ |
||||
|
|
||||
|
Task<List<string>> GetAllUserNameListAsync(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
using CompanyNameProjectName.EntityFrameworkCore; |
||||
|
using Dapper; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories.Dapper; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace CompanyNameProjectName.Repository |
||||
|
{ |
||||
|
public class UserDapperRepository : DapperRepository<CompanyNameProjectNameDbContext>, IUserDapperRepository |
||||
|
{ |
||||
|
|
||||
|
public UserDapperRepository(IDbContextProvider<CompanyNameProjectNameDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public async Task<List<string>> GetAllUserNameListAsync() |
||||
|
{ |
||||
|
var connection = await GetDbConnectionAsync(); |
||||
|
return (await connection.QueryAsync<string>("select Name from AbpUsers")).ToList(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.1</TargetFramework> |
||||
|
<RootNamespace>CompanyNameProjectName</RootNamespace> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi.Client" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.TenantManagement.HttpApi.Client" Version="$(AbpVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.FeatureManagement.HttpApi.Client" Version="$(AbpVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\CompanyName.ProjectName.Application.Contracts\CompanyName.ProjectName.Application.Contracts.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue