Browse Source

moved EfCoreMigrationDemo sample from this repository

pull/3507/head
Akın Sabri Çam 6 years ago
parent
commit
9cf2c029d0
  1. 3
      docs/cs/AspNetCore/Widgets.md
  2. 2
      docs/en/Entity-Framework-Core-Migrations.md
  3. 2
      docs/zh-Hans/Entity-Framework-Core-Migrations.md
  4. 1
      samples/EfCoreMigrationDemo/.gitattributes
  5. 259
      samples/EfCoreMigrationDemo/.gitignore
  6. 144
      samples/EfCoreMigrationDemo/Acme.BookStore.sln
  7. 23
      samples/EfCoreMigrationDemo/Acme.BookStore.sln.DotSettings
  8. 7
      samples/EfCoreMigrationDemo/common.props
  9. 22
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj
  10. 22
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/BookStoreApplicationContractsModule.cs
  11. 22
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Permissions/BookStorePermissionDefinitionProvider.cs
  12. 10
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Permissions/BookStorePermissions.cs
  13. 12
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Roles/AppRoleDto.cs
  14. 14
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Roles/IAppRoleAppService.cs
  15. 23
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
  16. 18
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/BookStoreAppService.cs
  17. 14
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/BookStoreApplicationAutoMapperProfile.cs
  18. 30
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/BookStoreApplicationModule.cs
  19. 42
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/Roles/AppRoleAppService.cs
  20. 35
      samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj
  21. 22
      samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/BookStoreDbMigratorModule.cs
  22. 34
      samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs
  23. 38
      samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/Program.cs
  24. 21
      samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/appsettings.json
  25. 26
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj
  26. 7
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/BookStoreDomainErrorCodes.cs
  27. 45
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs
  28. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/cs.json
  29. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/en.json
  30. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/pl.json
  31. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/pt-BR.json
  32. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/tr.json
  33. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/vi.json
  34. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json
  35. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hant.json
  36. 10
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStoreResource.cs
  37. 11
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs
  38. 27
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
  39. 9
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/BookStoreConsts.cs
  40. 38
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/BookStoreDomainModule.cs
  41. 86
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Data/BookStoreDbMigrationService.cs
  42. 9
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Data/IBookStoreDbSchemaMigrator.cs
  43. 16
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Data/NullBookStoreDbSchemaMigrator.cs
  44. 223
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/IdentityServer/IdentityServerDataSeedContributor.cs
  45. 23
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Roles/AppRole.cs
  46. 34
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Roles/IdentityRoleExtendingService.cs
  47. 13
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Settings/BookStoreSettingDefinitionProvider.cs
  48. 10
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Settings/BookStoreSettings.cs
  49. 53
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Users/AppUser.cs
  50. 18
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj
  51. 16
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreEntityFrameworkCoreDbMigrationsModule.cs
  52. 55
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs
  53. 32
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs
  54. 35
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreBookStoreDbSchemaMigrator.cs
  55. 1761
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.Designer.cs
  56. 1074
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.cs
  57. 1765
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200227114730_Added_Title_To_Roles.Designer.cs
  58. 23
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200227114730_Added_Title_To_Roles.cs
  59. 1429
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200228132856_Removed_Audit_Setting_Permission_Modules.Designer.cs
  60. 212
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200228132856_Removed_Audit_Setting_Permission_Modules.cs
  61. 1427
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs
  62. 18
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb.csproj
  63. 17
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/BookStoreEntityFrameworkCoreSecondDbMigrationsModule.cs
  64. 30
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/BookStoreSecondMigrationsDbContext.cs
  65. 32
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/BookStoreSecondMigrationsDbContextFactory.cs
  66. 35
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/EntityFrameworkCoreBookStoreSecondDbSchemaMigrator.cs
  67. 362
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Migrations/20200228120435_Initial.Designer.cs
  68. 212
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Migrations/20200228120435_Initial.cs
  69. 360
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Migrations/BookStoreSecondMigrationsDbContextModelSnapshot.cs
  70. 23
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
  71. 67
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs
  72. 39
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContextModelCreatingExtensions.cs
  73. 47
      samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs
  74. 22
      samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj
  75. 31
      samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi.Client/BookStoreHttpApiClientModule.cs
  76. 22
      samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj
  77. 22
      samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/BookStoreHttpApiModule.cs
  78. 15
      samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Controllers/BookStoreController.cs
  79. 28
      samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Controllers/TestController.cs
  80. 11
      samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Models/Test/TestModel.cs
  81. 58
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj
  82. 11
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/BookStoreBrandingProvider.cs
  83. 12
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/BookStoreWebAutoMapperProfile.cs
  84. 215
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/BookStoreWebModule.cs
  85. 34
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Menus/BookStoreMenuContributor.cs
  86. 16
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/BookStorePage.cs
  87. 15
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/BookStorePageModel.cs
  88. 27
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.cshtml
  89. 10
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.cshtml.cs
  90. 3
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.css
  91. 3
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.js
  92. 4
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/_ViewImports.cshtml
  93. 50
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Program.cs
  94. 27
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Properties/launchSettings.json
  95. 18
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Startup.cs
  96. 4
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Views/_ViewImports.cshtml
  97. 8
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/abp.resourcemapping.js
  98. 2
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/appsettings.Development.json
  99. 21
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/appsettings.json
  100. 9
      samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/gulpfile.js

3
docs/cs/AspNetCore/Widgets.md

