Browse Source

Update BookStore sample with the latest template.

pull/1194/head
Halil İbrahim Kalkan 7 years ago
parent
commit
dc214152e0
  1. 5
      samples/BookStore/.gitignore
  2. 69
      samples/BookStore/Acme.BookStore.sln
  3. 2
      samples/BookStore/common.props
  4. 21
      samples/BookStore/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj
  5. 2
      samples/BookStore/src/Acme.BookStore.Application.Contracts/BookDto.cs
  6. 20
      samples/BookStore/src/Acme.BookStore.Application.Contracts/BookStoreApplicationContractsModule.cs
  7. 7
      samples/BookStore/src/Acme.BookStore.Application.Contracts/CreateUpdateBookDto.cs
  8. 0
      samples/BookStore/src/Acme.BookStore.Application.Contracts/IBookAppService.cs
  9. 6
      samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
  10. 3
      samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationAutoMapperProfile.cs
  11. 5
      samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs
  12. 2
      samples/BookStore/src/Acme.BookStore.Application/Permissions/BookStorePermissionDefinitionProvider.cs
  13. 10
      samples/BookStore/src/Acme.BookStore.Application/Permissions/BookStorePermissions.cs
  14. 34
      samples/BookStore/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj
  15. 16
      samples/BookStore/src/Acme.BookStore.DbMigrator/BookStoreDbMigratorModule.cs
  16. 53
      samples/BookStore/src/Acme.BookStore.DbMigrator/Program.cs
  17. 16
      samples/BookStore/src/Acme.BookStore.DbMigrator/appsettings.json
  18. 26
      samples/BookStore/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj
  19. 7
      samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainErrorCodes.cs
  20. 45
      samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs
  21. 4
      samples/BookStore/src/Acme.BookStore.Domain.Shared/BookType.cs
  22. 8
      samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/cs.json
  23. 11
      samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/en.json
  24. 0
      samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/pt-BR.json
  25. 8
      samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/tr.json
  26. 8
      samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json
  27. 2
      samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStoreResource.cs
  28. 11
      samples/BookStore/src/Acme.BookStore.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs
  29. 18
      samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
  30. 5
      samples/BookStore/src/Acme.BookStore.Domain/Book.cs
  31. 2
      samples/BookStore/src/Acme.BookStore.Domain/BookStoreConsts.cs
  32. 37
      samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs
  33. 39
      samples/BookStore/src/Acme.BookStore.Domain/Data/BookStoreDbMigrationService.cs
  34. 9
      samples/BookStore/src/Acme.BookStore.Domain/Data/IBookStoreDbSchemaMigrator.cs
  35. 16
      samples/BookStore/src/Acme.BookStore.Domain/Data/NullBookStoreDbSchemaMigrator.cs
  36. 222
      samples/BookStore/src/Acme.BookStore.Domain/IdentityServer/IdentityServerDataSeedContributor.cs
  37. 20
      samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/cs.json
  38. 20
      samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/tr.json
  39. 20
      samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/zh-Hans.json
  40. 7
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj
  41. 16
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreEntityFrameworkCoreDbMigrationsModule.cs
  42. 9
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs
  43. 2
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs
  44. 24
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreBookStoreDbSchemaMigrator.cs
  45. 653
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603112909_Initial.Designer.cs
  46. 479
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603112909_Initial.cs
  47. 661
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603113122_Created_Book_Entity.Designer.cs
  48. 2
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603113122_Created_Book_Entity.cs
  49. 634
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs
  50. 5
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
  51. 13
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs
  52. 7
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContextModelCreatingExtensions.cs
  53. 13
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs
  54. 21
      samples/BookStore/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj
  55. 29
      samples/BookStore/src/Acme.BookStore.HttpApi.Client/BookStoreHttpApiClientModule.cs
  56. 21
      samples/BookStore/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj
  57. 20
      samples/BookStore/src/Acme.BookStore.HttpApi/BookStoreHttpApiModule.cs
  58. 13
      samples/BookStore/src/Acme.BookStore.HttpApi/Controllers/BookStoreController.cs
  59. 28
      samples/BookStore/src/Acme.BookStore.HttpApi/Controllers/TestController.cs
  60. 11
      samples/BookStore/src/Acme.BookStore.HttpApi/Models/Test/TestModel.cs
  61. 16
      samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj
  62. 2
      samples/BookStore/src/Acme.BookStore.Web/BookStoreBrandingProvider.cs
  63. 4
      samples/BookStore/src/Acme.BookStore.Web/BookStoreWebAutoMapperProfile.cs
  64. 91
      samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs
  65. 12
      samples/BookStore/src/Acme.BookStore.Web/Menus/BookStoreMenuContributor.cs
  66. 6
      samples/BookStore/src/Acme.BookStore.Web/Pages/BookStorePageBase.cs
  67. 4
      samples/BookStore/src/Acme.BookStore.Web/Pages/BookStorePageModelBase.cs
  68. 4
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/CreateModal.cshtml
  69. 4
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/CreateModal.cshtml.cs
  70. 4
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml
  71. 2
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml.cs
  72. 23
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/Index.cshtml
  73. 10
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/Index.cshtml.cs
  74. 40
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/index.js
  75. 18
      samples/BookStore/src/Acme.BookStore.Web/Pages/Index.cshtml
  76. 2
      samples/BookStore/src/Acme.BookStore.Web/Pages/Index.cshtml.cs
  77. 3
      samples/BookStore/src/Acme.BookStore.Web/Pages/Index.css
  78. 3
      samples/BookStore/src/Acme.BookStore.Web/Pages/Index.js
  79. 8
      samples/BookStore/src/Acme.BookStore.Web/Program.cs
  80. 2
      samples/BookStore/src/Acme.BookStore.Web/Properties/launchSettings.json
  81. 2
      samples/BookStore/src/Acme.BookStore.Web/Startup.cs
  82. 1
      samples/BookStore/src/Acme.BookStore.Web/Views/_ViewImports.cshtml
  83. 2
      samples/BookStore/src/Acme.BookStore.Web/abp.resourcemapping.js
  84. 2
      samples/BookStore/src/Acme.BookStore.Web/appsettings.Development.json
  85. 11
      samples/BookStore/src/Acme.BookStore.Web/appsettings.json
  86. 6
      samples/BookStore/src/Acme.BookStore.Web/compilerconfig.json
  87. 49
      samples/BookStore/src/Acme.BookStore.Web/compilerconfig.json.defaults
  88. 4
      samples/BookStore/src/Acme.BookStore.Web/package.json
  89. 1
      samples/BookStore/src/Acme.BookStore.Web/tempkey.rsa
  90. 1
      samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/index.css
  91. 1
      samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/index.min.css
  92. 3
      samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/index.scss
  93. 13
      samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj
  94. 11
      samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreApplicationTestBase.cs
  95. 69
      samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreApplicationTestModule.cs
  96. 33
      samples/BookStore/test/Acme.BookStore.Application.Tests/Samples/SampleAppServiceTests.cs
  97. 59
      samples/BookStore/test/Acme.BookStore.Application.Tests/Samples/SampleTests.cs
  98. 18
      samples/BookStore/test/Acme.BookStore.Domain.Tests/Acme.BookStore.Domain.Tests.csproj
  99. 7
      samples/BookStore/test/Acme.BookStore.Domain.Tests/BookStoreDomainTestBase.cs
  100. 13
      samples/BookStore/test/Acme.BookStore.Domain.Tests/BookStoreDomainTestModule.cs

5
samples/BookStore/.gitignore