@ -502,4 +502,5 @@ Configure<AbpWidgetOptions>(options =>
## Podívejte se také na
* [Příklad projektu (zdrojový kód)](https://github.com/abpframework/abp-samples/tree/master/DashboardDemo).
* [Příklad projektu (zdrojový kód)](https://github.com/abpframework/abp-samples/tree/master/DashboardDemo).

2
docs/en/Entity-Framework-Core-Migrations.md

@ -6,7 +6,7 @@ This document begins by **introducing the default structure** provided by [the a
### Source Code
You can find the source code of the example project referenced by this document [here](https://github.com/abpframework/abp/tree/dev/samples/EfCoreMigrationDemo). However, you need to read and understand this document in order to understand the example project's source code.
You can find the source code of the example project referenced by this document [here](https://github.com/abpframework/abp-samples/tree/master/EfCoreMigrationDemo). However, you need to read and understand this document in order to understand the example project's source code.
## About the EF Core Code First Migrations

2
docs/zh-Hans/Entity-Framework-Core-Migrations.md

@ -7,7 +7,7 @@
### 源码
你可以在[这里](https://github.com/abpframework/abp/tree/dev/samples/EfCoreMigrationDemo)找到本文引用的示例项目的源代码; 但是为了理解示例项目的源代码,你需要阅读和理解这个文档.
你可以在[这里](https://github.com/abpframework/abp-samples/tree/master/EfCoreMigrationDemo)找到本文引用的示例项目的源代码; 但是为了理解示例项目的源代码,你需要阅读和理解这个文档.
## 关于EF Core 代码优先迁移

1
samples/EfCoreMigrationDemo/.gitattributes

@ -1 +0,0 @@
**/wwwroot/libs/** linguist-vendored

259
samples/EfCoreMigrationDemo/.gitignore

@ -1,259 +0,0 @@
## 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
# BookStore
src/Acme.BookStore.Web/Logs/*
src/Acme.BookStore.Web.Host/Logs/*
src/Acme.BookStore.IdentityServer/Logs/*
src/Acme.BookStore.HttpApi.Host/Logs/*
src/Acme.BookStore.HttpApi.HostWithIds/Logs/*

144
samples/EfCoreMigrationDemo/Acme.BookStore.sln

@ -1,144 +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}") = "Acme.BookStore.Domain", "src\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Application", "src\Acme.BookStore.Application\Acme.BookStore.Application.csproj", "{1A94A50E-06DC-43C1-80B5-B662820EC3EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.EntityFrameworkCore", "src\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj", "{C956DD76-69C8-4A9C-83EA-D17DF83340FD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Web", "src\Acme.BookStore.Web\Acme.BookStore.Web.csproj", "{068855E8-9240-4F1A-910B-CF825794513B}"
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}") = "Acme.BookStore.Application.Tests", "test\Acme.BookStore.Application.Tests\Acme.BookStore.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Web.Tests", "test\Acme.BookStore.Web.Tests\Acme.BookStore.Web.Tests.csproj", "{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.EntityFrameworkCore.DbMigrations", "src\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj", "{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Domain.Shared", "src\Acme.BookStore.Domain.Shared\Acme.BookStore.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Application.Contracts", "src\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.HttpApi", "src\Acme.BookStore.HttpApi\Acme.BookStore.HttpApi.csproj", "{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.HttpApi.Client", "src\Acme.BookStore.HttpApi.Client\Acme.BookStore.HttpApi.Client.csproj", "{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.EntityFrameworkCore.Tests", "test\Acme.BookStore.EntityFrameworkCore.Tests\Acme.BookStore.EntityFrameworkCore.Tests.csproj", "{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.TestBase", "test\Acme.BookStore.TestBase\Acme.BookStore.TestBase.csproj", "{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Domain.Tests", "test\Acme.BookStore.Domain.Tests\Acme.BookStore.Domain.Tests.csproj", "{E512F4D9-9375-480F-A2F6-A46509F9D824}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.HttpApi.Client.ConsoleTestApp", "test\Acme.BookStore.HttpApi.Client.ConsoleTestApp\Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj", "{EF480016-9127-4916-8735-D2466BDBC582}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.DbMigrator", "src\Acme.BookStore.DbMigrator\Acme.BookStore.DbMigrator.csproj", "{AA94D832-1CCC-4715-95A9-A483F23A1A5D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb", "src\Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb\Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb.csproj", "{9F050D17-3D9E-4A0F-B8F9-D90460ABDC76}"
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
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{068855E8-9240-4F1A-910B-CF825794513B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{068855E8-9240-4F1A-910B-CF825794513B}.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
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.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
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF480016-9127-4916-8735-D2466BDBC582}.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
{9F050D17-3D9E-4A0F-B8F9-D90460ABDC76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F050D17-3D9E-4A0F-B8F9-D90460ABDC76}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F050D17-3D9E-4A0F-B8F9-D90460ABDC76}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F050D17-3D9E-4A0F-B8F9-D90460ABDC76}.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}
{068855E8-9240-4F1A-910B-CF825794513B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674} = {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}
{EF480016-9127-4916-8735-D2466BDBC582} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{AA94D832-1CCC-4715-95A9-A483F23A1A5D} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{9F050D17-3D9E-4A0F-B8F9-D90460ABDC76} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
EndGlobalSection
EndGlobal

23
samples/EfCoreMigrationDemo/Acme.BookStore.sln.DotSettings

@ -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>

7
samples/EfCoreMigrationDemo/common.props

@ -1,7 +0,0 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>1.0.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
</Project>

22
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj

@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain.Shared\Acme.BookStore.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Account.Application.Contracts" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application.Contracts" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.Application.Contracts" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.Application.Contracts" Version="2.1.1" />
</ItemGroup>
</Project>

22
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/BookStoreApplicationContractsModule.cs

@ -1,22 +0,0 @@
using Volo.Abp.Account;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.TenantManagement;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreDomainSharedModule),
typeof(AbpAccountApplicationContractsModule),
typeof(AbpFeatureManagementApplicationContractsModule),
typeof(AbpIdentityApplicationContractsModule),
typeof(AbpPermissionManagementApplicationContractsModule),
typeof(AbpTenantManagementApplicationContractsModule)
)]
public class BookStoreApplicationContractsModule : AbpModule
{
}
}

22
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Permissions/BookStorePermissionDefinitionProvider.cs

@ -1,22 +0,0 @@
using Acme.BookStore.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
namespace Acme.BookStore.Permissions
{
public class BookStorePermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var myGroup = context.AddGroup(BookStorePermissions.GroupName);
//Define your own permissions here. Example:
//myGroup.AddPermission(BookStorePermissions.MyPermission1, L("Permission:MyPermission1"));
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<BookStoreResource>(name);
}
}
}

10
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Permissions/BookStorePermissions.cs

@ -1,10 +0,0 @@
namespace Acme.BookStore.Permissions
{
public static class BookStorePermissions
{
public const string GroupName = "BookStore";
//Add your own permission names. Example:
//public const string MyPermission1 = GroupName + ".MyPermission1";
}
}

12
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Roles/AppRoleDto.cs

@ -1,12 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
namespace Acme.BookStore.Roles
{
public class AppRoleDto : EntityDto<Guid>
{
public string Name { get; set; }
public string Title { get; set; }
}
}

14
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application.Contracts/Roles/IAppRoleAppService.cs

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Acme.BookStore.Roles
{
public interface IAppRoleAppService : IApplicationService
{
Task<List<AppRoleDto>> GetListAsync();
Task UpdateTitleAsync(Guid id, string title);
}
}

23
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj

@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Account.Application" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="2.1.1" />
</ItemGroup>
</Project>

18
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/BookStoreAppService.cs

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using Acme.BookStore.Localization;
using Volo.Abp.Application.Services;
namespace Acme.BookStore
{
/* Inherit your application services from this class.
*/
public abstract class BookStoreAppService : ApplicationService
{
protected BookStoreAppService()
{
LocalizationResource = typeof(BookStoreResource);
}
}
}

14
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/BookStoreApplicationAutoMapperProfile.cs

@ -1,14 +0,0 @@
using AutoMapper;
namespace Acme.BookStore
{
public class BookStoreApplicationAutoMapperProfile : Profile
{
public BookStoreApplicationAutoMapperProfile()
{
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
}
}
}

30
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/BookStoreApplicationModule.cs

@ -1,30 +0,0 @@
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 Acme.BookStore
{
[DependsOn(
typeof(BookStoreDomainModule),
typeof(AbpAccountApplicationModule),
typeof(BookStoreApplicationContractsModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpTenantManagementApplicationModule),
typeof(AbpFeatureManagementApplicationModule)
)]
public class BookStoreApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<BookStoreApplicationModule>();
});
}
}
}

42
samples/EfCoreMigrationDemo/src/Acme.BookStore.Application/Roles/AppRoleAppService.cs

@ -1,42 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace Acme.BookStore.Roles
{
public class AppRoleAppService : ApplicationService, IAppRoleAppService
{
private readonly IRepository<AppRole, Guid> _appRoleRepository;
public AppRoleAppService(IRepository<AppRole, Guid> appRoleRepository)
{
_appRoleRepository = appRoleRepository;
}
public async Task<List<AppRoleDto>> GetListAsync()
{
var roles = await _appRoleRepository.GetListAsync();
return roles
.Select(r => new AppRoleDto
{
Id = r.Id,
Name = r.Name,
Title = r.Title
})
.ToList();
}
public async Task UpdateTitleAsync(Guid id, string title)
{
var role = await _appRoleRepository.GetAsync(id);
role.Title = title;
await _appRoleRepository.UpdateAsync(role);
}
}
}

35
samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj

@ -1,35 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Autofac" Version="2.1.1" />
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb\Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup>
</Project>

22
samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/BookStoreDbMigratorModule.cs

@ -1,22 +0,0 @@
using Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore;
using Acme.BookStore.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Modularity;
namespace Acme.BookStore.DbMigrator
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(BookStoreEntityFrameworkCoreDbMigrationsModule),
typeof(BookStoreEntityFrameworkCoreSecondDbMigrationsModule),
typeof(BookStoreApplicationContractsModule)
)]
public class BookStoreDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
}
}
}

34
samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs

@ -1,34 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Acme.BookStore.Data;
using Serilog;
using Volo.Abp;
namespace Acme.BookStore.DbMigrator
{
public class DbMigratorHostedService : IHostedService
{
public async Task StartAsync(CancellationToken cancellationToken)
{
using (var application = AbpApplicationFactory.Create<BookStoreDbMigratorModule>(options =>
{
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
}))
{
application.Initialize();
await application
.ServiceProvider
.GetRequiredService<BookStoreDbMigrationService>()
.MigrateAsync();
application.Shutdown();
}
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
}

38
samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/Program.cs

@ -1,38 +0,0 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
namespace Acme.BookStore.DbMigrator
{
class Program
{
static async Task Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning)
#if DEBUG
.MinimumLevel.Override("Acme.BookStore", LogEventLevel.Debug)
#else
.MinimumLevel.Override("Acme.BookStore", LogEventLevel.Information)
#endif
.Enrich.FromLogContext()
.WriteTo.File(Path.Combine(Directory.GetCurrentDirectory(), "Logs/logs.txt"))
.WriteTo.Console()
.CreateLogger();
await CreateHostBuilder(args).RunConsoleAsync();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<DbMigratorHostedService>();
});
}
}

21
samples/EfCoreMigrationDemo/src/Acme.BookStore.DbMigrator/appsettings.json

@ -1,21 +0,0 @@
{
"ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true",
"AbpPermissionManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true",
"AbpSettingManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true",
"AbpAuditLogging": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"IdentityServer": {
"Clients": {
"BookStore_Web": {
"ClientId": "BookStore_Web",
"ClientSecret": "1q2w3e*",
"RootUrl": "https://localhost:44312"
},
"BookStore_App": {
"ClientId": "BookStore_App",
"ClientSecret": "1q2w3e*"
}
}
}
}

26
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj

@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Identity.Domain.Shared" Version="2.1.1" />
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="2.1.1" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="2.1.1" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain.Shared" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.Domain.Shared" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.Domain.Shared" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Shared" Version="2.1.1" />
<PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\BookStore\*.json" />
<Content Remove="Localization\BookStore\*.json" />
</ItemGroup>
</Project>

7
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/BookStoreDomainErrorCodes.cs

@ -1,7 +0,0 @@
namespace Acme.BookStore
{
public static class BookStoreDomainErrorCodes
{
/* You can add your business exception error codes here, as constants */
}
}

45
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs

@ -1,45 +0,0 @@
using Acme.BookStore.Localization;
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.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
using Volo.Abp.TenantManagement;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
namespace Acme.BookStore
{
[DependsOn(
typeof(AbpAuditLoggingDomainSharedModule),
typeof(AbpBackgroundJobsDomainSharedModule),
typeof(AbpFeatureManagementDomainSharedModule),
typeof(AbpIdentityDomainSharedModule),
typeof(AbpIdentityServerDomainSharedModule),
typeof(AbpPermissionManagementDomainSharedModule),
typeof(AbpSettingManagementDomainSharedModule),
typeof(AbpTenantManagementDomainSharedModule)
)]
public class BookStoreDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<BookStoreDomainSharedModule>("Acme.BookStore");
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<BookStoreResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/BookStore");
});
}
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/cs.json