@ -252,4 +252,7 @@ paket-files/
*.sln.iml
# BookStore
src/Acme.BookStore.Web/Logs/logs.txt
src/Acme.BookStore.Web/Logs/*
src/Acme.BookStore.Web.Host/Logs/*
src/Acme.BookStore.IdentityServer/Logs/*
src/Acme.BookStore.HttpApi.Host/Logs/*

69
samples/BookStore/Acme.BookStore.sln

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.1
# Visual Studio Version 16
VisualStudioVersion = 16.0.28922.388
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
@ -19,7 +19,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Application.
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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.BookStore.EntityFrameworkCore.DbMigrations", "src\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj", "{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}"
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -55,6 +73,42 @@ Global
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -67,6 +121,15 @@ Global
{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}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

2
samples/BookStore/common.props

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

21
samples/BookStore/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj

@ -0,0 +1,21 @@
<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.Identity.Application.Contracts" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application.Contracts" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Application.Contracts" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Application.Contracts" Version="0.17.0.0" />
</ItemGroup>
</Project>

2
samples/BookStore/src/Acme.BookStore.Application/BookDto.cs → samples/BookStore/src/Acme.BookStore.Application.Contracts/BookDto.cs

@ -1,10 +1,8 @@
using System;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AutoMapper;
namespace Acme.BookStore
{
[AutoMapFrom(typeof(Book))]
public class BookDto : AuditedEntityDto<Guid>
{
public string Name { get; set; }

20
samples/BookStore/src/Acme.BookStore.Application.Contracts/BookStoreApplicationContractsModule.cs

@ -0,0 +1,20 @@
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(AbpFeatureManagementApplicationContractsModule),
typeof(AbpIdentityApplicationContractsModule),
typeof(AbpPermissionManagementApplicationContractsModule),
typeof(AbpTenantManagementApplicationContractsModule)
)]
public class BookStoreApplicationContractsModule : AbpModule
{
}
}

7
samples/BookStore/src/Acme.BookStore.Application/CreateUpdateBookDto.cs → samples/BookStore/src/Acme.BookStore.Application.Contracts/CreateUpdateBookDto.cs

@ -1,11 +1,8 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.AutoMapper;
namespace Acme.BookStore
{
[AutoMapTo(typeof(Book))]
[AutoMapFrom(typeof(BookDto))]
public class CreateUpdateBookDto
{
[Required]
@ -14,10 +11,10 @@ namespace Acme.BookStore
[Required]
public BookType Type { get; set; } = BookType.Undefined;
[Required]
public DateTime PublishDate { get; set; }
[Required]
public float Price { get; set; }
}

0
samples/BookStore/src/Acme.BookStore.Application/IBookAppService.cs → samples/BookStore/src/Acme.BookStore.Application.Contracts/IBookAppService.cs

6
samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
@ -9,6 +9,10 @@
<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.Identity.Application" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="0.17.0.0" />

3
samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationAutoMapperProfile.cs

@ -6,7 +6,8 @@ namespace Acme.BookStore
{
public BookStoreApplicationAutoMapperProfile()
{
//Configure your AutoMapper mapping configuration here...
CreateMap<Book, BookDto>();
CreateMap<CreateUpdateBookDto, Book>();
}
}
}

5
samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs

@ -9,6 +9,7 @@ namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreDomainModule),
typeof(BookStoreApplicationContractsModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpTenantManagementApplicationModule),
@ -20,6 +21,10 @@ namespace Acme.BookStore
{
Configure<AbpAutoMapperOptions>(options =>
{
/* Use `true` for the `validate` parameter if you want to
* validate the profile on application startup.
* See http://docs.automapper.org/en/stable/Configuration-validation.html for more info
* about the configuration validation. */
options.AddProfile<BookStoreApplicationAutoMapperProfile>();
});
}

2
samples/BookStore/src/Acme.BookStore.Application/Permissions/BookStorePermissionDefinitionProvider.cs

@ -1,4 +1,4 @@
using Acme.BookStore.Localization.BookStore;
using Acme.BookStore.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

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

@ -1,6 +1,4 @@
using System;
namespace Acme.BookStore.Permissions
namespace Acme.BookStore.Permissions
{
public static class BookStorePermissions
{
@ -8,11 +6,5 @@ namespace Acme.BookStore.Permissions
//Add your own permission names. Example:
//public const string MyPermission1 = GroupName + ".MyPermission1";
public static string[] GetAll()
{
//Return an array of all permissions
return Array.Empty<string>();
}
}
}

34
samples/BookStore/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj

@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" />
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.4" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Autofac" Version="0.17.0.0" />
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup>
</Project>

16
samples/BookStore/src/Acme.BookStore.DbMigrator/BookStoreDbMigratorModule.cs

@ -0,0 +1,16 @@
using Acme.BookStore.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
namespace Acme.BookStore.DbMigrator
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(BookStoreEntityFrameworkCoreDbMigrationsModule),
typeof(BookStoreApplicationContractsModule)
)]
public class BookStoreDbMigratorModule : AbpModule
{
}
}

53
samples/BookStore/src/Acme.BookStore.DbMigrator/Program.cs

@ -0,0 +1,53 @@
using System.IO;
using Microsoft.Extensions.DependencyInjection;
using Acme.BookStore.Data;
using Serilog;
using Serilog.Events;
using Volo.Abp;
using Volo.Abp.Threading;
namespace Acme.BookStore.DbMigrator
{
class Program
{
static void Main(string[] args)
{
ConfigureLogging();
using (var application = AbpApplicationFactory.Create<BookStoreDbMigratorModule>(options =>
{
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
}))
{
application.Initialize();
AsyncHelper.RunSync(
() => application
.ServiceProvider
.GetRequiredService<BookStoreDbMigrationService>()
.MigrateAsync()
);
application.Shutdown();
}
}
private static void ConfigureLogging()
{
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();
}
}
}

16
samples/BookStore/src/Acme.BookStore.DbMigrator/appsettings.json

@ -0,0 +1,16 @@
{
"ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"IdentityServer": {
"Clients": {
"BookStore_Web": {
"ClientId": "BookStore_Web",
"RootUrl": "https://localhost:44314/"
},
"BookStore_ConsoleTestApp": {
"ClientId": "BookStore_ConsoleTestApp"
}
}
}
}

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

@ -0,0 +1,26 @@
<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="0.17.0.0" />
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain.Shared" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Domain.Shared" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Domain.Shared" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Shared" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="0.17.0.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\BookStore\*.json" />
<Content Remove="Localization\BookStore\*.json" />
</ItemGroup>
</Project>

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

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

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

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

4
samples/BookStore/src/Acme.BookStore.Domain/BookType.cs → samples/BookStore/src/Acme.BookStore.Domain.Shared/BookType.cs

@ -1,9 +1,9 @@
namespace Acme.BookStore
{
public enum BookType : byte
public enum BookType
{
Undefined,
Advanture,
Adventure,
Biography,
Dystopia,
Fantastic,

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

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

11
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/en.json → samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/en.json

@ -6,15 +6,6 @@
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.",
"Menu:BookStore": "Book Store",
"Menu:Books": "Books",
"Name": "Name",
"Type": "Type",
"PublishDate": "Publish Date",
"Price": "Price",
"CreationTime": "Creation Time",
"NewBook": "New book",
"Books": "Books",
"Update": "Update",
"BookDeletionConfirmationMessage": "Are you sure to delete this book: {0}",
"SuccessfullyDeleted": "Successfully deleted."
"BookDeletionConfirmationMessage": "Are you sure to delete the book {0}?"
}
}

0
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/pt-BR.json → samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/pt-BR.json

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

@ -0,0 +1,8 @@
{
"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/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json

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

2
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/BookStoreResource.cs → samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStoreResource.cs

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

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

@ -0,0 +1,11 @@
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;
}
}

18
samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj

@ -1,25 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</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="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Auditing" Version="0.17.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\BookStore\*.json" />
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="0.17.0.0" />
</ItemGroup>
</Project>

5
samples/BookStore/src/Acme.BookStore.Domain/Book.cs

@ -1,15 +1,10 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Volo.Abp.Domain.Entities.Auditing;
namespace Acme.BookStore
{
[Table("Books")]
public class Book : AuditedAggregateRoot<Guid>
{
[Required]
[StringLength(128)]
public string Name { get; set; }
public BookType Type { get; set; }

2
samples/BookStore/src/Acme.BookStore.Domain/BookStoreConsts.cs

@ -5,7 +5,5 @@
public const string DbTablePrefix = "App";
public const string DbSchema = null;
public const bool IsMultiTenancyEnabled = true;
}
}

37
samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs

@ -1,48 +1,37 @@
using Acme.BookStore.Localization.BookStore;
using Volo.Abp.Auditing;
using Acme.BookStore.MultiTenancy;
using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.IdentityServer;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.PermissionManagement.IdentityServer;
using Volo.Abp.SettingManagement;
using Volo.Abp.TenantManagement;
using Volo.Abp.VirtualFileSystem;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreDomainSharedModule),
typeof(AbpAuditLoggingDomainModule),
typeof(BackgroundJobsDomainModule),
typeof(AbpFeatureManagementDomainModule),
typeof(AbpIdentityDomainModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpAuditingModule),
typeof(BackgroundJobsDomainModule),
typeof(AbpAuditLoggingDomainModule),
typeof(AbpTenantManagementDomainModule),
typeof(AbpFeatureManagementDomainModule)
typeof(AbpIdentityServerDomainModule),
typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(AbpSettingManagementDomainModule),
typeof(AbpTenantManagementDomainModule)
)]
public class BookStoreDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<BookStoreDomainModule>("Acme.BookStore");
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<BookStoreResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/BookStore");
});
Configure<MultiTenancyOptions>(options =>
{
options.IsEnabled = BookStoreConsts.IsMultiTenancyEnabled;
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
}
}

39
samples/BookStore/src/Acme.BookStore.Domain/Data/BookStoreDbMigrationService.cs