@ -1,8 +0,0 @@
{
"culture": "cs",
"texts": {
"Menu:Home": "Úvod",
"Welcome": "Vítejte",
"LongWelcomeMessage": "Vítejte v aplikaci. Toto je startovací projekt založený na ABP frameworku. Pro více informací, navštivte abp.io."
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/en.json

@ -1,8 +0,0 @@
{
"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."
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/pl.json

@ -1,8 +0,0 @@
{
"culture": "pl",
"texts": {
"Menu:Home": "Home",
"Welcome": "Witaj",
"LongWelcomeMessage": "Witaj w aplikacji. To jest inicjalny projekt bazujący na ABP framework. Po więcej informacji odwiedź stronę abp.io."
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/pt-BR.json

@ -1,8 +0,0 @@
{
"culture": "pt-BR",
"texts": {
"Menu:Home": "Principal",
"Welcome": "Seja bem-vindo!",
"LongWelcomeMessage": "Bem-vindo a esta aplicação. Este é um projeto inicial baseado no ABP framework. Para mais informações, visite abp.io."
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/tr.json

@ -1,8 +0,0 @@
{
"culture": "tr",
"texts": {
"Menu:Home": "Ana sayfa",
"Welcome": "Hoşgeldiniz",
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz."
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/vi.json

@ -1,8 +0,0 @@
{
"culture": "vi",
"texts": {
"Menu:Home": "Trang chủ",
"Welcome": "Chào mừng bạn",
"LongWelcomeMessage": "Chào mừng bạn đến ứng dụng. Đây là một dự án khởi nghiệp dựa trên khung ABP. Để biết thêm thông tin, hãy truy cập abp.io."
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json

@ -1,8 +0,0 @@
{
"culture": "zh-Hans",
"texts": {
"Menu:Home": "首页",
"Welcome": "欢迎",
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io."
}
}

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hant.json

@ -1,8 +0,0 @@
{
"culture": "zh-Hant",
"texts": {
"Menu:Home": "首頁",
"Welcome": "歡迎",
"LongWelcomeMessage": "歡迎來到此應用程式. 這是一個基於ABP框架的起始專案. 有關更多訊息, 請瀏覽 abp.io."
}
}

10
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/Localization/BookStoreResource.cs

@ -1,10 +0,0 @@
using Volo.Abp.Localization;
namespace Acme.BookStore.Localization
{
[LocalizationResourceName("BookStore")]
public class BookStoreResource
{
}
}

11
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs

@ -1,11 +0,0 @@
namespace Acme.BookStore.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 = true;
}
}

27
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj

@ -1,27 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain.Shared\Acme.BookStore.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
<PackageReference Include="Volo.Abp.Identity.Domain" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="2.1.1" />
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="2.1.1" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="2.1.1" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.Domain" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="2.1.1" />
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="2.1.1" />
</ItemGroup>
</Project>

9
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/BookStoreConsts.cs

@ -1,9 +0,0 @@
namespace Acme.BookStore
{
public static class BookStoreConsts
{
public const string DbTablePrefix = "App";
public const string DbSchema = null;
}
}

38
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/BookStoreDomainModule.cs

@ -1,38 +0,0 @@
using Acme.BookStore.MultiTenancy;
using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs;
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;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreDomainSharedModule),
typeof(AbpAuditLoggingDomainModule),
typeof(AbpBackgroundJobsDomainModule),
typeof(AbpFeatureManagementDomainModule),
typeof(AbpIdentityDomainModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpIdentityServerDomainModule),
typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(AbpSettingManagementDomainModule),
typeof(AbpTenantManagementDomainModule)
)]
public class BookStoreDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
}
}
}

86
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Data/BookStoreDbMigrationService.cs

@ -1,86 +0,0 @@
using System.Collections.Generic;
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 Acme.BookStore.Data
{
public class BookStoreDbMigrationService : ITransientDependency
{
public ILogger<BookStoreDbMigrationService> Logger { get; set; }
private readonly IDataSeeder _dataSeeder;
private readonly IEnumerable<IBookStoreDbSchemaMigrator> _dbSchemaMigrators;
private readonly ITenantRepository _tenantRepository;
private readonly ICurrentTenant _currentTenant;
public BookStoreDbMigrationService(
IDataSeeder dataSeeder,
IEnumerable<IBookStoreDbSchemaMigrator> dbSchemaMigrators,
ITenantRepository tenantRepository,
ICurrentTenant currentTenant)
{
_dataSeeder = dataSeeder;
_dbSchemaMigrators = dbSchemaMigrators;
_tenantRepository = tenantRepository;
_currentTenant = currentTenant;
Logger = NullLogger<BookStoreDbMigrationService>.Instance;
}
public async Task MigrateAsync()
{
Logger.LogInformation("Started database migrations...");
await MigrateHostDatabaseAsync();
var i = 0;
var tenants = await _tenantRepository.GetListAsync();
foreach (var tenant in tenants)
{
i++;
using (_currentTenant.Change(tenant.Id))
{
Logger.LogInformation($"Migrating {tenant.Name} database schema... ({i} of {tenants.Count})");
await MigrateTenantDatabasesAsync(tenant);
Logger.LogInformation($"Successfully completed {tenant.Name} database migrations.");
}
}
Logger.LogInformation("Successfully completed database migrations.");
}
private async Task MigrateHostDatabaseAsync()
{
Logger.LogInformation("Migrating host database schema...");
foreach (var migrator in _dbSchemaMigrators)
{
await migrator.MigrateAsync();
}
Logger.LogInformation("Executing host database seed...");
await _dataSeeder.SeedAsync();
Logger.LogInformation("Successfully completed host database migrations.");
}
private async Task MigrateTenantDatabasesAsync(Tenant tenant)
{
Logger.LogInformation($"Migrating schema for {tenant.Name} database...");
foreach (var migrator in _dbSchemaMigrators)
{
await migrator.MigrateAsync();
}
Logger.LogInformation($"Executing {tenant.Name} tenant database seed...");
await _dataSeeder.SeedAsync(tenant.Id);
}
}
}

9
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Data/IBookStoreDbSchemaMigrator.cs

@ -1,9 +0,0 @@
using System.Threading.Tasks;
namespace Acme.BookStore.Data
{
public interface IBookStoreDbSchemaMigrator
{
Task MigrateAsync();
}
}

16
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Data/NullBookStoreDbSchemaMigrator.cs

@ -1,16 +0,0 @@
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.Data
{
/* This is used if database provider does't define
* IBookStoreDbSchemaMigrator implementation.
*/
public class NullBookStoreDbSchemaMigrator : IBookStoreDbSchemaMigrator, ITransientDependency
{
public Task MigrateAsync()
{
return Task.CompletedTask;
}
}
}

223
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/IdentityServer/IdentityServerDataSeedContributor.cs

@ -1,223 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using IdentityServer4.Models;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.IdentityResources;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow;
using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource;
using Client = Volo.Abp.IdentityServer.Clients.Client;
namespace Acme.BookStore.IdentityServer
{
public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransientDependency
{
private readonly IApiResourceRepository _apiResourceRepository;
private readonly IClientRepository _clientRepository;
private readonly IIdentityResourceDataSeeder _identityResourceDataSeeder;
private readonly IGuidGenerator _guidGenerator;
private readonly IPermissionDataSeeder _permissionDataSeeder;
private readonly IConfiguration _configuration;
public IdentityServerDataSeedContributor(
IClientRepository clientRepository,
IApiResourceRepository apiResourceRepository,
IIdentityResourceDataSeeder identityResourceDataSeeder,
IGuidGenerator guidGenerator,
IPermissionDataSeeder permissionDataSeeder,
IConfiguration configuration)
{
_clientRepository = clientRepository;
_apiResourceRepository = apiResourceRepository;
_identityResourceDataSeeder = identityResourceDataSeeder;
_guidGenerator = guidGenerator;
_permissionDataSeeder = permissionDataSeeder;
_configuration = configuration;
}
[UnitOfWork]
public virtual async Task SeedAsync(DataSeedContext context)
{
await _identityResourceDataSeeder.CreateStandardResourcesAsync();
await CreateApiResourcesAsync();
await CreateClientsAsync();
}
private async Task CreateApiResourcesAsync()
{
var commonApiUserClaims = new[]
{
"email",
"email_verified",
"name",
"phone_number",
"phone_number_verified",
"role"
};
await CreateApiResourceAsync("BookStore", commonApiUserClaims);
}
private async Task<ApiResource> CreateApiResourceAsync(string name, IEnumerable<string> claims)
{
var apiResource = await _apiResourceRepository.FindByNameAsync(name);
if (apiResource == null)
{
apiResource = await _apiResourceRepository.InsertAsync(
new ApiResource(
_guidGenerator.Create(),
name,
name + " API"
),
autoSave: true
);
}
foreach (var claim in claims)
{
if (apiResource.FindClaim(claim) == null)
{
apiResource.AddUserClaim(claim);
}
}
return await _apiResourceRepository.UpdateAsync(apiResource);
}
private async Task CreateClientsAsync()
{
var commonScopes = new[]
{
"email",
"openid",
"profile",
"role",
"phone",
"address",
"BookStore"
};
var configurationSection = _configuration.GetSection("IdentityServer:Clients");
//Web Client
var webClientId = configurationSection["BookStore_Web:ClientId"];
if (!webClientId.IsNullOrWhiteSpace())
{
var webClientRootUrl = configurationSection["BookStore_Web:RootUrl"].EnsureEndsWith('/');
/* BookStore_Web client is only needed if you created a tiered
* solution. Otherwise, you can delete this client. */
await CreateClientAsync(
webClientId,
commonScopes,
new[] { "hybrid" },
(configurationSection["BookStore_Web:ClientSecret"] ?? "1q2w3e*").Sha256(),
redirectUri: $"{webClientRootUrl}signin-oidc",
postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc"
);
}
//Console Test Client
var consoleClientId = configurationSection["BookStore_App:ClientId"];
if (!consoleClientId.IsNullOrWhiteSpace())
{
await CreateClientAsync(
consoleClientId,
commonScopes,
new[] { "password", "client_credentials" },
(configurationSection["BookStore_App:ClientSecret"] ?? "1q2w3e*").Sha256()
);
}
}
private async Task<Client> CreateClientAsync(
string name,
IEnumerable<string> scopes,
IEnumerable<string> grantTypes,
string secret,
string redirectUri = null,
string postLogoutRedirectUri = null,
IEnumerable<string> permissions = null)
{
var client = await _clientRepository.FindByCliendIdAsync(name);
if (client == null)
{
client = await _clientRepository.InsertAsync(
new Client(
_guidGenerator.Create(),
name
)
{
ClientName = name,
ProtocolType = "oidc",
Description = name,
AlwaysIncludeUserClaimsInIdToken = true,
AllowOfflineAccess = true,
AbsoluteRefreshTokenLifetime = 31536000, //365 days
AccessTokenLifetime = 31536000, //365 days
AuthorizationCodeLifetime = 300,
IdentityTokenLifetime = 300,
RequireConsent = false
},
autoSave: true
);
}
foreach (var scope in scopes)
{
if (client.FindScope(scope) == null)
{
client.AddScope(scope);
}
}
foreach (var grantType in grantTypes)
{
if (client.FindGrantType(grantType) == null)
{
client.AddGrantType(grantType);
}
}
if (client.FindSecret(secret) == null)
{
client.AddSecret(secret);
}
if (redirectUri != null)
{
if (client.FindRedirectUri(redirectUri) == null)
{
client.AddRedirectUri(redirectUri);
}
}
if (postLogoutRedirectUri != null)
{
if (client.FindPostLogoutRedirectUri(postLogoutRedirectUri) == null)
{
client.AddPostLogoutRedirectUri(postLogoutRedirectUri);
}
}
if (permissions != null)
{
await _permissionDataSeeder.SeedAsync(
ClientPermissionValueProvider.ProviderName,
name,
permissions
);
}
return await _clientRepository.UpdateAsync(client);
}
}
}

23
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Roles/AppRole.cs

@ -1,23 +0,0 @@
using System;
using Volo.Abp.Domain.Entities;
using Volo.Abp.MultiTenancy;
namespace Acme.BookStore.Roles
{
public class AppRole : AggregateRoot<Guid>, IMultiTenant
{
// Properties shared with the IdentityRole class
public Guid? TenantId { get; private set; }
public string Name { get; private set; }
//Additional properties
public string Title { get; set; }
private AppRole()
{
}
}
}

34
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Roles/IdentityRoleExtendingService.cs

@ -1,34 +0,0 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
namespace Acme.BookStore.Roles
{
public class IdentityRoleExtendingService : ITransientDependency
{
private readonly IIdentityRoleRepository _identityRoleRepository;
public IdentityRoleExtendingService(IIdentityRoleRepository identityRoleRepository)
{
_identityRoleRepository = identityRoleRepository;
}
public async Task<string> GetTitleAsync(Guid id)
{
var role = await _identityRoleRepository.GetAsync(id);
return role.GetProperty<string>("Title");
}
public async Task SetTitleAsync(Guid id, string newTitle)
{
var role = await _identityRoleRepository.GetAsync(id);
role.SetProperty("Title", newTitle);
await _identityRoleRepository.UpdateAsync(role);
}
}
}

13
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Settings/BookStoreSettingDefinitionProvider.cs

@ -1,13 +0,0 @@
using Volo.Abp.Settings;
namespace Acme.BookStore.Settings
{
public class BookStoreSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
//Define your own settings here. Example:
//context.Add(new SettingDefinition(BookStoreSettings.MySetting1));
}
}
}

10
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Settings/BookStoreSettings.cs

@ -1,10 +0,0 @@
namespace Acme.BookStore.Settings
{
public static class BookStoreSettings
{
private const string Prefix = "BookStore";
//Add your own setting names here. Example:
//public const string MySetting1 = Prefix + ".MySetting1";
}
}

53
samples/EfCoreMigrationDemo/src/Acme.BookStore.Domain/Users/AppUser.cs

@ -1,53 +0,0 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Users;
namespace Acme.BookStore.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 virtual string MyProperty { get; set; }
*/
private AppUser()
{
}
}
}

18
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2" />
</ItemGroup>
</Project>

16
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreEntityFrameworkCoreDbMigrationsModule.cs

@ -1,16 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace Acme.BookStore.EntityFrameworkCore
{
[DependsOn(
typeof(BookStoreEntityFrameworkCoreModule)
)]
public class BookStoreEntityFrameworkCoreDbMigrationsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<BookStoreMigrationsDbContext>();
}
}
}

55
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs

@ -1,55 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace Acme.BookStore.EntityFrameworkCore
{
/* This DbContext is only used for database migrations.
* It is not used on runtime. See BookStoreDbContext for the runtime DbContext.
* It is a unified model that includes configuration for
* all used modules and your application.
*/
public class BookStoreMigrationsDbContext : AbpDbContext<BookStoreMigrationsDbContext>
{
public BookStoreMigrationsDbContext(DbContextOptions<BookStoreMigrationsDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
builder.ConfigureBackgroundJobs();
builder.ConfigureIdentity();
builder.ConfigureIdentityServer();
builder.ConfigureFeatureManagement();
builder.ConfigureTenantManagement();
/* Configure customizations for entities from the modules included */
//CONFIGURE THE CUSTOM ROLE PROPERTIES
builder.Entity<IdentityRole>(b =>
{
b.ConfigureCustomRoleProperties();
});
builder.Entity<IdentityUser>(b =>
{
b.ConfigureCustomUserProperties();
});
/* Configure your own tables/entities inside the ConfigureBookStore method */
builder.ConfigureBookStore();
}
}
}

32
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs

@ -1,32 +0,0 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace Acme.BookStore.EntityFrameworkCore
{
/* This class is needed for EF Core console commands
* (like Add-Migration and Update-Database commands) */
public class BookStoreMigrationsDbContextFactory : IDesignTimeDbContextFactory<BookStoreMigrationsDbContext>
{
public BookStoreMigrationsDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<BookStoreMigrationsDbContext>()
.UseSqlServer(configuration.GetConnectionString("Default"));
return new BookStoreMigrationsDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();
}
}
}

35
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreBookStoreDbSchemaMigrator.cs

@ -1,35 +0,0 @@
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Acme.BookStore.Data;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.EntityFrameworkCore
{
public class EntityFrameworkCoreBookStoreDbSchemaMigrator
: IBookStoreDbSchemaMigrator, ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public EntityFrameworkCoreBookStoreDbSchemaMigrator(
IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public async Task MigrateAsync()
{
/* We intentionally resolving the BookStoreMigrationsDbContext
* from IServiceProvider (instead of directly injecting it)
* to properly get the connection string of the current tenant in the
* current scope.
*/
await _serviceProvider
.GetRequiredService<BookStoreMigrationsDbContext>()
.Database
.MigrateAsync();
}
}
}

1761
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.Designer.cs

File diff suppressed because it is too large

1074
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.cs

File diff suppressed because it is too large

1765
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200227114730_Added_Title_To_Roles.Designer.cs

File diff suppressed because it is too large

23
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200227114730_Added_Title_To_Roles.cs

@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Acme.BookStore.Migrations
{
public partial class Added_Title_To_Roles : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Title",
table: "AbpRoles",
maxLength: 128,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Title",
table: "AbpRoles");
}
}
}

1429
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200228132856_Removed_Audit_Setting_Permission_Modules.Designer.cs

File diff suppressed because it is too large

212
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200228132856_Removed_Audit_Setting_Permission_Modules.cs

@ -1,212 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Acme.BookStore.Migrations
{
public partial class Removed_Audit_Setting_Permission_Modules : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpAuditLogActions");
migrationBuilder.DropTable(
name: "AbpEntityPropertyChanges");
migrationBuilder.DropTable(
name: "AbpPermissionGrants");
migrationBuilder.DropTable(
name: "AbpSettings");
migrationBuilder.DropTable(
name: "AbpEntityChanges");
migrationBuilder.DropTable(
name: "AbpAuditLogs");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpAuditLogs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ApplicationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
ClientId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ClientName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
Comments = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
CorrelationId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Exceptions = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true),
ExecutionDuration = table.Column<int>(type: "int", nullable: false),
ExecutionTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
HttpMethod = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
HttpStatusCode = table.Column<int>(type: "int", nullable: true),
ImpersonatorTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ImpersonatorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Url = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpAuditLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissionGrants",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ProviderName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSettings",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProviderName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Value = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpAuditLogActions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AuditLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExecutionDuration = table.Column<int>(type: "int", nullable: false),
ExecutionTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
MethodName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
Parameters = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
ServiceName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", 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: "uniqueidentifier", nullable: false),
AuditLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ChangeTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ChangeType = table.Column<byte>(type: "tinyint", nullable: false),
EntityId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
EntityTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityTypeFullName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", 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: "AbpEntityPropertyChanges",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EntityChangeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NewValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
OriginalValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
PropertyName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
PropertyTypeFullName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
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_ExecutionTime",
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_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_AbpPermissionGrants_Name_ProviderName_ProviderKey",
table: "AbpPermissionGrants",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpSettings_Name_ProviderName_ProviderKey",
table: "AbpSettings",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
}
}
}

1427
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs

File diff suppressed because it is too large

18
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb.csproj

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore.DbMigrationsForSecondDb</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2" />
</ItemGroup>
</Project>

17
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/BookStoreEntityFrameworkCoreSecondDbMigrationsModule.cs

@ -1,17 +0,0 @@
using Acme.BookStore.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore
{
[DependsOn(
typeof(BookStoreEntityFrameworkCoreModule)
)]
public class BookStoreEntityFrameworkCoreSecondDbMigrationsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<BookStoreSecondMigrationsDbContext>();
}
}
}

30
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/BookStoreSecondMigrationsDbContext.cs

@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
namespace Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore
{
[ConnectionStringName("AbpPermissionManagement")]
public class BookStoreSecondMigrationsDbContext : AbpDbContext<BookStoreSecondMigrationsDbContext>
{
public BookStoreSecondMigrationsDbContext(
DbContextOptions<BookStoreSecondMigrationsDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureAuditLogging();
}
}
}

32
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/BookStoreSecondMigrationsDbContextFactory.cs

@ -1,32 +0,0 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore
{
/* This class is needed for EF Core console commands
* (like Add-Migration and Update-Database commands) */
public class BookStoreSecondMigrationsDbContextFactory
: IDesignTimeDbContextFactory<BookStoreSecondMigrationsDbContext>
{
public BookStoreSecondMigrationsDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<BookStoreSecondMigrationsDbContext>()
.UseSqlServer(configuration.GetConnectionString("AbpPermissionManagement"));
return new BookStoreSecondMigrationsDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();
}
}
}

35
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/EntityFrameworkCore/EntityFrameworkCoreBookStoreSecondDbSchemaMigrator.cs

@ -1,35 +0,0 @@
using System;
using System.Threading.Tasks;
using Acme.BookStore.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore
{
public class EntityFrameworkCoreSecondBookStoreDbSchemaMigrator
: IBookStoreDbSchemaMigrator, ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public EntityFrameworkCoreSecondBookStoreDbSchemaMigrator(
IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public async Task MigrateAsync()
{
/* We intentionally resolving the BookStoreSecondMigrationsDbContext
* from IServiceProvider (instead of directly injecting it)
* to properly get the connection string of the current tenant in the
* current scope.
*/
await _serviceProvider
.GetRequiredService<BookStoreSecondMigrationsDbContext>()
.Database
.MigrateAsync();
}
}
}

362
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Migrations/20200228120435_Initial.Designer.cs