@ -0,0 +1,39 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.Data
{
public class BookStoreDbMigrationService : ITransientDependency
{
public ILogger<BookStoreDbMigrationService> Logger { get; set; }
private readonly IDataSeeder _dataSeeder;
private readonly IBookStoreDbSchemaMigrator _dbSchemaMigrator;
public BookStoreDbMigrationService(
IDataSeeder dataSeeder,
IBookStoreDbSchemaMigrator dbSchemaMigrator)
{
_dataSeeder = dataSeeder;
_dbSchemaMigrator = dbSchemaMigrator;
Logger = NullLogger<BookStoreDbMigrationService>.Instance;
}
public async Task MigrateAsync()
{
Logger.LogInformation("Started database migrations...");
Logger.LogInformation("Migrating database schema...");
await _dbSchemaMigrator.MigrateAsync();
Logger.LogInformation("Executing database seed...");
await _dataSeeder.SeedAsync();
Logger.LogInformation("Successfully completed database migrations.");
}
}
}

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

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

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

@ -0,0 +1,16 @@
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;
}
}
}

222
samples/BookStore/src/Acme.BookStore.Domain/IdentityServer/IdentityServerDataSeedContributor.cs

@ -0,0 +1,222 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Configuration;
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;
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 IConfigurationAccessor _configurationAccessor;
public IdentityServerDataSeedContributor(
IClientRepository clientRepository,
IApiResourceRepository apiResourceRepository,
IIdentityResourceDataSeeder identityResourceDataSeeder,
IGuidGenerator guidGenerator,
IPermissionDataSeeder permissionDataSeeder,
IConfigurationAccessor configurationAccessor)
{
_clientRepository = clientRepository;
_apiResourceRepository = apiResourceRepository;
_identityResourceDataSeeder = identityResourceDataSeeder;
_guidGenerator = guidGenerator;
_permissionDataSeeder = permissionDataSeeder;
_configurationAccessor = configurationAccessor;
}
[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()
{
const string commonSecret = "E5Xd4yMqjP5kjWFKrYgySBju6JVfCzMyFp7n2QmMrME=";
var commonScopes = new[]
{
"email",
"openid",
"profile",
"role",
"phone",
"address",
"BookStore"
};
var configurationSection = _configurationAccessor.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" },
commonSecret,
redirectUri: $"{webClientRootUrl}signin-oidc",
postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc"
);
}
//Console Test Client
var consoleClientId = configurationSection["BookStore_ConsoleTestApp:ClientId"];
if (!consoleClientId.IsNullOrWhiteSpace())
{
await CreateClientAsync(
consoleClientId,
commonScopes,
new[] { "password", "client_credentials" },
commonSecret
);
}
}
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);
}
}
}

20
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/cs.json

@ -1,20 +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.",
"Menu:BookStore": "Knihkupectví",
"Menu:Books": "Knihy",
"Name": "Název",
"Type": "Typ",
"PublishDate": "Publikováno",
"Price": "Cena",
"CreationTime": "Vytvořeno",
"NewBook": "Nová kniha",
"Books": "Knihy",
"Update": "Aktualizovat",
"BookDeletionConfirmationMessage": "Opravdu chcete smazat tuto knihu: {0}",
"SuccessfullyDeleted": "Úspěšně smazáno."
}
}

20
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/tr.json

@ -1,20 +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.",
"Menu:BookStore": "Kitap Mağazası",
"Menu:Books": "Kitaplar",
"Name": "İsim",
"Type": "Tür",
"PublishDate": "Yayınlanma Tarihi",
"Price": "Fiyat",
"CreationTime": "Oluşturulma zamanı",
"NewBook": "Yeni kitap",
"Books": "Kitaplar",
"Update": "Güncelle",
"BookDeletionConfirmationMessage": "Bu kitabı silmek istediğinize emin misiniz: {0}",
"SuccessfullyDeleted": "Başarıyla silindi."
}
}

20
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/zh-Hans.json

@ -1,20 +0,0 @@
{
"culture": "zh-Hans",
"texts": {
"Menu:Home": "首页",
"Welcome": "欢迎",
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io.",
"Menu:BookStore": "图书商店",
"Menu:Books": "图书",
"Name": "名称",
"Type": "类型",
"PublishDate": "出版时间",
"Price": "价格",
"CreationTime": "添加时间",
"NewBook": "新书籍",
"Books": "图书",
"Update": "更新",
"BookDeletionConfirmationMessage": "你确定删除书箱: {0} 吗",
"SuccessfullyDeleted": "删除成功."
}
}

7
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
@ -7,11 +7,6 @@
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20190320072839_Initial.cs" />
<Compile Remove="Migrations\20190529070552_Upgraded_To_Abp_0.17.0.0.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" />
</ItemGroup>

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

@ -0,0 +1,16 @@
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>();
}
}
}

9
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs

@ -2,14 +2,21 @@
using Volo.Abp.AuditLogging.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.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.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)
@ -29,6 +36,8 @@ namespace Acme.BookStore.EntityFrameworkCore
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureIdentityServer();
builder.ConfigureFeatureManagement();
builder.ConfigureTenantManagement();
/* Configure customizations for entities from the modules included */

2
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs

@ -5,6 +5,8 @@ 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)

24
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreBookStoreDbSchemaMigrator.cs

@ -0,0 +1,24 @@
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Acme.BookStore.Data;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.EntityFrameworkCore
{
[Dependency(ReplaceServices = true)]
public class EntityFrameworkCoreBookStoreDbSchemaMigrator
: IBookStoreDbSchemaMigrator, ITransientDependency
{
private readonly BookStoreMigrationsDbContext _dbContext;
public EntityFrameworkCoreBookStoreDbSchemaMigrator(BookStoreMigrationsDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task MigrateAsync()
{
await _dbContext.Database.MigrateAsync();
}
}
}

653
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190416070050_Created_Book_Entity.Designer.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603112909_Initial.Designer.cs

@ -10,50 +10,17 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Acme.BookStore.Migrations
{
[DbContext(typeof(BookStoreMigrationsDbContext))]
[Migration("20190416070050_Created_Book_Entity")]
partial class Created_Book_Entity
[Migration("20190603112909_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Acme.BookStore.Book", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<float>("Price");
b.Property<DateTime>("PublishDate");
b.Property<byte>("Type");
b.HasKey("Id");
b.ToTable("AppBooks");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")
@ -298,6 +265,32 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpBackgroundJobs");
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128);
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpFeatureValues");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
@ -596,6 +589,482 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.ToTable("IdentityServerApiResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Type");
b.ToTable("IdentityServerApiClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<string>("DisplayName")
.HasMaxLength(128);
b.Property<bool>("Emphasize");
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("ApiResourceId", "Name");
b.ToTable("IdentityServerApiScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Name", "Type");
b.ToTable("IdentityServerApiScopeClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ApiResourceId", "Type", "Value");
b.ToTable("IdentityServerApiSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AbsoluteRefreshTokenLifetime");
b.Property<int>("AccessTokenLifetime");
b.Property<int>("AccessTokenType");
b.Property<bool>("AllowAccessTokensViaBrowser");
b.Property<bool>("AllowOfflineAccess");
b.Property<bool>("AllowPlainTextPkce");
b.Property<bool>("AllowRememberConsent");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken");
b.Property<bool>("AlwaysSendClientClaims");
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(300);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasMaxLength(300);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<int?>("ConsentLifetime");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(300);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("LogoUri")
.HasMaxLength(300);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration");
b.Property<int>("RefreshTokenUsage");
b.Property<bool>("RequireClientSecret");
b.Property<bool>("RequireConsent");
b.Property<bool>("RequirePkce");
b.Property<int>("SlidingRefreshTokenLifetime");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("IdentityServerClients");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.HasMaxLength(250);
b.HasKey("ClientId", "Type", "Value");
b.ToTable("IdentityServerClientClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Origin")
.HasMaxLength(150);
b.HasKey("ClientId", "Origin");
b.ToTable("IdentityServerClientCorsOrigins");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("GrantType")
.HasMaxLength(196);
b.HasKey("ClientId", "GrantType");
b.ToTable("IdentityServerClientGrantTypes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Provider")
.HasMaxLength(64);
b.HasKey("ClientId", "Provider");
b.ToTable("IdentityServerClientIdPRestrictions");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("PostLogoutRedirectUri")
.HasMaxLength(200);
b.HasKey("ClientId", "PostLogoutRedirectUri");
b.ToTable("IdentityServerClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Key")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128);
b.HasKey("ClientId", "Key");
b.ToTable("IdentityServerClientProperties");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("RedirectUri")
.HasMaxLength(200);
b.HasKey("ClientId", "RedirectUri");
b.ToTable("IdentityServerClientRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Scope")
.HasMaxLength(196);
b.HasKey("ClientId", "Scope");
b.ToTable("IdentityServerClientScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ClientId", "Type", "Value");
b.ToTable("IdentityServerClientSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired();
b.Property<DateTime?>("Expiration");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type");
b.ToTable("IdentityServerPersistedGrants");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.Property<Guid>("IdentityResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("IdentityResourceId", "Type");
b.ToTable("IdentityServerIdentityClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.ToTable("IdentityServerIdentityResources");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
@ -780,6 +1249,118 @@ namespace Acme.BookStore.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId", "Name")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.HasOne("Volo.Abp.TenantManagement.Tenant")

479
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603112909_Initial.cs

@ -80,6 +80,21 @@ namespace Acme.BookStore.Migrations
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpFeatureValues",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
Name = table.Column<string>(maxLength: 128, nullable: false),
Value = table.Column<string>(maxLength: 128, nullable: false),
ProviderName = table.Column<string>(maxLength: 64, nullable: true),
ProviderKey = table.Column<string>(maxLength: 64, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFeatureValues", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissionGrants",
columns: table => new
@ -186,6 +201,131 @@ namespace Acme.BookStore.Migrations
table.PrimaryKey("PK_AbpUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityServerApiResources",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Enabled = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityServerClients",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
ClientName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
ClientUri = table.Column<string>(maxLength: 300, nullable: true),
LogoUri = table.Column<string>(maxLength: 300, nullable: true),
Enabled = table.Column<bool>(nullable: false),
ProtocolType = table.Column<string>(maxLength: 200, nullable: false),
RequireClientSecret = table.Column<bool>(nullable: false),
RequireConsent = table.Column<bool>(nullable: false),
AllowRememberConsent = table.Column<bool>(nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(nullable: false),
RequirePkce = table.Column<bool>(nullable: false),
AllowPlainTextPkce = table.Column<bool>(nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(nullable: false),
FrontChannelLogoutUri = table.Column<string>(maxLength: 300, nullable: true),
FrontChannelLogoutSessionRequired = table.Column<bool>(nullable: false),
BackChannelLogoutUri = table.Column<string>(maxLength: 300, nullable: true),
BackChannelLogoutSessionRequired = table.Column<bool>(nullable: false),
AllowOfflineAccess = table.Column<bool>(nullable: false),
IdentityTokenLifetime = table.Column<int>(nullable: false),
AccessTokenLifetime = table.Column<int>(nullable: false),
AuthorizationCodeLifetime = table.Column<int>(nullable: false),
ConsentLifetime = table.Column<int>(nullable: true),
AbsoluteRefreshTokenLifetime = table.Column<int>(nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(nullable: false),
RefreshTokenUsage = table.Column<int>(nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(nullable: false),
RefreshTokenExpiration = table.Column<int>(nullable: false),
AccessTokenType = table.Column<int>(nullable: false),
EnableLocalLogin = table.Column<bool>(nullable: false),
IncludeJwtId = table.Column<bool>(nullable: false),
AlwaysSendClientClaims = table.Column<bool>(nullable: false),
ClientClaimsPrefix = table.Column<string>(maxLength: 200, nullable: true),
PairWiseSubjectSalt = table.Column<string>(maxLength: 200, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClients", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityServerIdentityResources",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Enabled = table.Column<bool>(nullable: false),
Required = table.Column<bool>(nullable: false),
Emphasize = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityServerPersistedGrants",
columns: table => new
{
Key = table.Column<string>(maxLength: 200, nullable: false),
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Type = table.Column<string>(maxLength: 50, nullable: false),
SubjectId = table.Column<string>(maxLength: 200, nullable: true),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
CreationTime = table.Column<DateTime>(nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
Data = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key);
});
migrationBuilder.CreateTable(
name: "AbpAuditLogActions",
columns: table => new
@ -364,6 +504,253 @@ namespace Acme.BookStore.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerApiClaims",
columns: table => new
{
Type = table.Column<string>(maxLength: 196, nullable: false),
ApiResourceId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type });
table.ForeignKey(
name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "IdentityServerApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerApiScopes",
columns: table => new
{
ApiResourceId = table.Column<Guid>(nullable: false),
Name = table.Column<string>(maxLength: 196, nullable: false),
DisplayName = table.Column<string>(maxLength: 128, nullable: true),
Description = table.Column<string>(maxLength: 256, nullable: true),
Required = table.Column<bool>(nullable: false),
Emphasize = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name });
table.ForeignKey(
name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "IdentityServerApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerApiSecrets",
columns: table => new
{
Type = table.Column<string>(maxLength: 32, nullable: false),
Value = table.Column<string>(maxLength: 196, nullable: false),
ApiResourceId = table.Column<Guid>(nullable: false),
Description = table.Column<string>(maxLength: 256, nullable: true),
Expiration = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value });
table.ForeignKey(
name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "IdentityServerApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientClaims",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
Type = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 250, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value });
table.ForeignKey(
name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientCorsOrigins",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
Origin = table.Column<string>(maxLength: 150, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin });
table.ForeignKey(
name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientGrantTypes",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
GrantType = table.Column<string>(maxLength: 196, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType });
table.ForeignKey(
name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientIdPRestrictions",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
Provider = table.Column<string>(maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider });
table.ForeignKey(
name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientPostLogoutRedirectUris",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
PostLogoutRedirectUri = table.Column<string>(maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri });
table.ForeignKey(
name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientProperties",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
Key = table.Column<string>(maxLength: 64, nullable: false),
Value = table.Column<string>(maxLength: 128, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key });
table.ForeignKey(
name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientRedirectUris",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
RedirectUri = table.Column<string>(maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri });
table.ForeignKey(
name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientScopes",
columns: table => new
{
ClientId = table.Column<Guid>(nullable: false),
Scope = table.Column<string>(maxLength: 196, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope });
table.ForeignKey(
name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerClientSecrets",
columns: table => new
{
Type = table.Column<string>(maxLength: 32, nullable: false),
Value = table.Column<string>(maxLength: 196, nullable: false),
ClientId = table.Column<Guid>(nullable: false),
Description = table.Column<string>(maxLength: 256, nullable: true),
Expiration = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value });
table.ForeignKey(
name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId",
column: x => x.ClientId,
principalTable: "IdentityServerClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerIdentityClaims",
columns: table => new
{
Type = table.Column<string>(maxLength: 196, nullable: false),
IdentityResourceId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type });
table.ForeignKey(
name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityServerIdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpEntityPropertyChanges",
columns: table => new
@ -387,6 +774,25 @@ namespace Acme.BookStore.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityServerApiScopeClaims",
columns: table => new
{
Type = table.Column<string>(maxLength: 196, nullable: false),
ApiResourceId = table.Column<Guid>(nullable: false),
Name = table.Column<string>(maxLength: 196, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type });
table.ForeignKey(
name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name",
columns: x => new { x.ApiResourceId, x.Name },
principalTable: "IdentityServerApiScopes",
principalColumns: new[] { "ApiResourceId", "Name" },
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpAuditLogActions_AuditLogId",
table: "AbpAuditLogActions",
@ -427,6 +833,11 @@ namespace Acme.BookStore.Migrations
table: "AbpEntityPropertyChanges",
column: "EntityChangeId");
migrationBuilder.CreateIndex(
name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey",
table: "AbpFeatureValues",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey",
table: "AbpPermissionGrants",
@ -487,6 +898,17 @@ namespace Acme.BookStore.Migrations
name: "IX_AbpUsers_UserName",
table: "AbpUsers",
column: "UserName");
migrationBuilder.CreateIndex(
name: "IX_IdentityServerClients_ClientId",
table: "IdentityServerClients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type",
table: "IdentityServerPersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
@ -503,6 +925,9 @@ namespace Acme.BookStore.Migrations
migrationBuilder.DropTable(
name: "AbpEntityPropertyChanges");
migrationBuilder.DropTable(
name: "AbpFeatureValues");
migrationBuilder.DropTable(
name: "AbpPermissionGrants");
@ -527,6 +952,48 @@ namespace Acme.BookStore.Migrations
migrationBuilder.DropTable(
name: "AbpUserTokens");
migrationBuilder.DropTable(
name: "IdentityServerApiClaims");
migrationBuilder.DropTable(
name: "IdentityServerApiScopeClaims");
migrationBuilder.DropTable(
name: "IdentityServerApiSecrets");
migrationBuilder.DropTable(
name: "IdentityServerClientClaims");
migrationBuilder.DropTable(
name: "IdentityServerClientCorsOrigins");
migrationBuilder.DropTable(
name: "IdentityServerClientGrantTypes");
migrationBuilder.DropTable(
name: "IdentityServerClientIdPRestrictions");
migrationBuilder.DropTable(
name: "IdentityServerClientPostLogoutRedirectUris");
migrationBuilder.DropTable(
name: "IdentityServerClientProperties");
migrationBuilder.DropTable(
name: "IdentityServerClientRedirectUris");
migrationBuilder.DropTable(
name: "IdentityServerClientScopes");
migrationBuilder.DropTable(
name: "IdentityServerClientSecrets");
migrationBuilder.DropTable(
name: "IdentityServerIdentityClaims");
migrationBuilder.DropTable(
name: "IdentityServerPersistedGrants");
migrationBuilder.DropTable(
name: "AbpEntityChanges");
@ -539,8 +1006,20 @@ namespace Acme.BookStore.Migrations
migrationBuilder.DropTable(
name: "AbpUsers");
migrationBuilder.DropTable(
name: "IdentityServerApiScopes");
migrationBuilder.DropTable(
name: "IdentityServerClients");
migrationBuilder.DropTable(
name: "IdentityServerIdentityResources");
migrationBuilder.DropTable(
name: "AbpAuditLogs");
migrationBuilder.DropTable(
name: "IdentityServerApiResources");
}
}
}

661
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.Designer.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603113122_Created_Book_Entity.Designer.cs

@ -1,26 +1,65 @@
// <auto-generated />
using System;
using Acme.BookStore.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Acme.BookStore.EntityFrameworkCore;
namespace Acme.BookStore.Migrations
{
[DbContext(typeof(BookStoreMigrationsDbContext))]
[Migration("20190402131334_Initial")]
partial class Initial
[Migration("20190603113122_Created_Book_Entity")]
partial class Created_Book_Entity
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Acme.BookStore.Book", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<float>("Price");
b.Property<DateTime>("PublishDate");
b.Property<int>("Type");
b.HasKey("Id");
b.ToTable("AppBooks");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")
@ -265,6 +304,32 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpBackgroundJobs");
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128);
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpFeatureValues");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
@ -563,6 +628,482 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.ToTable("IdentityServerApiResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Type");
b.ToTable("IdentityServerApiClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<string>("DisplayName")
.HasMaxLength(128);
b.Property<bool>("Emphasize");
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("ApiResourceId", "Name");
b.ToTable("IdentityServerApiScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Name", "Type");
b.ToTable("IdentityServerApiScopeClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ApiResourceId", "Type", "Value");
b.ToTable("IdentityServerApiSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AbsoluteRefreshTokenLifetime");
b.Property<int>("AccessTokenLifetime");
b.Property<int>("AccessTokenType");
b.Property<bool>("AllowAccessTokensViaBrowser");
b.Property<bool>("AllowOfflineAccess");
b.Property<bool>("AllowPlainTextPkce");
b.Property<bool>("AllowRememberConsent");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken");
b.Property<bool>("AlwaysSendClientClaims");
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(300);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasMaxLength(300);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<int?>("ConsentLifetime");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(300);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("LogoUri")
.HasMaxLength(300);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration");
b.Property<int>("RefreshTokenUsage");
b.Property<bool>("RequireClientSecret");
b.Property<bool>("RequireConsent");
b.Property<bool>("RequirePkce");
b.Property<int>("SlidingRefreshTokenLifetime");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("IdentityServerClients");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.HasMaxLength(250);
b.HasKey("ClientId", "Type", "Value");
b.ToTable("IdentityServerClientClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Origin")
.HasMaxLength(150);
b.HasKey("ClientId", "Origin");
b.ToTable("IdentityServerClientCorsOrigins");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("GrantType")
.HasMaxLength(196);
b.HasKey("ClientId", "GrantType");
b.ToTable("IdentityServerClientGrantTypes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Provider")
.HasMaxLength(64);
b.HasKey("ClientId", "Provider");
b.ToTable("IdentityServerClientIdPRestrictions");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("PostLogoutRedirectUri")
.HasMaxLength(200);
b.HasKey("ClientId", "PostLogoutRedirectUri");
b.ToTable("IdentityServerClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Key")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128);
b.HasKey("ClientId", "Key");
b.ToTable("IdentityServerClientProperties");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("RedirectUri")
.HasMaxLength(200);
b.HasKey("ClientId", "RedirectUri");
b.ToTable("IdentityServerClientRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Scope")
.HasMaxLength(196);
b.HasKey("ClientId", "Scope");
b.ToTable("IdentityServerClientScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ClientId", "Type", "Value");
b.ToTable("IdentityServerClientSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired();
b.Property<DateTime?>("Expiration");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type");
b.ToTable("IdentityServerPersistedGrants");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.Property<Guid>("IdentityResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("IdentityResourceId", "Type");
b.ToTable("IdentityServerIdentityClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.ToTable("IdentityServerIdentityResources");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
@ -747,6 +1288,118 @@ namespace Acme.BookStore.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId", "Name")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.HasOne("Volo.Abp.TenantManagement.Tenant")

2
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190416070050_Created_Book_Entity.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190603113122_Created_Book_Entity.cs

@ -19,7 +19,7 @@ namespace Acme.BookStore.Migrations
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
Name = table.Column<string>(maxLength: 128, nullable: false),
Type = table.Column<byte>(nullable: false),
Type = table.Column<int>(nullable: false),
PublishDate = table.Column<DateTime>(nullable: false),
Price = table.Column<float>(nullable: false)
},

634
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs

@ -15,7 +15,7 @@ namespace Acme.BookStore.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@ -24,18 +24,24 @@ namespace Acme.BookStore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
@ -45,7 +51,7 @@ namespace Acme.BookStore.Migrations
b.Property<DateTime>("PublishDate");
b.Property<byte>("Type");
b.Property<int>("Type");
b.HasKey("Id");
@ -296,6 +302,32 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpBackgroundJobs");
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128);
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpFeatureValues");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
@ -594,6 +626,482 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.ToTable("IdentityServerApiResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Type");
b.ToTable("IdentityServerApiClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<string>("DisplayName")
.HasMaxLength(128);
b.Property<bool>("Emphasize");
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("ApiResourceId", "Name");
b.ToTable("IdentityServerApiScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Name")
.HasMaxLength(196);
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("ApiResourceId", "Name", "Type");
b.ToTable("IdentityServerApiScopeClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ApiResourceId", "Type", "Value");
b.ToTable("IdentityServerApiSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AbsoluteRefreshTokenLifetime");
b.Property<int>("AccessTokenLifetime");
b.Property<int>("AccessTokenType");
b.Property<bool>("AllowAccessTokensViaBrowser");
b.Property<bool>("AllowOfflineAccess");
b.Property<bool>("AllowPlainTextPkce");
b.Property<bool>("AllowRememberConsent");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken");
b.Property<bool>("AlwaysSendClientClaims");
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(300);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasMaxLength(300);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<int?>("ConsentLifetime");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(300);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("LogoUri")
.HasMaxLength(300);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration");
b.Property<int>("RefreshTokenUsage");
b.Property<bool>("RequireClientSecret");
b.Property<bool>("RequireConsent");
b.Property<bool>("RequirePkce");
b.Property<int>("SlidingRefreshTokenLifetime");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("IdentityServerClients");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.HasMaxLength(250);
b.HasKey("ClientId", "Type", "Value");
b.ToTable("IdentityServerClientClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Origin")
.HasMaxLength(150);
b.HasKey("ClientId", "Origin");
b.ToTable("IdentityServerClientCorsOrigins");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("GrantType")
.HasMaxLength(196);
b.HasKey("ClientId", "GrantType");
b.ToTable("IdentityServerClientGrantTypes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Provider")
.HasMaxLength(64);
b.HasKey("ClientId", "Provider");
b.ToTable("IdentityServerClientIdPRestrictions");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("PostLogoutRedirectUri")
.HasMaxLength(200);
b.HasKey("ClientId", "PostLogoutRedirectUri");
b.ToTable("IdentityServerClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Key")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128);
b.HasKey("ClientId", "Key");
b.ToTable("IdentityServerClientProperties");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("RedirectUri")
.HasMaxLength(200);
b.HasKey("ClientId", "RedirectUri");
b.ToTable("IdentityServerClientRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Scope")
.HasMaxLength(196);
b.HasKey("ClientId", "Scope");
b.ToTable("IdentityServerClientScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.HasMaxLength(32);
b.Property<string>("Value")
.HasMaxLength(196);
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<DateTime?>("Expiration");
b.HasKey("ClientId", "Type", "Value");
b.ToTable("IdentityServerClientSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired();
b.Property<DateTime?>("Expiration");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type");
b.ToTable("IdentityServerPersistedGrants");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.Property<Guid>("IdentityResourceId");
b.Property<string>("Type")
.HasMaxLength(196);
b.HasKey("IdentityResourceId", "Type");
b.ToTable("IdentityServerIdentityClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<bool>("Enabled");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.ToTable("IdentityServerIdentityResources");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
@ -778,6 +1286,118 @@ namespace Acme.BookStore.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId", "Name")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.HasOne("Volo.Abp.TenantManagement.Tenant")

5
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
@ -9,14 +9,15 @@
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.17.0.0" />
</ItemGroup>
</Project>

13
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs

@ -7,6 +7,15 @@ 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>
{
@ -14,6 +23,10 @@ namespace Acme.BookStore.EntityFrameworkCore
public DbSet<Book> Books { get; set; }
/* Add DbSet properties for your Aggregate Roots / Entities here.
* Also map them inside BookStoreDbContextModelCreatingExtensions.ConfigureBookStore
*/
public BookStoreDbContext(DbContextOptions<BookStoreDbContext> options)
: base(options)
{

7
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContextModelCreatingExtensions.cs

@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Volo.Abp;
using Volo.Abp.Users;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.Users;
namespace Acme.BookStore.EntityFrameworkCore
{
@ -17,7 +17,12 @@ namespace Acme.BookStore.EntityFrameworkCore
builder.Entity<Book>(b =>
{
b.ToTable(BookStoreConsts.DbTablePrefix + "Books", BookStoreConsts.DbSchema);
b.ConfigureAudited();
b.ConfigureExtraProperties();
b.ConfigureConcurrencyStamp();
b.Property(x => x.Name).IsRequired().HasMaxLength(128);
});
}

13
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs

@ -1,9 +1,11 @@
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;
@ -14,6 +16,7 @@ namespace Acme.BookStore.EntityFrameworkCore
[DependsOn(
typeof(BookStoreDomainModule),
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpIdentityServerEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
@ -28,9 +31,17 @@ namespace Acme.BookStore.EntityFrameworkCore
{
context.Services.AddAbpDbContext<BookStoreDbContext>(options =>
{
//Remove "includeAllEntities: true" to create default repositories only for aggregate roots
/* 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();
});
}
}
}

21
samples/BookStore/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj

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

29
samples/BookStore/src/Acme.BookStore.HttpApi.Client/BookStoreHttpApiClientModule.cs

@ -0,0 +1,29 @@
using Microsoft.Extensions.DependencyInjection;
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(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
);
}
}
}

21
samples/BookStore/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj

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

20
samples/BookStore/src/Acme.BookStore.HttpApi/BookStoreHttpApiModule.cs

@ -0,0 +1,20 @@
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(AbpIdentityHttpApiModule),
typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpTenantManagementHttpApiModule),
typeof(AbpFeatureManagementHttpApiModule)
)]
public class BookStoreHttpApiModule : AbpModule
{
}
}

13
samples/BookStore/src/Acme.BookStore.HttpApi/Controllers/BookStoreController.cs

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

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

@ -0,0 +1,28 @@
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/BookStore/src/Acme.BookStore.HttpApi/Models/Test/TestModel.cs

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

16
samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj

@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Acme.BookStore</RootNamespace>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
@ -20,26 +19,25 @@
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup>
<None Include="Pages\Books\CreateModal.cshtml" />
<None Include="Pages\Books\EditModal.cshtml" />
<None Include="Pages\Books\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
</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" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Identity.Web" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Account.Web" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Web" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Web" Version="0.17.0.0" />
</ItemGroup>

2
samples/BookStore/src/Acme.BookStore.Web/Branding/BookStoreBrandingProvider.cs → samples/BookStore/src/Acme.BookStore.Web/BookStoreBrandingProvider.cs

@ -1,7 +1,7 @@
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.Branding
namespace Acme.BookStore.Web
{
[Dependency(ReplaceServices = true)]
public class BookStoreBrandingProvider : DefaultBrandingProvider

4
samples/BookStore/src/Acme.BookStore.Web/BookStoreWebAutoMapperProfile.cs

@ -1,12 +1,12 @@
using AutoMapper;
namespace Acme.BookStore
namespace Acme.BookStore.Web
{
public class BookStoreWebAutoMapperProfile : Profile
{
public BookStoreWebAutoMapperProfile()
{
//Configure your AutoMapper mapping configuration here...
CreateMap<BookDto, CreateUpdateBookDto>();
}
}
}

91
samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs

@ -1,50 +1,42 @@
using System.IO;
using System.Linq;
using Acme.BookStore.EntityFrameworkCore;
using Acme.BookStore.Localization;
using Acme.BookStore.MultiTenancy;
using Acme.BookStore.Web.Menus;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Acme.BookStore.EntityFrameworkCore;
using Acme.BookStore.Localization.BookStore;
using Acme.BookStore.Menus;
using Acme.BookStore.Permissions;
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.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.Data;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.Web;
using Volo.Abp.Threading;
using Volo.Abp.UI;
using Volo.Abp.TenantManagement.Web;
using Volo.Abp.UI.Navigation;
using Volo.Abp.Ui.Navigation.Urls;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.PermissionManagement;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.TenantManagement.Web;
namespace Acme.BookStore
namespace Acme.BookStore.Web
{
[DependsOn(
typeof(BookStoreHttpApiModule),
typeof(BookStoreApplicationModule),
typeof(BookStoreEntityFrameworkCoreModule),
typeof(BookStoreEntityFrameworkCoreDbMigrationsModule),
typeof(AbpAutofacModule),
typeof(AbpIdentityWebModule),
typeof(AbpAccountWebModule),
typeof(AbpAccountWebIdentityServerModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpTenantManagementWebModule)
)]
public class BookStoreWebModule : AbpModule
@ -56,7 +48,9 @@ namespace Acme.BookStore
options.AddAssemblyResource(
typeof(BookStoreResource),
typeof(BookStoreDomainModule).Assembly,
typeof(BookStoreDomainSharedModule).Assembly,
typeof(BookStoreApplicationModule).Assembly,
typeof(BookStoreApplicationContractsModule).Assembly,
typeof(BookStoreWebModule).Assembly
);
});
@ -67,7 +61,8 @@ namespace Acme.BookStore
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
ConfigureDatabaseServices();
ConfigureUrls(configuration);
ConfigureAuthentication(context, configuration);
ConfigureAutoMapper();
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureLocalizationServices();
@ -76,18 +71,34 @@ namespace Acme.BookStore
ConfigureSwaggerServices(context.Services);
}
private void ConfigureDatabaseServices()
private void ConfigureUrls(IConfigurationRoot configuration)
{
Configure<AbpDbContextOptions>(options =>
Configure<AppUrlOptions>(options =>
{
options.UseSqlServer();
options.Applications["MVC"].RootUrl = configuration["AppSelfUrl"];
});
}
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration)
{
context.Services.AddAuthentication()
.AddIdentityServerAuthentication(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = false;
options.ApiName = "BookStore";
});
}
private void ConfigureAutoMapper()
{
Configure<AbpAutoMapperOptions>(options =>
{
/* use `true` for the `validate` parameter if you want to
* validate the profile on application startup.
* See http://docs.automapper.org/en/stable/Configuration-validation.html for more
* about configuration validation.
*/
options.AddProfile<BookStoreWebAutoMapperProfile>();
});
}
@ -98,7 +109,11 @@ namespace Acme.BookStore
{
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}Acme.BookStore.Domain.Shared", Path.DirectorySeparatorChar)));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}Acme.BookStore.Domain", Path.DirectorySeparatorChar)));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}Acme.BookStore.Application.Contracts", Path.DirectorySeparatorChar)));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreApplicationModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}Acme.BookStore.Application", Path.DirectorySeparatorChar)));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreWebModule>(hostingEnvironment.ContentRootPath);
});
}
}
@ -110,7 +125,6 @@ namespace Acme.BookStore
options.Resources
.Get<BookStoreResource>()
.AddBaseTypes(
typeof(AbpValidationResource),
typeof(AbpUiResource)
);
@ -146,7 +160,8 @@ namespace Acme.BookStore
options.SwaggerDoc("v1", new Info { Title = "BookStore API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
}
);
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
@ -165,38 +180,22 @@ namespace Acme.BookStore
app.UseVirtualFiles();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
if (BookStoreConsts.IsMultiTenancyEnabled)
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseIdentityServer();
app.UseAbpRequestLocalization();
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "BookStore API");
});
app.UseAuditing();
app.UseMvcWithDefaultRouteAndArea();
SeedDatabase(context);
}
private static void SeedDatabase(ApplicationInitializationContext context)
{
using (var scope = context.ServiceProvider.CreateScope())
{
AsyncHelper.RunSync(async () =>
{
await scope.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync();
});
}
}
}
}

12
samples/BookStore/src/Acme.BookStore.Web/Menus/BookStoreMenuContributor.cs

@ -1,11 +1,12 @@
using System.Threading.Tasks;
using Acme.BookStore.Localization;
using Acme.BookStore.MultiTenancy;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Acme.BookStore.Localization.BookStore;
using Volo.Abp.TenantManagement.Web.Navigation;
using Volo.Abp.UI.Navigation;
namespace Acme.BookStore.Menus
namespace Acme.BookStore.Web.Menus
{
public class BookStoreMenuContributor : IMenuContributor
{
@ -19,19 +20,20 @@ namespace Acme.BookStore.Menus
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
if (!BookStoreConsts.IsMultiTenancyEnabled)
if (!MultiTenancyConsts.IsEnabled)
{
ApplicationMenuItem administration = context.Menu.GetAdministration();
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"], "/"));
context.Menu.AddItem(
new ApplicationMenuItem("BooksStore", l["Menu:BookStore"])
.AddItem(new ApplicationMenuItem("BooksStore.Books", l["Menu:Books"], url: "/Books"))
);
);
}
}
}

6
samples/BookStore/src/Acme.BookStore.Web/Pages/BookStorePageBase.cs

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc.Localization;
using Acme.BookStore.Localization;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Acme.BookStore.Localization.BookStore;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Acme.BookStore.Pages
namespace Acme.BookStore.Web.Pages
{
public abstract class BookStorePageBase : AbpPage
{

4
samples/BookStore/src/Acme.BookStore.Web/Pages/BookStorePageModelBase.cs

@ -1,7 +1,7 @@
using Acme.BookStore.Localization.BookStore;
using Acme.BookStore.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Acme.BookStore.Pages
namespace Acme.BookStore.Web.Pages
{
public abstract class BookStorePageModelBase : AbpPageModel
{

4
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/CreateModal.cshtml

@ -1,7 +1,7 @@
@page
@inherits Acme.BookStore.Pages.BookStorePageBase
@inherits Acme.BookStore.Web.Pages.BookStorePageBase
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Pages.Books.CreateModalModel
@model Acme.BookStore.Web.Pages.Books.CreateModalModel
@{
Layout = null;
}

4
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/CreateModal.cshtml.cs

@ -1,7 +1,7 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Acme.BookStore.Pages.Books
namespace Acme.BookStore.Web.Pages.Books
{
public class CreateModalModel : BookStorePageModelBase
{

4
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml

@ -1,6 +1,6 @@
@page
@inherits Acme.BookStore.Pages.BookStorePageBase
@using Acme.BookStore.Pages.Books
@inherits Acme.BookStore.Web.Pages.BookStorePageBase
@using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel
@{

2
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml.cs

@ -2,7 +2,7 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Acme.BookStore.Pages.Books
namespace Acme.BookStore.Web.Pages.Books
{
public class EditModalModel : BookStorePageModelBase
{

23
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/Index.cshtml

@ -1,9 +1,8 @@
@page
@using Acme.BookStore.Pages.Books
@inherits Acme.BookStore.Pages.BookStorePageBase
@model IndexModel
@inherits Acme.BookStore.Web.Pages.BookStorePageBase
@model Acme.BookStore.Web.Pages.Books.IndexModel
@section scripts
{
{
<abp-script src="/Pages/Books/index.js" />
}
<abp-card>
@ -23,14 +22,14 @@
<abp-card-body>
<abp-table striped-rows="true" id="BooksTable">
<thead>
<tr>
<th>@L["Actions"]</th>
<th>@L["Name"]</th>
<th>@L["Type"]</th>
<th>@L["PublishDate"]</th>
<th>@L["Price"]</th>
<th>@L["CreationTime"]</th>
</tr>
<tr>
<th>@L["Actions"]</th>
<th>@L["Name"]</th>
<th>@L["Type"]</th>
<th>@L["PublishDate"]</th>
<th>@L["Price"]</th>
<th>@L["CreationTime"]</th>
</tr>
</thead>
</abp-table>
</abp-card-body>

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

@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Acme.BookStore.Pages.Books
namespace Acme.BookStore.Web.Pages.Books
{
public class IndexModel : PageModel
{
public void OnGet()
{
}
}
}

40
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/index.js

@ -18,28 +18,28 @@
{
rowAction: {
items:
[
{
text: l('Edit'),
action: function (data) {
editModal.open({ id: data.record.id });
}
},
{
text: l('Delete'),
confirmMessage: function (data) {
return l('BookDeletionConfirmationMessage', data.record.name);
[
{
text: l('Edit'),
action: function (data) {
editModal.open({ id: data.record.id });
}
},
action: function (data) {
acme.bookStore.book
.delete(data.record.id)
.then(function() {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
{
text: l('Delete'),
confirmMessage: function (data) {
return l('BookDeletionConfirmationMessage', data.record.name);
},
action: function (data) {
acme.bookStore.book
.delete(data.record.id)
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
}
}
}
]
]
}
},
{ data: "name" },

18
samples/BookStore/src/Acme.BookStore.Web/Pages/Index.cshtml

@ -1,9 +1,15 @@
@page
@using Acme.BookStore.Pages
@inherits BookStorePageBase
@model IndexModel
@inherits Acme.BookStore.Web.Pages.BookStorePageBase
@model Acme.BookStore.Web.Pages.IndexModel
@section styles {
<link href="~/pages/index.css" rel="stylesheet" />
<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>
}
<abp-card>
<abp-card-header>@L["Welcome"]</abp-card-header>
@ -13,7 +19,7 @@
{
<p><a abp-button="Primary" href="/Account/Login"><i class="fa fa-sign-in"></i> @L["Login"]</a></p>
}
<hr/>
<p class="text-right"><a href="http://abp.io?ref=tmpl" target="_blank">abp.io</a></p>
<hr />
<p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p>
</abp-card-body>
</abp-card>

2
samples/BookStore/src/Acme.BookStore.Web/Pages/Index.cshtml.cs

@ -1,4 +1,4 @@
namespace Acme.BookStore.Pages
namespace Acme.BookStore.Web.Pages
{
public class IndexModel : BookStorePageModelBase
{

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

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

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

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

8
samples/BookStore/src/Acme.BookStore.Web/Program.cs

@ -4,14 +4,18 @@ using Microsoft.AspNetCore.Hosting;
using Serilog;
using Serilog.Events;
namespace Acme.BookStore
namespace Acme.BookStore.Web
{
public class Program
{
public static int Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug() //TODO: Should be configurable!
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.File("Logs/logs.txt")

2
samples/BookStore/src/Acme.BookStore.Web/Properties/launchSettings.json

@ -4,7 +4,7 @@
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53929/",
"sslPort": 0
"sslPort": 44361
}
},
"profiles": {

2
samples/BookStore/src/Acme.BookStore.Web/Startup.cs

@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp;
namespace Acme.BookStore
namespace Acme.BookStore.Web
{
public class Startup
{

1
samples/BookStore/src/Acme.BookStore.Web/Views/_ViewImports.cshtml

@ -1,3 +1,4 @@
@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

2
samples/BookStore/src/Acme.BookStore.Web/abp.resourcemapping.js

@ -5,4 +5,4 @@
mappings: {
}
}
};

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

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

11
samples/BookStore/src/Acme.BookStore.Web/appsettings.json

@ -1,5 +1,16 @@
{
"AppSelfUrl": "https://localhost:44361",
"ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"AuthServer": {
"Authority": "https://localhost:44361"
},
"IdentityServer": {
"Clients": {
"BookStore_ConsoleTestApp": {
"ClientId": "BookStore_ConsoleTestApp"
}
}
}
}

6
samples/BookStore/src/Acme.BookStore.Web/compilerconfig.json

@ -1,6 +0,0 @@
[
{
"outputFile": "wwwroot/pages/index.css",
"inputFile": "wwwroot/pages/index.scss"
}
]

49
samples/BookStore/src/Acme.BookStore.Web/compilerconfig.json.defaults

@ -1,49 +0,0 @@
{
"compilers": {
"less": {
"autoPrefix": "",
"cssComb": "none",
"ieCompat": true,
"strictMath": false,
"strictUnits": false,
"relativeUrls": true,
"rootPath": "",
"sourceMapRoot": "",
"sourceMapBasePath": "",
"sourceMap": false
},
"sass": {
"includePath": "",
"indentType": "space",
"indentWidth": 2,
"outputStyle": "nested",
"Precision": 5,
"relativeUrls": true,
"sourceMapRoot": "",
"sourceMap": false
},
"stylus": {
"sourceMap": false
},
"babel": {
"sourceMap": false
},
"coffeescript": {
"bare": false,
"runtimeMode": "node",
"sourceMap": false
}
},
"minifiers": {
"css": {
"enabled": true,
"termSemicolons": true,
"gzip": false
},
"javascript": {
"enabled": true,
"termSemicolons": true,
"gzip": false
}
}
}

4
samples/BookStore/src/Acme.BookStore.Web/package.json

@ -1,6 +1,6 @@
{
"version": "0.1.0",
"name": "Acme.BookStore",
"version": "1.0.0",
"name": "my-app",
"private": true,
"dependencies": {
"@abp/aspnetcore.mvc.ui.theme.basic": "^0.4.9"

1
samples/BookStore/src/Acme.BookStore.Web/tempkey.rsa

@ -0,0 +1 @@
{"KeyId":"ac0d2edf3c04d13cd95cc41b9b33ab03","Parameters":{"D":"FFymEWbX3XBT5YnTngOKwtz3XKsyaQbyDvvw9jbmkdvLKUmrb1hkmylqVYwU/3G1u79rrD8AZXJDoYVLegyZymK/iNeePMLI4i5vScF7PdQXn/g6CvQ8j3J60YYyfDWuxjBH8nCEUIfQIv14BpcH6CWi1BVZUbnbWcpe2ji8D5I3FHOZpvksQztst5eE836ODdN9jgk35kgrdUQ14MEFHA6m6fAzvFI1csFxD3Kwej4rI8RYZ0WYLkndz9ID88+v9VxqI8+wN6wR6tIOR510uT1FI5wONBVBUzgeZ6cCEpg0jC9tgqcP03gMDpmE7vKp34ExxH/iOWyhQ0gAxHOVlQ==","DP":"qSQfNZvEkepgY12d+uwTbRoOp+0g1CBiMU9kqyoIB56hAUnzENSCDzunjLRrvDLFPgXiUcoccskyVRnKKOGPOqPE6VjgzBrdLgA/hBf8hPg0GnTVoPyLxR9G6GsGUKsAYVn8G7cnK5wXzK4jCjsflkfxCzFfdASJ/+sa5QPWZMM=","DQ":"u+56T1+rhMvlurid9kBS2Ypfm4vOiNAXLD9kGz2wx8Ob0yYlWo55kn11qPs6Ej9bnQIY3N+TY2tXMamfhAhntoHaKrFjOpCmlHZ0GAeQOJVuWSlFvu/NBoxfjZzcUCNua22oJjy++wSdkkLLGEqau62byaQoSSqUxUzwL36RexM=","Exponent":"AQAB","InverseQ":"E+uq9g6D5LjUk+M7gtt0srnT8duwu8P83AgFqjtGOnSCy71omSboxb4zC9bGq/WaEFauFBwqxbkXwFyXuYNfIelfmSERulU9jgf0+KH6QmFdtjrJ5UO7VArqET1WUquwiDvOyO8udCxi8RRAiM5G3dTzIs5JTalGhlKEZSAgPtQ=","Modulus":"rgHACxzqvuE72RF/NdDTLsIEy3F/n6P4lkgrER60FU8uRNwSmAMRxvxYOaE3Ot/krRYcw2+MP8ewR1VBXywXVT1zuACA3SacMHJYmZQ2UkuwsD9bmpjvqoMhR/hjsI74jTzKpclHtEu7D7WYDZaIPAEIs/8+5H/z1mXVfgACaeaQt3C0OhwXSOPPDP71VKGfoFucXYED1keZ0PKxYAlhiHOe7cnSlfJseujwD2Rhyq8mUhe6aEMTYBjuruWgpfvnSOARAqu5vwzK35KpAirHwa1DJSZyanNMFdlLkVNKWUKEqd6PwRneiHacmaaDF6oQQstuSbf9cuJeSMbKh7WVQQ==","P":"0CJDit2NHk0Z1bN5ZVIYZRUYbrAI2bEOafAKqfffcA/Os7yXsY14Ye4pSpDxfdZGcPGRL04HPkJsogFtyI7k4ujrvsC66I5cg45+BhBMM0zyLJ7LZkD2HGwX2+a/xrXhhIIOnGWWy2zzW3dkayRhi1bR9krfTA5uBw1LX9qZ3Yc=","Q":"1gZITAaB+r0+PgOfyDCeVzSnTyQuKSkgbUkIgQP9jQZa6edrbAXogdJipxmUTrW7JaxifG1z9ubK+TOqhjZHqT4gd8U8Bh7jCBizZNVe60pez1OtNGpEOW2N+ZrXBSMNcV8PFaMg/B+fcaX+i7NWpTqmztR/V0DGXmD+XosuaPc="}}

1
samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/index.css

@ -1 +0,0 @@


1
samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/index.min.css

@ -1 +0,0 @@


3
samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/index.scss

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

13
samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj

@ -9,20 +9,11 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Acme.BookStore.Application\Acme.BookStore.Application.csproj" />
<PackageReference Include="Volo.Abp.TestBase" Version="0.16.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.16.0" />
<ProjectReference Include="..\..\src\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" />
<ProjectReference Include="..\Acme.BookStore.Domain.Tests\Acme.BookStore.Domain.Tests.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
</ItemGroup>
</Project>

11
samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreApplicationTestBase.cs

@ -1,12 +1,7 @@
using Volo.Abp;
namespace Acme.BookStore
namespace Acme.BookStore
{
public abstract class BookStoreApplicationTestBase : AbpIntegratedTest<BookStoreApplicationTestModule>
public abstract class BookStoreApplicationTestBase : BookStoreTestBase<BookStoreApplicationTestModule>
{
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
{
options.UseAutofac();
}
}
}

69
samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreApplicationTestModule.cs

@ -1,78 +1,13 @@
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.DependencyInjection;
using Acme.BookStore.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Autofac;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
using Volo.Abp.Modularity;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreApplicationModule),
typeof(BookStoreEntityFrameworkCoreModule),
typeof(AbpAutofacModule),
typeof(AbpTestBaseModule)
typeof(BookStoreDomainTestModule)
)]
public class BookStoreApplicationTestModule : AbpModule
{
private SqliteConnection _sqliteConnection;
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAlwaysAllowAuthorization();
ConfigureInMemorySqlite(context.Services);
}
private void ConfigureInMemorySqlite(IServiceCollection services)
{
_sqliteConnection = CreateDatabaseAndGetConnection();
services.Configure<AbpDbContextOptions>(options =>
{
options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); });
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
SeedTestData(context);
}
public override void OnApplicationShutdown(ApplicationShutdownContext context)
{
_sqliteConnection.Dispose();
}
private static SqliteConnection CreateDatabaseAndGetConnection()
{
var connection = new SqliteConnection("Data Source=:memory:");
connection.Open();
var options = new DbContextOptionsBuilder<BookStoreMigrationsDbContext>()
.UseSqlite(connection)
.Options;
using (var context = new BookStoreMigrationsDbContext(options))
{
context.GetService<IRelationalDatabaseCreator>().CreateTables();
}
return connection;
}
private static void SeedTestData(ApplicationInitializationContext context)
{
using (var scope = context.ServiceProvider.CreateScope())
{
scope.ServiceProvider
.GetRequiredService<BookStoreTestDataBuilder>()
.Build();
}
}
}
}

33
samples/BookStore/test/Acme.BookStore.Application.Tests/Samples/SampleAppServiceTests.cs

@ -0,0 +1,33 @@
using Shouldly;
using System.Threading.Tasks;
using Volo.Abp.Identity;
using Xunit;
namespace Acme.BookStore.Samples
{
/* This is just an example test class.
* Normally, you don't test code of the modules you are using
* (like IIdentityUserAppService here).
* Only test your own application services.
*/
public class SampleAppServiceTests : BookStoreApplicationTestBase
{
private readonly IIdentityUserAppService _userAppService;
public SampleAppServiceTests()
{
_userAppService = GetRequiredService<IIdentityUserAppService>();
}
[Fact]
public async Task Initial_Data_Should_Contain_Admin_User()
{
//Act
var result = await _userAppService.GetListAsync(new GetIdentityUsersInput());
//Assert
result.TotalCount.ShouldBeGreaterThan(0);
result.Items.ShouldContain(u => u.UserName == "admin");
}
}
}

59
samples/BookStore/test/Acme.BookStore.Application.Tests/Samples/SampleTests.cs

@ -1,59 +0,0 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Acme.BookStore.Users;
using Shouldly;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.Uow;
using Xunit;
namespace Acme.BookStore.Samples
{
public class SampleTests : BookStoreApplicationTestBase
{
private readonly IIdentityUserAppService _userAppService;
private readonly IRepository<AppUser, Guid> _appUserRepository;
private readonly IUnitOfWorkManager _unitOfWorkManager;
public SampleTests()
{
_userAppService = ServiceProvider.GetRequiredService<IIdentityUserAppService>();
_appUserRepository = ServiceProvider.GetRequiredService<IRepository<AppUser, Guid>>();
_unitOfWorkManager = ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
}
[Fact]
public async Task Initial_Data_Should_Contain_Admin_User()
{
//Act
var result = await _userAppService.GetListAsync(new GetIdentityUsersInput());
//Assert
result.TotalCount.ShouldBeGreaterThan(0);
result.Items.ShouldContain(u => u.UserName == "admin");
}
[Fact]
public async Task Should_Query_AppUser()
{
/* Need to manually start Unit Of Work because
* FirstOrDefaultAsync should be executed while db connection / context is available.
*/
using (var uow = _unitOfWorkManager.Begin())
{
//Act
var adminUser = await _appUserRepository
.Where(u => u.UserName == "admin")
.FirstOrDefaultAsync();
//Assert
adminUser.ShouldNotBeNull();
await uow.CompleteAsync();
}
}
}
}

18
samples/BookStore/test/Acme.BookStore.Domain.Tests/Acme.BookStore.Domain.Tests.csproj

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

7
samples/BookStore/test/Acme.BookStore.Domain.Tests/BookStoreDomainTestBase.cs

@ -0,0 +1,7 @@
namespace Acme.BookStore
{
public abstract class BookStoreDomainTestBase : BookStoreTestBase<BookStoreDomainTestModule>
{
}
}

13
samples/BookStore/test/Acme.BookStore.Domain.Tests/BookStoreDomainTestModule.cs

@ -0,0 +1,13 @@
using Acme.BookStore.EntityFrameworkCore;
using Volo.Abp.Modularity;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreEntityFrameworkCoreTestModule)
)]
public class BookStoreDomainTestModule : AbpModule
{
}
}

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

Loading…
Cancel
Save