@ -1,362 +0,0 @@
// <auto-generated />
using System;
using Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Acme.BookStore.DbMigrationsForSecondDb.Migrations
{
[DbContext(typeof(BookStoreSecondMigrationsDbContext))]
[Migration("20200228120435_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ApplicationName")
.HasColumnName("ApplicationName")
.HasColumnType("nvarchar(96)")
.HasMaxLength(96);
b.Property<string>("BrowserInfo")
.HasColumnName("BrowserInfo")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("ClientId")
.HasColumnName("ClientId")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ClientIpAddress")
.HasColumnName("ClientIpAddress")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasColumnName("ClientName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("Comments")
.HasColumnName("Comments")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<string>("CorrelationId")
.HasColumnName("CorrelationId")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Exceptions")
.HasColumnName("Exceptions")
.HasColumnType("nvarchar(4000)")
.HasMaxLength(4000);
b.Property<int>("ExecutionDuration")
.HasColumnName("ExecutionDuration")
.HasColumnType("int");
b.Property<DateTime>("ExecutionTime")
.HasColumnType("datetime2");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("HttpMethod")
.HasColumnName("HttpMethod")
.HasColumnType("nvarchar(16)")
.HasMaxLength(16);
b.Property<int?>("HttpStatusCode")
.HasColumnName("HttpStatusCode")
.HasColumnType("int");
b.Property<Guid?>("ImpersonatorTenantId")
.HasColumnName("ImpersonatorTenantId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("ImpersonatorUserId")
.HasColumnName("ImpersonatorUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TenantName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Url")
.HasColumnName("Url")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid?>("UserId")
.HasColumnName("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserName")
.HasColumnName("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("TenantId", "ExecutionTime");
b.HasIndex("TenantId", "UserId", "ExecutionTime");
b.ToTable("AbpAuditLogs");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AuditLogId")
.HasColumnName("AuditLogId")
.HasColumnType("uniqueidentifier");
b.Property<int>("ExecutionDuration")
.HasColumnName("ExecutionDuration")
.HasColumnType("int");
b.Property<DateTime>("ExecutionTime")
.HasColumnName("ExecutionTime")
.HasColumnType("datetime2");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("MethodName")
.HasColumnName("MethodName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("Parameters")
.HasColumnName("Parameters")
.HasColumnType("nvarchar(2000)")
.HasMaxLength(2000);
b.Property<string>("ServiceName")
.HasColumnName("ServiceName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("AuditLogId");
b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime");
b.ToTable("AbpAuditLogActions");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AuditLogId")
.HasColumnName("AuditLogId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangeTime")
.HasColumnName("ChangeTime")
.HasColumnType("datetime2");
b.Property<byte>("ChangeType")
.HasColumnName("ChangeType")
.HasColumnType("tinyint");
b.Property<string>("EntityId")
.IsRequired()
.HasColumnName("EntityId")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<Guid?>("EntityTenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("EntityTypeFullName")
.IsRequired()
.HasColumnName("EntityTypeFullName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("AuditLogId");
b.HasIndex("TenantId", "EntityTypeFullName", "EntityId");
b.ToTable("AbpEntityChanges");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("EntityChangeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("NewValue")
.HasColumnName("NewValue")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("OriginalValue")
.HasColumnName("OriginalValue")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("PropertyName")
.IsRequired()
.HasColumnName("PropertyName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("PropertyTypeFullName")
.IsRequired()
.HasColumnName("PropertyTypeFullName")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("EntityChangeId");
b.ToTable("AbpEntityPropertyChanges");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpPermissionGrants");
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(2048)")
.HasMaxLength(2048);
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog", null)
.WithMany("Actions")
.HasForeignKey("AuditLogId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog", null)
.WithMany("EntityChanges")
.HasForeignKey("AuditLogId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
{
b.HasOne("Volo.Abp.AuditLogging.EntityChange", null)
.WithMany("PropertyChanges")
.HasForeignKey("EntityChangeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

212
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Migrations/20200228120435_Initial.cs

@ -1,212 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Acme.BookStore.DbMigrationsForSecondDb.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpAuditLogs",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
ApplicationName = table.Column<string>(maxLength: 96, nullable: true),
UserId = table.Column<Guid>(nullable: true),
UserName = table.Column<string>(maxLength: 256, nullable: true),
TenantId = table.Column<Guid>(nullable: true),
TenantName = table.Column<string>(nullable: true),
ImpersonatorUserId = table.Column<Guid>(nullable: true),
ImpersonatorTenantId = table.Column<Guid>(nullable: true),
ExecutionTime = table.Column<DateTime>(nullable: false),
ExecutionDuration = table.Column<int>(nullable: false),
ClientIpAddress = table.Column<string>(maxLength: 64, nullable: true),
ClientName = table.Column<string>(maxLength: 128, nullable: true),
ClientId = table.Column<string>(maxLength: 64, nullable: true),
CorrelationId = table.Column<string>(maxLength: 64, nullable: true),
BrowserInfo = table.Column<string>(maxLength: 512, nullable: true),
HttpMethod = table.Column<string>(maxLength: 16, nullable: true),
Url = table.Column<string>(maxLength: 256, nullable: true),
Exceptions = table.Column<string>(maxLength: 4000, nullable: true),
Comments = table.Column<string>(maxLength: 256, nullable: true),
HttpStatusCode = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpAuditLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissionGrants",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
Name = table.Column<string>(maxLength: 128, nullable: false),
ProviderName = table.Column<string>(maxLength: 64, nullable: false),
ProviderKey = table.Column<string>(maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSettings",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
Name = table.Column<string>(maxLength: 128, nullable: false),
Value = table.Column<string>(maxLength: 2048, nullable: false),
ProviderName = table.Column<string>(maxLength: 64, nullable: true),
ProviderKey = table.Column<string>(maxLength: 64, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpAuditLogActions",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
AuditLogId = table.Column<Guid>(nullable: false),
ServiceName = table.Column<string>(maxLength: 256, nullable: true),
MethodName = table.Column<string>(maxLength: 128, nullable: true),
Parameters = table.Column<string>(maxLength: 2000, nullable: true),
ExecutionTime = table.Column<DateTime>(nullable: false),
ExecutionDuration = table.Column<int>(nullable: false),
ExtraProperties = table.Column<string>(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>(nullable: false),
AuditLogId = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
ChangeTime = table.Column<DateTime>(nullable: false),
ChangeType = table.Column<byte>(nullable: false),
EntityTenantId = table.Column<Guid>(nullable: true),
EntityId = table.Column<string>(maxLength: 128, nullable: false),
EntityTypeFullName = table.Column<string>(maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(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: "AbpEntityPropertyChanges",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
EntityChangeId = table.Column<Guid>(nullable: false),
NewValue = table.Column<string>(maxLength: 512, nullable: true),
OriginalValue = table.Column<string>(maxLength: 512, nullable: true),
PropertyName = table.Column<string>(maxLength: 128, nullable: false),
PropertyTypeFullName = table.Column<string>(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_ExecutionTime",
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_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_AbpPermissionGrants_Name_ProviderName_ProviderKey",
table: "AbpPermissionGrants",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpSettings_Name_ProviderName_ProviderKey",
table: "AbpSettings",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpAuditLogActions");
migrationBuilder.DropTable(
name: "AbpEntityPropertyChanges");
migrationBuilder.DropTable(
name: "AbpPermissionGrants");
migrationBuilder.DropTable(
name: "AbpSettings");
migrationBuilder.DropTable(
name: "AbpEntityChanges");
migrationBuilder.DropTable(
name: "AbpAuditLogs");
}
}
}

360
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb/Migrations/BookStoreSecondMigrationsDbContextModelSnapshot.cs

@ -1,360 +0,0 @@
// <auto-generated />
using System;
using Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Acme.BookStore.DbMigrationsForSecondDb.Migrations
{
[DbContext(typeof(BookStoreSecondMigrationsDbContext))]
partial class BookStoreSecondMigrationsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ApplicationName")
.HasColumnName("ApplicationName")
.HasColumnType("nvarchar(96)")
.HasMaxLength(96);
b.Property<string>("BrowserInfo")
.HasColumnName("BrowserInfo")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("ClientId")
.HasColumnName("ClientId")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ClientIpAddress")
.HasColumnName("ClientIpAddress")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasColumnName("ClientName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("Comments")
.HasColumnName("Comments")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("ConcurrencyStamp")
.HasColumnType("nvarchar(max)");
b.Property<string>("CorrelationId")
.HasColumnName("CorrelationId")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Exceptions")
.HasColumnName("Exceptions")
.HasColumnType("nvarchar(4000)")
.HasMaxLength(4000);
b.Property<int>("ExecutionDuration")
.HasColumnName("ExecutionDuration")
.HasColumnType("int");
b.Property<DateTime>("ExecutionTime")
.HasColumnType("datetime2");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("HttpMethod")
.HasColumnName("HttpMethod")
.HasColumnType("nvarchar(16)")
.HasMaxLength(16);
b.Property<int?>("HttpStatusCode")
.HasColumnName("HttpStatusCode")
.HasColumnType("int");
b.Property<Guid?>("ImpersonatorTenantId")
.HasColumnName("ImpersonatorTenantId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("ImpersonatorUserId")
.HasColumnName("ImpersonatorUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TenantName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Url")
.HasColumnName("Url")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid?>("UserId")
.HasColumnName("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserName")
.HasColumnName("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("TenantId", "ExecutionTime");
b.HasIndex("TenantId", "UserId", "ExecutionTime");
b.ToTable("AbpAuditLogs");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AuditLogId")
.HasColumnName("AuditLogId")
.HasColumnType("uniqueidentifier");
b.Property<int>("ExecutionDuration")
.HasColumnName("ExecutionDuration")
.HasColumnType("int");
b.Property<DateTime>("ExecutionTime")
.HasColumnName("ExecutionTime")
.HasColumnType("datetime2");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("MethodName")
.HasColumnName("MethodName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("Parameters")
.HasColumnName("Parameters")
.HasColumnType("nvarchar(2000)")
.HasMaxLength(2000);
b.Property<string>("ServiceName")
.HasColumnName("ServiceName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("AuditLogId");
b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime");
b.ToTable("AbpAuditLogActions");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AuditLogId")
.HasColumnName("AuditLogId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangeTime")
.HasColumnName("ChangeTime")
.HasColumnType("datetime2");
b.Property<byte>("ChangeType")
.HasColumnName("ChangeType")
.HasColumnType("tinyint");
b.Property<string>("EntityId")
.IsRequired()
.HasColumnName("EntityId")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<Guid?>("EntityTenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("EntityTypeFullName")
.IsRequired()
.HasColumnName("EntityTypeFullName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("AuditLogId");
b.HasIndex("TenantId", "EntityTypeFullName", "EntityId");
b.ToTable("AbpEntityChanges");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("EntityChangeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("NewValue")
.HasColumnName("NewValue")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("OriginalValue")
.HasColumnName("OriginalValue")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<string>("PropertyName")
.IsRequired()
.HasColumnName("PropertyName")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("PropertyTypeFullName")
.IsRequired()
.HasColumnName("PropertyTypeFullName")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("EntityChangeId");
b.ToTable("AbpEntityPropertyChanges");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.IsRequired()
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpPermissionGrants");
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasColumnType("nvarchar(64)")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(2048)")
.HasMaxLength(2048);
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog", null)
.WithMany("Actions")
.HasForeignKey("AuditLogId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog", null)
.WithMany("EntityChanges")
.HasForeignKey("AuditLogId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
{
b.HasOne("Volo.Abp.AuditLogging.EntityChange", null)
.WithMany("PropertyChanges")
.HasForeignKey("EntityChangeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

23
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj

@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="2.1.1" />
</ItemGroup>
</Project>

67
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs

@ -1,67 +0,0 @@
using Acme.BookStore.Roles;
using Microsoft.EntityFrameworkCore;
using Acme.BookStore.Users;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.Users.EntityFrameworkCore;
namespace Acme.BookStore.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 BookStoreMigrationsDbContext for migrations.
*/
[ConnectionStringName("Default")]
public class BookStoreDbContext : AbpDbContext<BookStoreDbContext>
{
public DbSet<AppUser> Users { get; set; }
public DbSet<AppRole> Roles { get; set; }
/* Add DbSet properties for your Aggregate Roots / Entities here.
* Also map them inside BookStoreDbContextModelCreatingExtensions.ConfigureBookStore
*/
public BookStoreDbContext(DbContextOptions<BookStoreDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Configure the shared tables (with included modules) here */
builder.Entity<AppRole>(b =>
{
b.ToTable("AbpRoles");
b.ConfigureByConvention();
b.ConfigureCustomRoleProperties();
});
builder.Entity<AppUser>(b =>
{
b.ToTable("AbpUsers"); //Sharing the same table "AbpUsers" with the IdentityUser
b.ConfigureByConvention();
b.ConfigureAbpUser();
//Moved customization to a method so we can share it with the BookStoreMigrationsDbContext class
b.ConfigureCustomUserProperties();
});
/* Configure your own tables/entities inside the ConfigureBookStore method */
builder.ConfigureBookStore();
}
}
}

39
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContextModelCreatingExtensions.cs

@ -1,39 +0,0 @@
using System;
using Acme.BookStore.Roles;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Users;
namespace Acme.BookStore.EntityFrameworkCore
{
public static class BookStoreDbContextModelCreatingExtensions
{
public static void ConfigureBookStore(this ModelBuilder builder)
{
Check.NotNull(builder, nameof(builder));
/* Configure your own tables/entities inside here */
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(BookStoreConsts.DbTablePrefix + "YourEntities", BookStoreConsts.DbSchema);
// //...
//});
}
public static void ConfigureCustomUserProperties<TUser>(this EntityTypeBuilder<TUser> b)
where TUser: class, IUser
{
//b.Property<string>(nameof(AppUser.MyProperty))...
}
public static void ConfigureCustomRoleProperties<TRole>(this EntityTypeBuilder<TRole> b)
where TRole : class, IEntity<Guid>
{
b.Property<string>(nameof(AppRole.Title)).HasMaxLength(128);
}
}
}

47
samples/EfCoreMigrationDemo/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs

@ -1,47 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
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 Acme.BookStore.EntityFrameworkCore
{
[DependsOn(
typeof(BookStoreDomainModule),
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpIdentityServerEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpBackgroundJobsEntityFrameworkCoreModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule)
)]
public class BookStoreEntityFrameworkCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<BookStoreDbContext>(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 BookStoreMigrationsDbContextFactory for EF Core tooling. */
options.UseSqlServer();
});
}
}
}

22
samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj

@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi.Client" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.HttpApi.Client" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.HttpApi.Client" Version="2.1.1" />
</ItemGroup>
</Project>

31
samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi.Client/BookStoreHttpApiClientModule.cs

@ -1,31 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Account;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.TenantManagement;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreApplicationContractsModule),
typeof(AbpAccountHttpApiClientModule),
typeof(AbpIdentityHttpApiClientModule),
typeof(AbpPermissionManagementHttpApiClientModule),
typeof(AbpTenantManagementHttpApiClientModule),
typeof(AbpFeatureManagementHttpApiClientModule)
)]
public class BookStoreHttpApiClientModule : AbpModule
{
public const string RemoteServiceName = "Default";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(BookStoreApplicationContractsModule).Assembly,
RemoteServiceName
);
}
}
}

22
samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj

@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="2.1.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.HttpApi" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.HttpApi" Version="2.1.1" />
</ItemGroup>
</Project>

22
samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/BookStoreHttpApiModule.cs

@ -1,22 +0,0 @@
using Volo.Abp.Account;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.HttpApi;
using Volo.Abp.TenantManagement;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreApplicationContractsModule),
typeof(AbpAccountHttpApiModule),
typeof(AbpIdentityHttpApiModule),
typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpTenantManagementHttpApiModule),
typeof(AbpFeatureManagementHttpApiModule)
)]
public class BookStoreHttpApiModule : AbpModule
{
}
}

15
samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Controllers/BookStoreController.cs

@ -1,15 +0,0 @@
using Acme.BookStore.Localization;
using Volo.Abp.AspNetCore.Mvc;
namespace Acme.BookStore.Controllers
{
/* Inherit your controllers from this class.
*/
public abstract class BookStoreController : AbpController
{
protected BookStoreController()
{
LocalizationResource = typeof(BookStoreResource);
}
}
}

28
samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Controllers/TestController.cs

@ -1,28 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Acme.BookStore.Models.Test;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Acme.BookStore.Controllers
{
[Route("api/test")]
public class TestController : BookStoreController
{
public TestController()
{
}
[HttpGet]
[Route("")]
public async Task<List<TestModel>> GetAsync()
{
return new List<TestModel>
{
new TestModel {Name = "John", BirthDate = new DateTime(1942, 11, 18)},
new TestModel {Name = "Adams", BirthDate = new DateTime(1997, 05, 24)}
};
}
}
}

11
samples/EfCoreMigrationDemo/src/Acme.BookStore.HttpApi/Models/Test/TestModel.cs

@ -1,11 +0,0 @@
using System;
namespace Acme.BookStore.Models.Test
{
public class TestModel
{
public string Name { get; set; }
public DateTime BirthDate { get; set; }
}
}

58
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj

@ -1,58 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Acme.BookStore.Web</RootNamespace>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<PreserveCompilationContext>true</PreserveCompilationContext>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Acme.BookStore-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<Content Remove="Logs\**" />
<EmbeddedResource Remove="Logs\**" />
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup>
<None Update="Pages\**\*.js">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Pages\**\*.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Application\Acme.BookStore.Application.csproj" />
<ProjectReference Include="..\Acme.BookStore.HttpApi\Acme.BookStore.HttpApi.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb\Acme.BookStore.EntityFrameworkCore.DbMigrationsForSecondDb.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Autofac" Version="2.1.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="2.1.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Identity.Web" Version="2.1.1" />
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="2.1.1" />
<PackageReference Include="Volo.Abp.TenantManagement.Web" Version="2.1.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.Web" Version="2.1.1" />
</ItemGroup>
</Project>

11
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/BookStoreBrandingProvider.cs

@ -1,11 +0,0 @@
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.Web
{
[Dependency(ReplaceServices = true)]
public class BookStoreBrandingProvider : DefaultBrandingProvider
{
public override string AppName => "BookStore";
}
}

12
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/BookStoreWebAutoMapperProfile.cs

@ -1,12 +0,0 @@
using AutoMapper;
namespace Acme.BookStore.Web
{
public class BookStoreWebAutoMapperProfile : Profile
{
public BookStoreWebAutoMapperProfile()
{
//Define your AutoMapper configuration here for the Web project.
}
}
}

215
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/BookStoreWebModule.cs

@ -1,215 +0,0 @@
using System;
using System.IO;
using Acme.BookStore.DbMigrationsForSecondDb.EntityFrameworkCore;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Acme.BookStore.EntityFrameworkCore;
using Acme.BookStore.Localization;
using Acme.BookStore.MultiTenancy;
using Acme.BookStore.Web.Menus;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.Web;
using Volo.Abp.TenantManagement.Web;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.UI;
using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;
namespace Acme.BookStore.Web
{
[DependsOn(
typeof(BookStoreHttpApiModule),
typeof(BookStoreApplicationModule),
typeof(BookStoreEntityFrameworkCoreDbMigrationsModule),
typeof(BookStoreEntityFrameworkCoreSecondDbMigrationsModule),
typeof(AbpAutofacModule),
typeof(AbpIdentityWebModule),
typeof(AbpAccountWebIdentityServerModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpTenantManagementWebModule),
typeof(AbpAspNetCoreSerilogModule)
)]
public class BookStoreWebModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
{
options.AddAssemblyResource(
typeof(BookStoreResource),
typeof(BookStoreDomainModule).Assembly,
typeof(BookStoreDomainSharedModule).Assembly,
typeof(BookStoreApplicationModule).Assembly,
typeof(BookStoreApplicationContractsModule).Assembly,
typeof(BookStoreWebModule).Assembly
);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
ConfigureUrls(configuration);
ConfigureAuthentication(context, configuration);
ConfigureAutoMapper();
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureLocalizationServices();
ConfigureNavigationServices();
ConfigureAutoApiControllers();
ConfigureSwaggerServices(context.Services);
}
private void ConfigureUrls(IConfiguration configuration)
{
Configure<AppUrlOptions>(options =>
{
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
});
}
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAuthentication()
.AddIdentityServerAuthentication(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = false;
options.ApiName = "BookStore";
});
}
private void ConfigureAutoMapper()
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<BookStoreWebModule>();
});
}
private void ConfigureVirtualFileSystem(IWebHostEnvironment hostingEnvironment)
{
if (hostingEnvironment.IsDevelopment())
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain.Shared"));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain"));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Application.Contracts"));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreApplicationModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Application"));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreWebModule>(hostingEnvironment.ContentRootPath);
});
}
}
private void ConfigureLocalizationServices()
{
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<BookStoreResource>()
.AddBaseTypes(
typeof(AbpUiResource)
);
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština"));
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português"));
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文"));
});
}
private void ConfigureNavigationServices()
{
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new BookStoreMenuContributor());
});
}
private void ConfigureAutoApiControllers()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly);
});
}
private void ConfigureSwaggerServices(IServiceCollection services)
{
services.AddSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "BookStore API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
}
);
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
app.UseCorrelationId();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseErrorPage();
}
app.UseVirtualFiles();
app.UseRouting();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseIdentityServer();
app.UseAuthorization();
app.UseAbpRequestLocalization();
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "BookStore API");
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseMvcWithDefaultRouteAndArea();
}
}
}

34
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Menus/BookStoreMenuContributor.cs

@ -1,34 +0,0 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Acme.BookStore.Localization;
using Acme.BookStore.MultiTenancy;
using Volo.Abp.TenantManagement.Web.Navigation;
using Volo.Abp.UI.Navigation;
namespace Acme.BookStore.Web.Menus
{
public class BookStoreMenuContributor : IMenuContributor
{
public async Task ConfigureMenuAsync(MenuConfigurationContext context)
{
if (context.Menu.Name == StandardMenus.Main)
{
await ConfigureMainMenuAsync(context);
}
}
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
if (!MultiTenancyConsts.IsEnabled)
{
var administration = context.Menu.GetAdministration();
administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName);
}
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<BookStoreResource>>();
context.Menu.Items.Insert(0, new ApplicationMenuItem("BookStore.Home", l["Menu:Home"], "/"));
}
}
}

16
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/BookStorePage.cs

@ -1,16 +0,0 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Acme.BookStore.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Acme.BookStore.Web.Pages
{
/* Inherit your UI Pages from this class. To do that, add this line to your Pages (.cshtml files under the Page folder):
* @inherits Acme.BookStore.Web.Pages.BookStorePage
*/
public abstract class BookStorePage : AbpPage
{
[RazorInject]
public IHtmlLocalizer<BookStoreResource> L { get; set; }
}
}

15
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/BookStorePageModel.cs

@ -1,15 +0,0 @@
using Acme.BookStore.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Acme.BookStore.Web.Pages
{
/* Inherit your PageModel classes from this class.
*/
public abstract class BookStorePageModel : AbpPageModel
{
protected BookStorePageModel()
{
LocalizationResourceType = typeof(BookStoreResource);
}
}
}

27
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.cshtml

@ -1,27 +0,0 @@
@page
@inherits Acme.BookStore.Web.Pages.BookStorePage
@model Acme.BookStore.Web.Pages.IndexModel
@section styles {
<abp-style-bundle>
<abp-style src="/Pages/Index.css" />
</abp-style-bundle>
}
@section scripts {
<abp-script-bundle>
<abp-script src="/Pages/Index.js" />
</abp-script-bundle>
}
<div class="jumbotron text-center">
<h1>@L["Welcome"]</h1>
<div class="row">
<div class="col-md-6 mx-auto">
<p>@L["LongWelcomeMessage"]</p>
<hr class="my-4"/>
</div>
</div>
<a href="https://abp.io?ref=tmpl" target="_blank" class="btn btn-primary px-4">abp.io</a>
@if (!CurrentUser.IsAuthenticated)
{
<a abp-button="Primary" href="/Account/Login" class="px-4"><i class="fa fa-sign-in"></i> @L["Login"]</a>
}
</div>

10
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.cshtml.cs

@ -1,10 +0,0 @@
namespace Acme.BookStore.Web.Pages
{
public class IndexModel : BookStorePageModel
{
public void OnGet()
{
}
}
}

3
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.css

@ -1,3 +0,0 @@
body {
}

3
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/Index.js

@ -1,3 +0,0 @@
$(function () {
abp.log.debug('Index.js initialized!');
});

4
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Pages/_ViewImports.cshtml

@ -1,4 +0,0 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling

50
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Program.cs

@ -1,50 +0,0 @@
using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
namespace Acme.BookStore.Web
{
public class Program
{
public static int Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.CreateLogger();
try
{
Log.Information("Starting web host.");
CreateHostBuilder(args).Build().Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseAutofac()
.UseSerilog();
}
}

27
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Properties/launchSettings.json

@ -1,27 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44312/",
"sslPort": 44312
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Acme.BookStore.Web": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:44312/"
}
}
}

18
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Startup.cs

@ -1,18 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace Acme.BookStore.Web
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<BookStoreWebModule>();
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}
}

4
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/Views/_ViewImports.cshtml

@ -1,4 +0,0 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling

8
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/abp.resourcemapping.js

@ -1,8 +0,0 @@
module.exports = {
aliases: {
},
mappings: {
}
};

2
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/appsettings.Development.json

@ -1,2 +0,0 @@
{
}

21
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/appsettings.json

@ -1,21 +0,0 @@
{
"App": {
"SelfUrl": "https://localhost:44312"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true",
"AbpPermissionManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true",
"AbpSettingManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true",
"AbpAuditLogging": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"AuthServer": {
"Authority": "https://localhost:44312"
},
"IdentityServer": {
"Clients": {
"BookStore_App": {
"ClientId": "BookStore_App"
}
}
}
}

9
samples/EfCoreMigrationDemo/src/Acme.BookStore.Web/gulpfile.js

@ -1,9 +0,0 @@
"use strict";
var gulp = require("gulp"),
path = require('path'),
copyResources = require('./node_modules/@abp/aspnetcore.mvc.ui/gulp/copy-resources.js');
exports.default = function(){
return copyResources(path.resolve('./'));
};

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

Loading…
Cancel
Save