Browse Source

Merge pull request #13 from dotnet-architecture/dev

PR to merge into skynode dev branch
pull/391/head
Dexter Valkyrie 7 years ago
committed by GitHub
parent
commit
4622c6543c
95 changed files with 1374 additions and 1509 deletions
  1. +55
    -1
      eShopOnContainers-ServicesAndWebApps.sln
  2. +60
    -54
      eShopOnContainers.sln
  3. BIN
      img/sf/cloud-config-idsrv.PNG
  4. BIN
      img/sf/cloud-config-mvc.PNG
  5. BIN
      img/sf/cloud-config-spa.PNG
  6. BIN
      img/sf/cloud-config.PNG
  7. BIN
      img/sf/explorer-apps-status.PNG
  8. BIN
      img/sf/explorer-deployment-status.PNG
  9. BIN
      img/sf/publish-button.PNG
  10. BIN
      img/sf/publish-window.PNG
  11. BIN
      img/sf/sf-directory.PNG
  12. +11
    -0
      src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj
  13. +40
    -0
      src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHostExtensions.cs
  14. +0
    -0
      src/Services/Basket/Basket.API/Model/CustomerBasket.cs
  15. +1
    -0
      src/Services/Catalog/Catalog.API/Catalog.API.csproj
  16. +13
    -0
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs
  17. +62
    -60
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  18. +18
    -2
      src/Services/Catalog/Catalog.API/Program.cs
  19. +7
    -42
      src/Services/Catalog/Catalog.API/Startup.cs
  20. +2
    -6
      src/Services/Identity/Identity.API/AppSettings.cs
  21. +2
    -5
      src/Services/Identity/Identity.API/Certificate/Certificate.cs
  22. +1
    -1
      src/Services/Identity/Identity.API/Configuration/Config.cs
  23. +28
    -24
      src/Services/Identity/Identity.API/Controllers/AccountController.cs
  24. +4
    -10
      src/Services/Identity/Identity.API/Controllers/ConsentController.cs
  25. +4
    -8
      src/Services/Identity/Identity.API/Controllers/HomeController.cs
  26. +3
    -7
      src/Services/Identity/Identity.API/Data/ApplicationDbContext.cs
  27. +37
    -52
      src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs
  28. +56
    -0
      src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
  29. +0
    -242
      src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.Designer.cs
  30. +0
    -33
      src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.cs
  31. +1
    -1
      src/Services/Identity/Identity.API/Dockerfile
  32. +1
    -1
      src/Services/Identity/Identity.API/Extensions/LinqSelectExtensions.cs
  33. +10
    -32
      src/Services/Identity/Identity.API/Identity.API.csproj
  34. +0
    -40
      src/Services/Identity/Identity.API/Migrations/20170604151240_Init-persisted-grant.cs
  35. +130
    -113
      src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.Designer.cs
  36. +78
    -72
      src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.cs
  37. +128
    -111
      src/Services/Identity/Identity.API/Migrations/ApplicationDbContextModelSnapshot.cs
  38. +55
    -8
      src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.Designer.cs
  39. +146
    -112
      src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.cs
  40. +53
    -6
      src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs
  41. +10
    -6
      src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.Designer.cs
  42. +40
    -0
      src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.cs
  43. +8
    -4
      src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs
  44. +2
    -6
      src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentInputModel.cs
  45. +2
    -4
      src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs
  46. +2
    -6
      src/Services/Identity/Identity.API/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs
  47. +2
    -6
      src/Services/Identity/Identity.API/Models/AccountViewModels/ForgotPasswordViewModel.cs
  48. +1
    -5
      src/Services/Identity/Identity.API/Models/AccountViewModels/LoggedOutViewModel.cs
  49. +2
    -6
      src/Services/Identity/Identity.API/Models/AccountViewModels/LoginViewModel.cs
  50. +1
    -5
      src/Services/Identity/Identity.API/Models/AccountViewModels/LogoutViewModel.cs
  51. +2
    -6
      src/Services/Identity/Identity.API/Models/AccountViewModels/RegisterViewModel.cs
  52. +2
    -6
      src/Services/Identity/Identity.API/Models/AccountViewModels/ResetPasswordViewModel.cs
  53. +2
    -5
      src/Services/Identity/Identity.API/Models/AccountViewModels/SendCodeViewModel.cs
  54. +2
    -6
      src/Services/Identity/Identity.API/Models/AccountViewModels/VerifyCodeViewModel.cs
  55. +0
    -20
      src/Services/Identity/Identity.API/Models/AccountViewModels/_LoginViewModel.cs
  56. +2
    -6
      src/Services/Identity/Identity.API/Models/ApplicationUser.cs
  57. +1
    -1
      src/Services/Identity/Identity.API/Models/ErrorViewModel.cs
  58. +2
    -6
      src/Services/Identity/Identity.API/Models/ManageViewModels/AddPhoneNumberViewModel.cs
  59. +2
    -6
      src/Services/Identity/Identity.API/Models/ManageViewModels/ChangePasswordViewModel.cs
  60. +2
    -5
      src/Services/Identity/Identity.API/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs
  61. +1
    -6
      src/Services/Identity/Identity.API/Models/ManageViewModels/FactorViewModel.cs
  62. +2
    -5
      src/Services/Identity/Identity.API/Models/ManageViewModels/IndexViewModel.cs
  63. +3
    -6
      src/Services/Identity/Identity.API/Models/ManageViewModels/ManageLoginsViewModel.cs
  64. +1
    -7
      src/Services/Identity/Identity.API/Models/ManageViewModels/RemoveLoginViewModel.cs
  65. +2
    -6
      src/Services/Identity/Identity.API/Models/ManageViewModels/SetPasswordViewModel.cs
  66. +2
    -6
      src/Services/Identity/Identity.API/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs
  67. +40
    -6
      src/Services/Identity/Identity.API/Program.cs
  68. +3
    -6
      src/Services/Identity/Identity.API/Services/EFLoginService.cs
  69. +2
    -5
      src/Services/Identity/Identity.API/Services/IEmailSender.cs
  70. +2
    -5
      src/Services/Identity/Identity.API/Services/ILoginService.cs
  71. +1
    -6
      src/Services/Identity/Identity.API/Services/IRedirectService.cs
  72. +2
    -5
      src/Services/Identity/Identity.API/Services/ISmsSender.cs
  73. +2
    -5
      src/Services/Identity/Identity.API/Services/MessageServices.cs
  74. +7
    -7
      src/Services/Identity/Identity.API/Services/ProfileService.cs
  75. +2
    -6
      src/Services/Identity/Identity.API/Services/RedirectService.cs
  76. +22
    -92
      src/Services/Identity/Identity.API/Startup.cs
  77. +1
    -1
      src/Services/Identity/Identity.API/Views/Account/LoggedOut.cshtml
  78. +1
    -1
      src/Services/Identity/Identity.API/Views/Account/Login.cshtml
  79. +1
    -1
      src/Services/Identity/Identity.API/Views/Account/Logout.cshtml
  80. +1
    -2
      src/Services/Identity/Identity.API/Views/Account/Register.cshtml
  81. +1
    -1
      src/Services/Identity/Identity.API/Views/Consent/Index.cshtml
  82. +1
    -1
      src/Services/Identity/Identity.API/Views/Consent/_ScopeListItem.cshtml
  83. +1
    -1
      src/Services/Identity/Identity.API/Views/Shared/Error.cshtml
  84. +12
    -0
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs
  85. +27
    -14
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs
  86. +3
    -0
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingReadDataContext.cs
  87. +1
    -0
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  88. +12
    -1
      src/Services/Marketing/Marketing.API/Program.cs
  89. +8
    -32
      src/Services/Marketing/Marketing.API/Startup.cs
  90. +57
    -43
      src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs
  91. +0
    -29
      src/Services/Ordering/Ordering.API/Infrastructure/OrderingDbContextDesigner.cs
  92. +1
    -0
      src/Services/Ordering/Ordering.API/Ordering.API.csproj
  93. +18
    -1
      src/Services/Ordering/Ordering.API/Program.cs
  94. +9
    -36
      src/Services/Ordering/Ordering.API/Startup.cs
  95. +32
    -8
      src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs

+ 55
- 1
eShopOnContainers-ServicesAndWebApps.sln View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26730.8
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}"
EndProject EndProject
@ -99,6 +99,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Health
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTest", "test\Services\LoadTest\LoadTest.csproj", "{969E793C-C413-490E-9C9D-B2B46DA5AF32}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTest", "test\Services\LoadTest\LoadTest.csproj", "{969E793C-C413-490E-9C9D-B2B46DA5AF32}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebHost", "WebHost", "{1815B651-941C-466B-AE33-D1D7EEB8F77F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{15F4B3AA-89B6-4A0D-9051-414305974781}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@ -1361,6 +1365,54 @@ Global
{969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x64.Build.0 = Release|Any CPU {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x64.Build.0 = Release|Any CPU
{969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.ActiveCfg = Release|Any CPU {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.ActiveCfg = Release|Any CPU
{969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.Build.0 = Release|Any CPU {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|ARM.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|iPhone.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|x64.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|x64.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|x86.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.AppStore|x86.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|ARM.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|ARM.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|iPhone.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|x64.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|x64.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|x86.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Debug|x86.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|Any CPU.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|ARM.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|ARM.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|iPhone.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|iPhone.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x64.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x64.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -1408,6 +1460,8 @@ Global
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F} {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
{768C887F-C229-4B94-ACD8-0C7F65686524} = {A81ECBC2-6B00-4DCD-8388-469174033379} {768C887F-C229-4B94-ACD8-0C7F65686524} = {A81ECBC2-6B00-4DCD-8388-469174033379}
{969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870} {969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870}
{1815B651-941C-466B-AE33-D1D7EEB8F77F} = {DB0EFB20-B024-4E5E-A75C-52143C131D25}
{15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9}


+ 60
- 54
eShopOnContainers.sln View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26730.8
VisualStudioVersion = 15.0.26730.15
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
@ -60,7 +60,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSPA", "src\Web\WebSPA\We
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mobile Apps", "Mobile Apps", "{B7B1D395-4E06-4036-BE86-C216756B9367}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mobile Apps", "Mobile Apps", "{B7B1D395-4E06-4036-BE86-C216756B9367}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.UnitTests", "src\Mobile\eShopOnContainers\eShopOnContainers.UnitTests\eShopOnContainers.UnitTests.csproj", "{F7B6A162-BC4D-4924-B16A-713F9B0344E7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "eShopOnContainers.UnitTests", "src\Mobile\eShopOnContainers\eShopOnContainers.UnitTests\eShopOnContainers.UnitTests.csproj", "{F7B6A162-BC4D-4924-B16A-713F9B0344E7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.TestRunner.Droid", "src\Mobile\eShopOnContainers\eShopOnContainers.TestRunner.Droid\eShopOnContainers.TestRunner.Droid.csproj", "{A289A7F0-ACD8-42AE-87B6-AB1AFD310BF1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.TestRunner.Droid", "src\Mobile\eShopOnContainers\eShopOnContainers.TestRunner.Droid\eShopOnContainers.TestRunner.Droid.csproj", "{A289A7F0-ACD8-42AE-87B6-AB1AFD310BF1}"
EndProject EndProject
@ -76,7 +76,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests", "test\Se
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.UITests", "src\Mobile\eShopOnContainers\eShopOnContainers.UITests\eShopOnContainers.UITests.csproj", "{E3B18084-842C-4B80-8E4A-A7E588EC3137}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.UITests", "src\Mobile\eShopOnContainers\eShopOnContainers.UITests\eShopOnContainers.UITests.csproj", "{E3B18084-842C-4B80-8E4A-A7E588EC3137}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.Core", "src\Mobile\eShopOnContainers\eShopOnContainers.Core\eShopOnContainers.Core.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "eShopOnContainers.Core", "src\Mobile\eShopOnContainers\eShopOnContainers.Core\eShopOnContainers.Core.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "test\Services\UnitTest\UnitTest.csproj", "{7796F5D8-31FC-45A4-B673-19DE5BA194CF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "test\Services\UnitTest\UnitTest.csproj", "{7796F5D8-31FC-45A4-B673-19DE5BA194CF}"
EndProject EndProject
@ -126,12 +126,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus.Tests", "src\Build
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.AzureStorage", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj", "{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.AzureStorage", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj", "{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GracePeriodManager", "src\Services\GracePeriod\GracePeriodManager\GracePeriodManager.csproj", "{6C6A69FE-A484-4E75-AFEC-827EA354AF46}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Payment", "Payment", "{D5D3841D-F282-4E60-B9CB-267A1BF2D893}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Payment", "Payment", "{D5D3841D-F282-4E60-B9CB-267A1BF2D893}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{2A795FEA-2EB7-45F5-9B30-35E0810CB238}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{2A795FEA-2EB7-45F5-9B30-35E0810CB238}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebHost", "WebHost", "{3E51A82A-5DE1-482E-BA46-F4FF3138B41A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@ -1781,54 +1783,6 @@ Global
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x64.Build.0 = Release|Any CPU {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x64.Build.0 = Release|Any CPU
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.ActiveCfg = Release|Any CPU {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.ActiveCfg = Release|Any CPU
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.Build.0 = Release|Any CPU {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.Build.0 = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|ARM.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhone.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x64.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x64.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x86.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x86.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|ARM.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhone.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x64.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x64.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x86.ActiveCfg = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x86.Build.0 = Debug|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|Any CPU.Build.0 = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|ARM.ActiveCfg = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|ARM.Build.0 = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhone.ActiveCfg = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhone.Build.0 = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x64.ActiveCfg = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x64.Build.0 = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x86.ActiveCfg = Release|Any CPU
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x86.Build.0 = Release|Any CPU
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
@ -1877,6 +1831,54 @@ Global
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x64.Build.0 = Release|Any CPU {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x64.Build.0 = Release|Any CPU
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x86.ActiveCfg = Release|Any CPU {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x86.ActiveCfg = Release|Any CPU
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x86.Build.0 = Release|Any CPU {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x86.Build.0 = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|ARM.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|iPhone.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|x64.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|x64.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|x86.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.AppStore|x86.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|ARM.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|ARM.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|iPhone.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|x64.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|x64.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|x86.ActiveCfg = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Debug|x86.Build.0 = Debug|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|Any CPU.Build.0 = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|ARM.ActiveCfg = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|ARM.Build.0 = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|iPhone.ActiveCfg = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|iPhone.Build.0 = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|x64.ActiveCfg = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|x64.Build.0 = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|x86.ActiveCfg = Release|Any CPU
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -1934,8 +1936,12 @@ Global
{26906157-98E3-4DF8-80F6-866B9686887C} = {B473B70F-0796-4862-B1AD-BB742D93B868} {26906157-98E3-4DF8-80F6-866B9686887C} = {B473B70F-0796-4862-B1AD-BB742D93B868}
{8AE2AAA3-4507-4BEE-9250-4D16F87015B4} = {B473B70F-0796-4862-B1AD-BB742D93B868} {8AE2AAA3-4507-4BEE-9250-4D16F87015B4} = {B473B70F-0796-4862-B1AD-BB742D93B868}
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD} = {96CE8CE7-BC97-4A53-899F-5EB63D7BBF7B} {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD} = {96CE8CE7-BC97-4A53-899F-5EB63D7BBF7B}
{6C6A69FE-A484-4E75-AFEC-827EA354AF46} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B}
{D5D3841D-F282-4E60-B9CB-267A1BF2D893} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} {D5D3841D-F282-4E60-B9CB-267A1BF2D893} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
{2A795FEA-2EB7-45F5-9B30-35E0810CB238} = {D5D3841D-F282-4E60-B9CB-267A1BF2D893} {2A795FEA-2EB7-45F5-9B30-35E0810CB238} = {D5D3841D-F282-4E60-B9CB-267A1BF2D893}
{3E51A82A-5DE1-482E-BA46-F4FF3138B41A} = {1EF3AC0F-F27C-46DD-AC53-D762D2C11C45}
{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98} = {3E51A82A-5DE1-482E-BA46-F4FF3138B41A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A6439048-F270-4A9E-A350-63C7BE2BB322}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

BIN
img/sf/cloud-config-idsrv.PNG View File

Before After
Width: 1140  |  Height: 315  |  Size: 46 KiB

BIN
img/sf/cloud-config-mvc.PNG View File

Before After
Width: 1138  |  Height: 328  |  Size: 31 KiB

BIN
img/sf/cloud-config-spa.PNG View File

Before After
Width: 1136  |  Height: 351  |  Size: 43 KiB

BIN
img/sf/cloud-config.PNG View File

Before After
Width: 1154  |  Height: 428  |  Size: 53 KiB

BIN
img/sf/explorer-apps-status.PNG View File

Before After
Width: 1786  |  Height: 406  |  Size: 45 KiB

BIN
img/sf/explorer-deployment-status.PNG View File

Before After
Width: 1772  |  Height: 940  |  Size: 101 KiB

BIN
img/sf/publish-button.PNG View File

Before After
Width: 343  |  Height: 319  |  Size: 12 KiB

BIN
img/sf/publish-window.PNG View File

Before After
Width: 630  |  Height: 428  |  Size: 16 KiB

BIN
img/sf/sf-directory.PNG View File

Before After
Width: 371  |  Height: 239  |  Size: 8.4 KiB

+ 11
- 0
src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
</Project>

+ 40
- 0
src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHostExtensions.cs View File

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
namespace Microsoft.AspNetCore.Hosting
{
public static class IWebHostExtensions
{
public static IWebHost MigrateDbContext<TContext>(this IWebHost webHost, Action<TContext,IServiceProvider> seeder) where TContext : DbContext
{
using (var scope = webHost.Services.CreateScope())
{
var services = scope.ServiceProvider;
var logger = services.GetRequiredService<ILogger<TContext>>();
var context = services.GetService<TContext>();
try
{
logger.LogInformation($"Migrating database associated with context {typeof(TContext).Name}");
context.Database
.Migrate();
seeder(context,services);
logger.LogInformation($"Migrated database associated with context {typeof(TContext).Name}");
}
catch (Exception ex)
{
logger.LogError(ex, $"An error occurred while migrating the database used on context {typeof(TContext).Name}");
}
}
return webHost;
}
}
}

src/Services/Basket/Basket.API/Model/Basket.cs → src/Services/Basket/Basket.API/Model/CustomerBasket.cs View File


+ 1
- 0
src/Services/Catalog/Catalog.API/Catalog.API.csproj View File

@ -53,6 +53,7 @@
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 13
- 0
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs View File

@ -3,6 +3,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using EntityConfigurations; using EntityConfigurations;
using Model; using Model;
using Microsoft.EntityFrameworkCore.Design;
public class CatalogContext : DbContext public class CatalogContext : DbContext
{ {
@ -20,4 +21,16 @@
builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration()); builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration());
} }
} }
public class CatalogContextDesignFactory : IDesignTimeDbContextFactory<CatalogContext>
{
public CatalogContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<CatalogContext>()
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;Integrated Security=true");
return new CatalogContext(optionsBuilder.Options);
}
}
} }

+ 62
- 60
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -1,15 +1,14 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{ {
using EntityFrameworkCore;
using Extensions.Logging; using Extensions.Logging;
using global::Catalog.API.Extensions; using global::Catalog.API.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Model; using Model;
using Polly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlClient;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
@ -19,56 +18,48 @@
public class CatalogContextSeed public class CatalogContextSeed
{ {
public static async Task SeedAsync(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory, int? retry = 0)
public async Task SeedAsync(CatalogContext context,IHostingEnvironment env,IOptions<CatalogSettings> settings,ILogger<CatalogContextSeed> logger)
{ {
var log = loggerFactory.CreateLogger("catalog seed");
var policy = CreatePolicy(logger, nameof(CatalogContextSeed));
var context = (CatalogContext)applicationBuilder
.ApplicationServices.GetService(typeof(CatalogContext));
context.Database.Migrate();
var settings = (CatalogSettings)applicationBuilder
.ApplicationServices.GetRequiredService<IOptions<CatalogSettings>>().Value;
var useCustomizationData = settings.UseCustomizationData;
var contentRootPath = env.ContentRootPath;
var picturePath = env.WebRootPath;
if (!context.CatalogBrands.Any())
await policy.ExecuteAsync(async () =>
{ {
context.CatalogBrands.AddRange(useCustomizationData
? GetCatalogBrandsFromFile(contentRootPath, log)
: GetPreconfiguredCatalogBrands()
);
var useCustomizationData = settings.Value.UseCustomizationData;
var contentRootPath = env.ContentRootPath;
var picturePath = env.WebRootPath;
await context.SaveChangesAsync();
}
if (!context.CatalogBrands.Any())
{
context.CatalogBrands.AddRange(useCustomizationData
? GetCatalogBrandsFromFile(contentRootPath, logger)
: GetPreconfiguredCatalogBrands());
if (!context.CatalogTypes.Any())
{
context.CatalogTypes.AddRange(useCustomizationData
? GetCatalogTypesFromFile(contentRootPath, log)
: GetPreconfiguredCatalogTypes()
);
await context.SaveChangesAsync();
}
await context.SaveChangesAsync();
}
if (!context.CatalogTypes.Any())
{
context.CatalogTypes.AddRange(useCustomizationData
? GetCatalogTypesFromFile(contentRootPath, logger)
: GetPreconfiguredCatalogTypes());
if (!context.CatalogItems.Any())
{
context.CatalogItems.AddRange(useCustomizationData
? GetCatalogItemsFromFile(contentRootPath, context, log)
: GetPreconfiguredItems()
);
await context.SaveChangesAsync();
}
await context.SaveChangesAsync();
if (!context.CatalogItems.Any())
{
context.CatalogItems.AddRange(useCustomizationData
? GetCatalogItemsFromFile(contentRootPath, context, logger)
: GetPreconfiguredItems());
GetCatalogItemPictures(contentRootPath, picturePath);
}
await context.SaveChangesAsync();
GetCatalogItemPictures(contentRootPath, picturePath);
}
});
} }
static IEnumerable<CatalogBrand> GetCatalogBrandsFromFile(string contentRootPath, ILogger log)
private IEnumerable<CatalogBrand> GetCatalogBrandsFromFile(string contentRootPath, ILogger<CatalogContextSeed> logger)
{ {
string csvFileCatalogBrands = Path.Combine(contentRootPath, "Setup", "CatalogBrands.csv"); string csvFileCatalogBrands = Path.Combine(contentRootPath, "Setup", "CatalogBrands.csv");
@ -85,18 +76,18 @@
} }
catch (Exception ex) catch (Exception ex)
{ {
log.LogError(ex.Message);
logger.LogError(ex.Message);
return GetPreconfiguredCatalogBrands(); return GetPreconfiguredCatalogBrands();
} }
return File.ReadAllLines(csvFileCatalogBrands) return File.ReadAllLines(csvFileCatalogBrands)
.Skip(1) // skip header row .Skip(1) // skip header row
.SelectTry(x => CreateCatalogBrand(x)) .SelectTry(x => CreateCatalogBrand(x))
.OnCaughtException(ex => { log.LogError(ex.Message); return null; })
.OnCaughtException(ex => { logger.LogError(ex.Message); return null; })
.Where(x => x != null); .Where(x => x != null);
} }
static CatalogBrand CreateCatalogBrand(string brand)
private CatalogBrand CreateCatalogBrand(string brand)
{ {
brand = brand.Trim('"').Trim(); brand = brand.Trim('"').Trim();
@ -111,7 +102,7 @@
}; };
} }
static IEnumerable<CatalogBrand> GetPreconfiguredCatalogBrands()
private IEnumerable<CatalogBrand> GetPreconfiguredCatalogBrands()
{ {
return new List<CatalogBrand>() return new List<CatalogBrand>()
{ {
@ -123,7 +114,7 @@
}; };
} }
static IEnumerable<CatalogType> GetCatalogTypesFromFile(string contentRootPath, ILogger log)
private IEnumerable<CatalogType> GetCatalogTypesFromFile(string contentRootPath, ILogger<CatalogContextSeed> logger)
{ {
string csvFileCatalogTypes = Path.Combine(contentRootPath, "Setup", "CatalogTypes.csv"); string csvFileCatalogTypes = Path.Combine(contentRootPath, "Setup", "CatalogTypes.csv");
@ -140,18 +131,18 @@
} }
catch (Exception ex) catch (Exception ex)
{ {
log.LogError(ex.Message);
logger.LogError(ex.Message);
return GetPreconfiguredCatalogTypes(); return GetPreconfiguredCatalogTypes();
} }
return File.ReadAllLines(csvFileCatalogTypes) return File.ReadAllLines(csvFileCatalogTypes)
.Skip(1) // skip header row .Skip(1) // skip header row
.SelectTry(x => CreateCatalogType(x)) .SelectTry(x => CreateCatalogType(x))
.OnCaughtException(ex => { log.LogError(ex.Message); return null; })
.OnCaughtException(ex => { logger.LogError(ex.Message); return null; })
.Where(x => x != null); .Where(x => x != null);
} }
static CatalogType CreateCatalogType(string type)
private CatalogType CreateCatalogType(string type)
{ {
type = type.Trim('"').Trim(); type = type.Trim('"').Trim();
@ -166,7 +157,7 @@
}; };
} }
static IEnumerable<CatalogType> GetPreconfiguredCatalogTypes()
private IEnumerable<CatalogType> GetPreconfiguredCatalogTypes()
{ {
return new List<CatalogType>() return new List<CatalogType>()
{ {
@ -177,7 +168,7 @@
}; };
} }
static IEnumerable<CatalogItem> GetCatalogItemsFromFile(string contentRootPath, CatalogContext context, ILogger log)
private IEnumerable<CatalogItem> GetCatalogItemsFromFile(string contentRootPath, CatalogContext context, ILogger<CatalogContextSeed> logger)
{ {
string csvFileCatalogItems = Path.Combine(contentRootPath, "Setup", "CatalogItems.csv"); string csvFileCatalogItems = Path.Combine(contentRootPath, "Setup", "CatalogItems.csv");
@ -195,7 +186,7 @@
} }
catch (Exception ex) catch (Exception ex)
{ {
log.LogError(ex.Message);
logger.LogError(ex.Message);
return GetPreconfiguredItems(); return GetPreconfiguredItems();
} }
@ -206,11 +197,11 @@
.Skip(1) // skip header row .Skip(1) // skip header row
.Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") ) .Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") )
.SelectTry(column => CreateCatalogItem(column, csvheaders, catalogTypeIdLookup, catalogBrandIdLookup)) .SelectTry(column => CreateCatalogItem(column, csvheaders, catalogTypeIdLookup, catalogBrandIdLookup))
.OnCaughtException(ex => { log.LogError(ex.Message); return null; })
.OnCaughtException(ex => { logger.LogError(ex.Message); return null; })
.Where(x => x != null); .Where(x => x != null);
} }
static CatalogItem CreateCatalogItem(string[] column, string[] headers, Dictionary<String, int> catalogTypeIdLookup, Dictionary<String, int> catalogBrandIdLookup)
private CatalogItem CreateCatalogItem(string[] column, string[] headers, Dictionary<String, int> catalogTypeIdLookup, Dictionary<String, int> catalogBrandIdLookup)
{ {
if (column.Count() != headers.Count()) if (column.Count() != headers.Count())
{ {
@ -316,7 +307,7 @@
return catalogItem; return catalogItem;
} }
static IEnumerable<CatalogItem> GetPreconfiguredItems()
private IEnumerable<CatalogItem> GetPreconfiguredItems()
{ {
return new List<CatalogItem>() return new List<CatalogItem>()
{ {
@ -335,7 +326,7 @@
}; };
} }
static string[] GetHeaders(string csvfile, string[] requiredHeaders, string[] optionalHeaders = null)
private string[] GetHeaders(string csvfile, string[] requiredHeaders, string[] optionalHeaders = null)
{ {
string[] csvheaders = File.ReadLines(csvfile).First().ToLowerInvariant().Split(','); string[] csvheaders = File.ReadLines(csvfile).First().ToLowerInvariant().Split(',');
@ -363,7 +354,7 @@
return csvheaders; return csvheaders;
} }
static void GetCatalogItemPictures(string contentRootPath, string picturePath)
private void GetCatalogItemPictures(string contentRootPath, string picturePath)
{ {
DirectoryInfo directory = new DirectoryInfo(picturePath); DirectoryInfo directory = new DirectoryInfo(picturePath);
foreach (FileInfo file in directory.GetFiles()) foreach (FileInfo file in directory.GetFiles())
@ -374,7 +365,18 @@
string zipFileCatalogItemPictures = Path.Combine(contentRootPath, "Setup", "CatalogItems.zip"); string zipFileCatalogItemPictures = Path.Combine(contentRootPath, "Setup", "CatalogItems.zip");
ZipFile.ExtractToDirectory(zipFileCatalogItemPictures, picturePath); ZipFile.ExtractToDirectory(zipFileCatalogItemPictures, picturePath);
} }
}
private Policy CreatePolicy( ILogger<CatalogContextSeed> logger, string prefix,int retries = 3)
{
return Policy.Handle<SqlException>().
WaitAndRetryAsync(
retryCount: retries,
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}
}
} }

+ 18
- 2
src/Services/Catalog/Catalog.API/Program.cs View File

@ -1,15 +1,31 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.IO; using System.IO;
namespace Microsoft.eShopOnContainers.Services.Catalog.API namespace Microsoft.eShopOnContainers.Services.Catalog.API
{ {
public class Program public class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
BuildWebHost(args).Run();
BuildWebHost(args)
.MigrateDbContext<CatalogContext>((context,services)=>
{
var env = services.GetService<IHostingEnvironment>();
var settings = services.GetService<IOptions<CatalogSettings>>();
var logger = services.GetService<ILogger<CatalogContextSeed>>();
new CatalogContextSeed()
.SeedAsync(context,env,settings,logger)
.Wait();
})
.MigrateDbContext<IntegrationEventLogContext>((_,__)=> { })
.Run();
} }
public static IWebHost BuildWebHost(string[] args) => public static IWebHost BuildWebHost(string[] args) =>


+ 7
- 42
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -9,7 +9,6 @@
using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
@ -24,15 +23,10 @@
using Microsoft.Extensions.HealthChecks; using Microsoft.Extensions.HealthChecks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Polly;
using RabbitMQ.Client; using RabbitMQ.Client;
using System; using System;
using System.Data.Common; using System.Data.Common;
using System.Data.SqlClient;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
public class Startup public class Startup
{ {
@ -85,6 +79,13 @@
//Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval //Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval
}); });
services.AddDbContext<IntegrationEventLogContext>(options =>
{
options.UseSqlServer(Configuration["ConnectionString"], opts =>
opts.MigrationsAssembly("Catalog.API"));
});
services.Configure<CatalogSettings>(Configuration); services.Configure<CatalogSettings>(Configuration);
// Add framework services. // Add framework services.
@ -184,43 +185,7 @@
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
}); });
var context = (CatalogContext)app
.ApplicationServices.GetService(typeof(CatalogContext));
WaitForSqlAvailabilityAsync(context, loggerFactory, app, env).Wait();
ConfigureEventBus(app); ConfigureEventBus(app);
var integrationEventLogContext = new IntegrationEventLogContext(
new DbContextOptionsBuilder<IntegrationEventLogContext>()
.UseSqlServer(Configuration["ConnectionString"], b => b.MigrationsAssembly("Catalog.API"))
.Options);
integrationEventLogContext.Database.Migrate();
}
private async Task WaitForSqlAvailabilityAsync(CatalogContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, IHostingEnvironment env, int retries = 0)
{
var logger = loggerFactory.CreateLogger(nameof(Startup));
var policy = CreatePolicy(retries, logger, nameof(WaitForSqlAvailabilityAsync));
await policy.ExecuteAsync(async () =>
{
await CatalogContextSeed.SeedAsync(app, env, loggerFactory);
});
}
private Policy CreatePolicy(int retries, ILogger logger, string prefix)
{
return Policy.Handle<SqlException>().
WaitAndRetryAsync(
retryCount: retries,
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
} }
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)


+ 2
- 6
src/Services/Identity/Identity.API/AppSettings.cs View File

@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace eShopOnContainers.Identity
namespace Microsoft.eShopOnContainers.Services.Identity.API
{ {
public class AppSettings public class AppSettings
{ {
public string MvcClient { get; set; } public string MvcClient { get; set; }
public bool UseCustomizationData { get; set; } public bool UseCustomizationData { get; set; }
} }
} }

+ 2
- 5
src/Services/Identity/Identity.API/Certificate/Certificate.cs View File

@ -1,11 +1,8 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.IO;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
namespace Identity.API.Certificate
namespace Microsoft.eShopOnContainers.Services.Identity.API.Certificates
{ {
static class Certificate static class Certificate
{ {


+ 1
- 1
src/Services/Identity/Identity.API/Configuration/Config.cs View File

@ -2,7 +2,7 @@
using IdentityServer4.Models; using IdentityServer4.Models;
using System.Collections.Generic; using System.Collections.Generic;
namespace Identity.API.Configuration
namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
{ {
public class Config public class Config
{ {


+ 28
- 24
src/Services/Identity/Identity.API/Controllers/AccountController.cs View File

@ -1,29 +1,23 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityModel;
using IdentityServer4.Quickstart.UI.Models;
using IdentityModel;
using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Services; using IdentityServer4.Services;
using Microsoft.AspNetCore.Http.Authentication;
using IdentityServer4.Stores;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels;
using Microsoft.eShopOnContainers.Services.Identity.API.Services;
using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Threading.Tasks; using System.Threading.Tasks;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using Identity.API.Services;
using Identity.API.Models;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Authorization;
using Identity.API.Models.AccountViewModels;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Authentication;
namespace IdentityServer4.Quickstart.UI.Controllers
namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
{ {
/// <summary> /// <summary>
/// This sample controller implements a typical login/logout/provision workflow for local and external accounts. /// This sample controller implements a typical login/logout/provision workflow for local and external accounts.
@ -36,7 +30,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
private readonly ILoginService<ApplicationUser> _loginService; private readonly ILoginService<ApplicationUser> _loginService;
private readonly IIdentityServerInteractionService _interaction; private readonly IIdentityServerInteractionService _interaction;
private readonly IClientStore _clientStore; private readonly IClientStore _clientStore;
private readonly ILogger _logger;
private readonly ILogger<AccountController> _logger;
private readonly UserManager<ApplicationUser> _userManager; private readonly UserManager<ApplicationUser> _userManager;
public AccountController( public AccountController(
@ -45,13 +39,13 @@ namespace IdentityServer4.Quickstart.UI.Controllers
ILoginService<ApplicationUser> loginService, ILoginService<ApplicationUser> loginService,
IIdentityServerInteractionService interaction, IIdentityServerInteractionService interaction,
IClientStore clientStore, IClientStore clientStore,
ILoggerFactory loggerFactory,
ILogger<AccountController> logger,
UserManager<ApplicationUser> userManager) UserManager<ApplicationUser> userManager)
{ {
_loginService = loginService; _loginService = loginService;
_interaction = interaction; _interaction = interaction;
_clientStore = clientStore; _clientStore = clientStore;
_logger = loggerFactory.CreateLogger<AccountController>();
_logger = logger;
_userManager = userManager; _userManager = userManager;
} }
@ -69,6 +63,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
} }
var vm = await BuildLoginViewModelAsync(returnUrl, context); var vm = await BuildLoginViewModelAsync(returnUrl, context);
ViewData["ReturnUrl"] = returnUrl; ViewData["ReturnUrl"] = returnUrl;
return View(vm); return View(vm);
@ -97,6 +92,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
}; };
await _loginService.SignIn(user); await _loginService.SignIn(user);
// make sure the returnUrl is still valid, and if yes - redirect back to authorize endpoint // make sure the returnUrl is still valid, and if yes - redirect back to authorize endpoint
if (_interaction.IsValidReturnUrl(model.ReturnUrl)) if (_interaction.IsValidReturnUrl(model.ReturnUrl))
{ {
@ -111,7 +107,9 @@ namespace IdentityServer4.Quickstart.UI.Controllers
// something went wrong, show form with error // something went wrong, show form with error
var vm = await BuildLoginViewModelAsync(model); var vm = await BuildLoginViewModelAsync(model);
ViewData["ReturnUrl"] = model.ReturnUrl; ViewData["ReturnUrl"] = model.ReturnUrl;
return View(vm); return View(vm);
} }
@ -180,6 +178,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
public async Task<IActionResult> Logout(LogoutViewModel model) public async Task<IActionResult> Logout(LogoutViewModel model)
{ {
var idp = User?.FindFirst(JwtClaimTypes.IdentityProvider)?.Value; var idp = User?.FindFirst(JwtClaimTypes.IdentityProvider)?.Value;
if (idp != null && idp != IdentityServerConstants.LocalIdentityProvider) if (idp != null && idp != IdentityServerConstants.LocalIdentityProvider)
{ {
if (model.LogoutId == null) if (model.LogoutId == null)
@ -191,10 +190,15 @@ namespace IdentityServer4.Quickstart.UI.Controllers
} }
string url = "/Account/Logout?logoutId=" + model.LogoutId; string url = "/Account/Logout?logoutId=" + model.LogoutId;
try try
{ {
// hack: try/catch to handle social providers that throw // hack: try/catch to handle social providers that throw
await HttpContext.Authentication.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url });
await HttpContext.SignOutAsync(idp, new AuthenticationProperties
{
RedirectUri = url
});
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -203,7 +207,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
} }
// delete authentication cookie // delete authentication cookie
await HttpContext.Authentication.SignOutAsync();
await HttpContext.SignOutAsync();
// set this so UI rendering sees an anonymous user // set this so UI rendering sees an anonymous user
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity());
@ -217,7 +221,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
public async Task<IActionResult> DeviceLogOut(string redirectUrl) public async Task<IActionResult> DeviceLogOut(string redirectUrl)
{ {
// delete authentication cookie // delete authentication cookie
await HttpContext.Authentication.SignOutAsync();
await HttpContext.SignOutAsync();
// set this so UI rendering sees an anonymous user // set this so UI rendering sees an anonymous user
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity());


+ 4
- 10
src/Services/Identity/Identity.API/Controllers/ConsentController.cs View File

@ -1,19 +1,13 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityServer4.Models;
using IdentityServer4.Services; using IdentityServer4.Services;
using IdentityServer4.Stores;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using IdentityServer4.Quickstart.UI.Models;
using Identity.API.Models.AccountViewModels;
using Identity.API.Services;
namespace IdentityServer4.Quickstart.UI.Controllers
namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
{ {
/// <summary> /// <summary>
/// This controller implements the consent logic /// This controller implements the consent logic


+ 4
- 8
src/Services/Identity/Identity.API/Controllers/HomeController.cs View File

@ -1,16 +1,12 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using eShopOnContainers.Identity;
using Identity.API.Services;
using IdentityServer4.Quickstart.UI.Models;

using IdentityServer4.Services; using IdentityServer4.Services;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using Microsoft.eShopOnContainers.Services.Identity.API.Services;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace IdentityServer4.Quickstart.UI.Controllers
namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
{ {
public class HomeController : Controller public class HomeController : Controller
{ {


+ 3
- 7
src/Services/Identity/Identity.API/Data/ApplicationDbContext.cs View File

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Identity.API.Models;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
namespace Identity.API.Data
namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
{ {
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{ {


src/Services/Identity/Identity.API/Data/ApplicationContextSeed.cs → src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs View File

@ -1,57 +1,40 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.eShopOnContainers.Services.Identity.API.Extensions;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
{ {
using AspNetCore.Identity;
using EntityFrameworkCore;
using Extensions.Logging;
using global::eShopOnContainers.Identity;
using global::Identity.API.Data;
using global::Identity.API.Models;
using Identity.API.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
public class ApplicationContextSeed
{
private readonly IPasswordHasher<ApplicationUser> _passwordHasher;
public ApplicationContextSeed(IPasswordHasher<ApplicationUser> passwordHasher)
{
_passwordHasher = passwordHasher;
}
public async Task SeedAsync(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory, int? retry = 0)
public class ApplicationDbContextSeed
{
private readonly IPasswordHasher<ApplicationUser> _passwordHasher = new PasswordHasher<ApplicationUser>();
public async Task SeedAsync(ApplicationDbContext context,IHostingEnvironment env,
ILogger<ApplicationDbContextSeed> logger, IOptions<AppSettings> settings,int? retry = 0)
{ {
int retryForAvaiability = retry.Value; int retryForAvaiability = retry.Value;
try try
{ {
var log = loggerFactory.CreateLogger("application seed");
var context = (ApplicationDbContext)applicationBuilder
.ApplicationServices.GetService(typeof(ApplicationDbContext));
context.Database.Migrate();
var settings = (AppSettings)applicationBuilder
.ApplicationServices.GetRequiredService<IOptions<AppSettings>>().Value;
var useCustomizationData = settings.UseCustomizationData;
var useCustomizationData = settings.Value.UseCustomizationData;
var contentRootPath = env.ContentRootPath; var contentRootPath = env.ContentRootPath;
var webroot = env.WebRootPath; var webroot = env.WebRootPath;
if (!context.Users.Any()) if (!context.Users.Any())
{ {
context.Users.AddRange(useCustomizationData context.Users.AddRange(useCustomizationData
? GetUsersFromFile(contentRootPath, log)
? GetUsersFromFile(contentRootPath, logger)
: GetDefaultUser()); : GetDefaultUser());
await context.SaveChangesAsync(); await context.SaveChangesAsync();
@ -59,7 +42,7 @@
if (useCustomizationData) if (useCustomizationData)
{ {
GetPreconfiguredImages(contentRootPath, webroot, log);
GetPreconfiguredImages(contentRootPath, webroot, logger);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -67,14 +50,15 @@
if (retryForAvaiability < 10) if (retryForAvaiability < 10)
{ {
retryForAvaiability++; retryForAvaiability++;
var log = loggerFactory.CreateLogger("catalog seed");
log.LogError(ex.Message);
await SeedAsync(applicationBuilder, env, loggerFactory, retryForAvaiability);
logger.LogError(ex.Message,$"There is an error migrating data for ApplicationDbContext");
await SeedAsync(context,env,logger,settings, retryForAvaiability);
} }
} }
} }
private IEnumerable<ApplicationUser> GetUsersFromFile(string contentRootPath, ILogger log)
private IEnumerable<ApplicationUser> GetUsersFromFile(string contentRootPath, ILogger logger)
{ {
string csvFileUsers = Path.Combine(contentRootPath, "Setup", "Users.csv"); string csvFileUsers = Path.Combine(contentRootPath, "Setup", "Users.csv");
@ -96,7 +80,8 @@
} }
catch (Exception ex) catch (Exception ex)
{ {
log.LogError(ex.Message);
logger.LogError(ex.Message);
return GetDefaultUser(); return GetDefaultUser();
} }
@ -104,7 +89,7 @@
.Skip(1) // skip header column .Skip(1) // skip header column
.Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") ) .Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") )
.SelectTry(column => CreateApplicationUser(column, csvheaders)) .SelectTry(column => CreateApplicationUser(column, csvheaders))
.OnCaughtException(ex => { log.LogError(ex.Message); return null; })
.OnCaughtException(ex => { logger.LogError(ex.Message); return null; })
.Where(x => x != null) .Where(x => x != null)
.ToList(); .ToList();
@ -207,14 +192,14 @@
return csvheaders; return csvheaders;
} }
static void GetPreconfiguredImages(string contentRootPath, string webroot, ILogger log)
static void GetPreconfiguredImages(string contentRootPath, string webroot, ILogger logger)
{ {
try try
{ {
string imagesZipFile = Path.Combine(contentRootPath, "Setup", "images.zip"); string imagesZipFile = Path.Combine(contentRootPath, "Setup", "images.zip");
if (!File.Exists(imagesZipFile)) if (!File.Exists(imagesZipFile))
{ {
log.LogError($" zip file '{imagesZipFile}' does not exists.");
logger.LogError($" zip file '{imagesZipFile}' does not exists.");
return; return;
} }
@ -236,14 +221,14 @@
} }
else else
{ {
log.LogWarning($"Skip file '{entry.Name}' in zipfile '{imagesZipFile}'");
logger.LogWarning($"Skip file '{entry.Name}' in zipfile '{imagesZipFile}'");
} }
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
log.LogError($"Exception in method GetPreconfiguredImages WebMVC. Exception Message={ex.Message}");
logger.LogError($"Exception in method GetPreconfiguredImages WebMVC. Exception Message={ex.Message}");
} }
} }
} }

+ 56
- 0
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs View File

@ -0,0 +1,56 @@
using IdentityServer4.EntityFramework.DbContexts;
using IdentityServer4.EntityFramework.Mappers;
using Microsoft.eShopOnContainers.Services.Identity.API.Configuration;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
{
public class ConfigurationDbContextSeed
{
public async Task SeedAsync(ConfigurationDbContext context,IConfiguration configuration)
{
//callbacks urls from config:
var clientUrls = new Dictionary<string, string>();
clientUrls.Add("Mvc", configuration.GetValue<string>("MvcClient"));
clientUrls.Add("Spa", configuration.GetValue<string>("SpaClient"));
clientUrls.Add("Xamarin", configuration.GetValue<string>("XamarinCallback"));
clientUrls.Add("LocationsApi", configuration.GetValue<string>("LocationApiClient"));
clientUrls.Add("MarketingApi", configuration.GetValue<string>("MarketingApiClient"));
clientUrls.Add("BasketApi", configuration.GetValue<string>("BasketApiClient"));
clientUrls.Add("OrderingApi", configuration.GetValue<string>("OrderingApiClient"));
if (!context.Clients.Any())
{
foreach (var client in Config.GetClients(clientUrls))
{
await context.Clients.AddAsync(client.ToEntity());
}
await context.SaveChangesAsync();
}
if (!context.IdentityResources.Any())
{
foreach (var resource in Config.GetResources())
{
await context.IdentityResources.AddAsync(resource.ToEntity());
}
await context.SaveChangesAsync();
}
if (!context.ApiResources.Any())
{
foreach (var api in Config.GetApis())
{
await context.ApiResources.AddAsync(api.ToEntity());
}
await context.SaveChangesAsync();
}
}
}
}

+ 0
- 242
src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.Designer.cs View File

@ -1,242 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Identity.API.Data;
namespace WebMVC.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20161019122215_Init_Scheme")]
partial class Init_Scheme
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName");
b.Property<string>("CardNumber");
b.Property<int>("CardType");
b.Property<string>("City");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country");
b.Property<string>("CountryCode");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration");
b.Property<double>("Latitude");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<double>("Longitude");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("State");
b.Property<string>("StateCode");
b.Property<string>("Street");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("ZipCode");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
}
}
}

+ 0
- 33
src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.cs View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace WebMVC.Migrations
{
public partial class extendProfile : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "LastName",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "AspNetUsers",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LastName",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Name",
table: "AspNetUsers");
}
}
}

+ 1
- 1
src/Services/Identity/Identity.API/Dockerfile View File

@ -1,4 +1,4 @@
FROM microsoft/aspnetcore:1.1.2
FROM microsoft/aspnetcore:2.0.0
ARG source ARG source
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80


+ 1
- 1
src/Services/Identity/Identity.API/Extensions/LinqSelectExtensions.cs View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Identity.API.Extensions
namespace Microsoft.eShopOnContainers.Services.Identity.API.Extensions
{ {
public static class LinqSelectExtensions public static class LinqSelectExtensions
{ {


+ 10
- 32
src/Services/Identity/Identity.API/Identity.API.csproj View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId> <UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath> <DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
@ -16,32 +16,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="1.0.1" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.0.0-rc1" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.0.0-rc1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>
@ -51,10 +28,10 @@
</Target> </Target>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.4.337" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.5.357" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -66,6 +43,7 @@
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 0
- 40
src/Services/Identity/Identity.API/Migrations/20170604151240_Init-persisted-grant.cs View File

@ -1,40 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Identity.API.Migrations
{
public partial class Initpersistedgrant : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PersistedGrants",
columns: table => new
{
Key = table.Column<string>(maxLength: 200, nullable: false),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
CreationTime = table.Column<DateTime>(nullable: false),
Data = table.Column<string>(maxLength: 50000, nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
SubjectId = table.Column<string>(maxLength: 200, nullable: true),
Type = table.Column<string>(maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PersistedGrants", x => x.Key);
});
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_SubjectId_ClientId_Type",
table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PersistedGrants");
}
}
}

src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.Designer.cs → src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.Designer.cs View File

@ -1,44 +1,135 @@
using System;
// <auto-generated />
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Identity.API.Data;
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
using System;
namespace WebMVC.Migrations
namespace Identity.API.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("20161020101725_extendProfile")]
partial class extendProfile
[Migration("20170912114036_Initial")]
partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
modelBuilder.Entity("Identity.API.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id");
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName")
.IsRequired();
b.Property<string>("CardNumber")
.IsRequired();
b.Property<int>("CardType");
b.Property<string>("City")
.IsRequired();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country")
.IsRequired();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration")
.IsRequired();
b.Property<string>("LastName")
.IsRequired();
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber")
.IsRequired();
b.Property<string>("SecurityStamp");
b.Property<string>("State")
.IsRequired();
b.Property<string>("Street")
.IsRequired();
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("ZipCode")
.IsRequired();
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken();
b.Property<string>("Name") b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
.HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
.HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -57,7 +148,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetRoleClaims"); b.ToTable("AspNetRoleClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -76,7 +167,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserClaims"); b.ToTable("AspNetUserClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
@ -94,7 +185,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserLogins"); b.ToTable("AspNetUserLogins");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -104,12 +195,10 @@ namespace WebMVC.Migrations
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -124,123 +213,51 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserTokens"); b.ToTable("AspNetUserTokens");
}); });
modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName");
b.Property<string>("CardNumber");
b.Property<int>("CardType");
b.Property<string>("City");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country");
b.Property<string>("CountryCode");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration");
b.Property<string>("LastName");
b.Property<double>("Latitude");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<double>("Longitude");
b.Property<string>("Name");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("State");
b.Property<string>("StateCode");
b.Property<string>("Street");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("ZipCode");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
#pragma warning restore 612, 618
} }
} }
} }

src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.cs → src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.cs View File

@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
namespace WebMVC.Migrations
namespace Identity.API.Migrations
{ {
public partial class Init_Scheme : Migration
public partial class Initial : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -13,59 +13,47 @@ namespace WebMVC.Migrations
name: "AspNetRoles", name: "AspNetRoles",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true)
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_AspNetRoles", x => x.Id); table.PrimaryKey("PK_AspNetRoles", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
LoginProvider = table.Column<string>(nullable: false),
Name = table.Column<string>(nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "AspNetUsers", name: "AspNetUsers",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
CardHolderName = table.Column<string>(nullable: true),
CardNumber = table.Column<string>(nullable: true),
CardType = table.Column<int>(nullable: false),
City = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Country = table.Column<string>(nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
Expiration = table.Column<string>(nullable: true),
LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
SecurityNumber = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
State = table.Column<string>(nullable: true),
Street = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true),
ZipCode = table.Column<string>(nullable: true)
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false),
CardHolderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
CardNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
CardType = table.Column<int>(type: "int", nullable: false),
City = table.Column<string>(type: "nvarchar(max)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
Country = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
Expiration = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
SecurityNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
State = table.Column<string>(type: "nvarchar(max)", nullable: false),
Street = table.Column<string>(type: "nvarchar(max)", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -76,11 +64,11 @@ namespace WebMVC.Migrations
name: "AspNetRoleClaims", name: "AspNetRoleClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
RoleId = table.Column<string>(nullable: false)
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -97,11 +85,11 @@ namespace WebMVC.Migrations
name: "AspNetUserClaims", name: "AspNetUserClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -118,10 +106,10 @@ namespace WebMVC.Migrations
name: "AspNetUserLogins", name: "AspNetUserLogins",
columns: table => new columns: table => new
{ {
LoginProvider = table.Column<string>(nullable: false),
ProviderKey = table.Column<string>(nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -138,8 +126,8 @@ namespace WebMVC.Migrations
name: "AspNetUserRoles", name: "AspNetUserRoles",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -158,16 +146,38 @@ namespace WebMVC.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName");
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId", name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims", table: "AspNetRoleClaims",
column: "RoleId"); column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true,
filter: "[NormalizedName] IS NOT NULL");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId", name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims", table: "AspNetUserClaims",
@ -183,11 +193,6 @@ namespace WebMVC.Migrations
table: "AspNetUserRoles", table: "AspNetUserRoles",
column: "RoleId"); column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_UserId",
table: "AspNetUserRoles",
column: "UserId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "EmailIndex", name: "EmailIndex",
table: "AspNetUsers", table: "AspNetUsers",
@ -197,7 +202,8 @@ namespace WebMVC.Migrations
name: "UserNameIndex", name: "UserNameIndex",
table: "AspNetUsers", table: "AspNetUsers",
column: "NormalizedUserName", column: "NormalizedUserName",
unique: true);
unique: true,
filter: "[NormalizedUserName] IS NOT NULL");
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)

src/Services/Identity/Identity.API/Data/Migrations/ApplicationDbContextModelSnapshot.cs → src/Services/Identity/Identity.API/Migrations/ApplicationDbContextModelSnapshot.cs View File

@ -1,42 +1,133 @@
using System;
// <auto-generated />
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Identity.API.Data;
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
using System;
namespace WebMVC.Migrations
namespace Identity.API.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
modelBuilder.Entity("Identity.API.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id");
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName")
.IsRequired();
b.Property<string>("CardNumber")
.IsRequired();
b.Property<int>("CardType");
b.Property<string>("City")
.IsRequired();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country")
.IsRequired();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration")
.IsRequired();
b.Property<string>("LastName")
.IsRequired();
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber")
.IsRequired();
b.Property<string>("SecurityStamp");
b.Property<string>("State")
.IsRequired();
b.Property<string>("Street")
.IsRequired();
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("ZipCode")
.IsRequired();
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken();
b.Property<string>("Name") b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
.HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
.HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -55,7 +146,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetRoleClaims"); b.ToTable("AspNetRoleClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -74,7 +165,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserClaims"); b.ToTable("AspNetUserClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
@ -92,7 +183,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserLogins"); b.ToTable("AspNetUserLogins");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -102,12 +193,10 @@ namespace WebMVC.Migrations
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -122,123 +211,51 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserTokens"); b.ToTable("AspNetUserTokens");
}); });
modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName");
b.Property<string>("CardNumber");
b.Property<int>("CardType");
b.Property<string>("City");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country");
b.Property<string>("CountryCode");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration");
b.Property<string>("LastName");
b.Property<double>("Latitude");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<double>("Longitude");
b.Property<string>("Name");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("State");
b.Property<string>("StateCode");
b.Property<string>("Street");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("ZipCode");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
#pragma warning restore 612, 618
} }
} }
} }

src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170604151338_Init-configuration.Designer.cs → src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.Designer.cs View File

@ -1,20 +1,24 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations.ConfigurationDb namespace Identity.API.Migrations.ConfigurationDb
{ {
[DbContext(typeof(ConfigurationDbContext))] [DbContext(typeof(ConfigurationDbContext))]
[Migration("20170604151338_Init-configuration")]
partial class Initconfiguration
[Migration("20170912114152_Initial")]
partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
@ -165,6 +169,10 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<int>("AuthorizationCodeLifetime"); b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasMaxLength(200); .HasMaxLength(200);
@ -175,19 +183,26 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<string>("ClientUri") b.Property<string>("ClientUri")
.HasMaxLength(2000); .HasMaxLength(2000);
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin"); b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled"); b.Property<bool>("Enabled");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri");
b.Property<int>("IdentityTokenLifetime"); b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId"); b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri"); b.Property<string>("LogoUri");
b.Property<bool>("LogoutSessionRequired");
b.Property<string>("LogoutUri");
b.Property<string>("NormalizedClientId");
b.Property<bool>("PrefixClientClaims"); b.Property<bool>("PrefixClientClaims");
@ -316,6 +331,29 @@ namespace Identity.API.Migrations.ConfigurationDb
b.ToTable("ClientPostLogoutRedirectUris"); b.ToTable("ClientPostLogoutRedirectUris");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -503,6 +541,14 @@ namespace Identity.API.Migrations.ConfigurationDb
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{ {
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
@ -534,6 +580,7 @@ namespace Identity.API.Migrations.ConfigurationDb
.HasForeignKey("IdentityResourceId") .HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
#pragma warning restore 612, 618
} }
} }
} }

src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170604151338_Init-configuration.cs → src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.cs View File

@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
namespace Identity.API.Migrations.ConfigurationDb namespace Identity.API.Migrations.ConfigurationDb
{ {
public partial class Initconfiguration : Migration
public partial class Initial : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -13,12 +13,12 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiResources", name: "ApiResources",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false)
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -29,37 +29,42 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "Clients", name: "Clients",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
AbsoluteRefreshTokenLifetime = table.Column<int>(nullable: false),
AccessTokenLifetime = table.Column<int>(nullable: false),
AccessTokenType = table.Column<int>(nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(nullable: false),
AllowOfflineAccess = table.Column<bool>(nullable: false),
AllowPlainTextPkce = table.Column<bool>(nullable: false),
AllowRememberConsent = table.Column<bool>(nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(nullable: false),
AlwaysSendClientClaims = table.Column<bool>(nullable: false),
AuthorizationCodeLifetime = table.Column<int>(nullable: false),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
ClientName = table.Column<string>(maxLength: 200, nullable: true),
ClientUri = table.Column<string>(maxLength: 2000, nullable: true),
EnableLocalLogin = table.Column<bool>(nullable: false),
Enabled = table.Column<bool>(nullable: false),
IdentityTokenLifetime = table.Column<int>(nullable: false),
IncludeJwtId = table.Column<bool>(nullable: false),
LogoUri = table.Column<string>(nullable: true),
LogoutSessionRequired = table.Column<bool>(nullable: false),
LogoutUri = table.Column<string>(nullable: true),
PrefixClientClaims = table.Column<bool>(nullable: false),
ProtocolType = table.Column<string>(maxLength: 200, nullable: false),
RefreshTokenExpiration = table.Column<int>(nullable: false),
RefreshTokenUsage = table.Column<int>(nullable: false),
RequireClientSecret = table.Column<bool>(nullable: false),
RequireConsent = table.Column<bool>(nullable: false),
RequirePkce = table.Column<bool>(nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(nullable: false)
AbsoluteRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
AccessTokenLifetime = table.Column<int>(type: "int", nullable: false),
AccessTokenType = table.Column<int>(type: "int", nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(type: "bit", nullable: false),
AllowOfflineAccess = table.Column<bool>(type: "bit", nullable: false),
AllowPlainTextPkce = table.Column<bool>(type: "bit", nullable: false),
AllowRememberConsent = table.Column<bool>(type: "bit", nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "bit", nullable: false),
AlwaysSendClientClaims = table.Column<bool>(type: "bit", nullable: false),
AuthorizationCodeLifetime = table.Column<int>(type: "int", nullable: false),
BackChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false),
BackChannelLogoutUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
ClientName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ClientUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
ConsentLifetime = table.Column<int>(type: "int", nullable: true),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
EnableLocalLogin = table.Column<bool>(type: "bit", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
FrontChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false),
FrontChannelLogoutUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
IdentityTokenLifetime = table.Column<int>(type: "int", nullable: false),
IncludeJwtId = table.Column<bool>(type: "bit", nullable: false),
LogoUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
NormalizedClientId = table.Column<string>(type: "nvarchar(max)", nullable: true),
PrefixClientClaims = table.Column<bool>(type: "bit", nullable: false),
ProtocolType = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
RefreshTokenExpiration = table.Column<int>(type: "int", nullable: false),
RefreshTokenUsage = table.Column<int>(type: "int", nullable: false),
RequireClientSecret = table.Column<bool>(type: "bit", nullable: false),
RequireConsent = table.Column<bool>(type: "bit", nullable: false),
RequirePkce = table.Column<bool>(type: "bit", nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "bit", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -70,15 +75,15 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "IdentityResources", name: "IdentityResources",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(nullable: false),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
Required = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false)
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(type: "bit", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -89,10 +94,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiClaims", name: "ApiClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 200, nullable: false)
ApiResourceId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -109,15 +114,15 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiScopes", name: "ApiScopes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(nullable: false),
Description = table.Column<string>(maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
Required = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false)
ApiResourceId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -134,13 +139,13 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiSecrets", name: "ApiSecrets",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(nullable: false),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(maxLength: 250, nullable: true),
Value = table.Column<string>(maxLength: 2000, nullable: true)
ApiResourceId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -157,11 +162,11 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientClaims", name: "ClientClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 250, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -178,10 +183,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientCorsOrigins", name: "ClientCorsOrigins",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Origin = table.Column<string>(maxLength: 150, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Origin = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -198,10 +203,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientGrantTypes", name: "ClientGrantTypes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
GrantType = table.Column<string>(maxLength: 250, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
GrantType = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -218,10 +223,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientIdPRestrictions", name: "ClientIdPRestrictions",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Provider = table.Column<string>(maxLength: 200, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Provider = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -238,10 +243,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientPostLogoutRedirectUris", name: "ClientPostLogoutRedirectUris",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
PostLogoutRedirectUri = table.Column<string>(maxLength: 2000, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
PostLogoutRedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -254,14 +259,35 @@ namespace Identity.API.Migrations.ConfigurationDb
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "ClientProperties",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false),
Key = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientProperties", x => x.Id);
table.ForeignKey(
name: "FK_ClientProperties_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ClientRedirectUris", name: "ClientRedirectUris",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
RedirectUri = table.Column<string>(maxLength: 2000, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
RedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -278,10 +304,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientScopes", name: "ClientScopes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Scope = table.Column<string>(maxLength: 200, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Scope = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -298,13 +324,13 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientSecrets", name: "ClientSecrets",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Description = table.Column<string>(maxLength: 2000, nullable: true),
Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(maxLength: 250, nullable: true),
Value = table.Column<string>(maxLength: 2000, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -321,10 +347,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "IdentityClaims", name: "IdentityClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
IdentityResourceId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 200, nullable: false)
IdentityResourceId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -341,10 +367,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiScopeClaims", name: "ApiScopeClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiScopeId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 200, nullable: false)
ApiScopeId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -357,6 +383,11 @@ namespace Identity.API.Migrations.ConfigurationDb
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex(
name: "IX_ApiClaims_ApiResourceId",
table: "ApiClaims",
column: "ApiResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiResources_Name", name: "IX_ApiResources_Name",
table: "ApiResources", table: "ApiResources",
@ -364,9 +395,9 @@ namespace Identity.API.Migrations.ConfigurationDb
unique: true); unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiClaims_ApiResourceId",
table: "ApiClaims",
column: "ApiResourceId");
name: "IX_ApiScopeClaims_ApiScopeId",
table: "ApiScopeClaims",
column: "ApiScopeId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiScopes_ApiResourceId", name: "IX_ApiScopes_ApiResourceId",
@ -379,22 +410,11 @@ namespace Identity.API.Migrations.ConfigurationDb
column: "Name", column: "Name",
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ApiScopeId",
table: "ApiScopeClaims",
column: "ApiScopeId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiSecrets_ApiResourceId", name: "IX_ApiSecrets_ApiResourceId",
table: "ApiSecrets", table: "ApiSecrets",
column: "ApiResourceId"); column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_Clients_ClientId",
table: "Clients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ClientClaims_ClientId", name: "IX_ClientClaims_ClientId",
table: "ClientClaims", table: "ClientClaims",
@ -420,11 +440,22 @@ namespace Identity.API.Migrations.ConfigurationDb
table: "ClientPostLogoutRedirectUris", table: "ClientPostLogoutRedirectUris",
column: "ClientId"); column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientProperties_ClientId",
table: "ClientProperties",
column: "ClientId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ClientRedirectUris_ClientId", name: "IX_ClientRedirectUris_ClientId",
table: "ClientRedirectUris", table: "ClientRedirectUris",
column: "ClientId"); column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Clients_ClientId",
table: "Clients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ClientScopes_ClientId", name: "IX_ClientScopes_ClientId",
table: "ClientScopes", table: "ClientScopes",
@ -473,6 +504,9 @@ namespace Identity.API.Migrations.ConfigurationDb
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ClientPostLogoutRedirectUris"); name: "ClientPostLogoutRedirectUris");
migrationBuilder.DropTable(
name: "ClientProperties");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ClientRedirectUris"); name: "ClientRedirectUris");

+ 53
- 6
src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs View File

@ -1,9 +1,12 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations.ConfigurationDb namespace Identity.API.Migrations.ConfigurationDb
{ {
@ -12,8 +15,9 @@ namespace Identity.API.Migrations.ConfigurationDb
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
@ -164,6 +168,10 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<int>("AuthorizationCodeLifetime"); b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasMaxLength(200); .HasMaxLength(200);
@ -174,19 +182,26 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<string>("ClientUri") b.Property<string>("ClientUri")
.HasMaxLength(2000); .HasMaxLength(2000);
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin"); b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled"); b.Property<bool>("Enabled");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri");
b.Property<int>("IdentityTokenLifetime"); b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId"); b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri"); b.Property<string>("LogoUri");
b.Property<bool>("LogoutSessionRequired");
b.Property<string>("LogoutUri");
b.Property<string>("NormalizedClientId");
b.Property<bool>("PrefixClientClaims"); b.Property<bool>("PrefixClientClaims");
@ -315,6 +330,29 @@ namespace Identity.API.Migrations.ConfigurationDb
b.ToTable("ClientPostLogoutRedirectUris"); b.ToTable("ClientPostLogoutRedirectUris");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -502,6 +540,14 @@ namespace Identity.API.Migrations.ConfigurationDb
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{ {
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
@ -533,6 +579,7 @@ namespace Identity.API.Migrations.ConfigurationDb
.HasForeignKey("IdentityResourceId") .HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
#pragma warning restore 612, 618
} }
} }
} }

src/Services/Identity/Identity.API/Migrations/20170604151240_Init-persisted-grant.Designer.cs → src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.Designer.cs View File

@ -1,20 +1,23 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations
namespace Identity.API.Migrations.PersistedGrantDb
{ {
[DbContext(typeof(PersistedGrantDbContext))] [DbContext(typeof(PersistedGrantDbContext))]
[Migration("20170604151240_Init-persisted-grant")]
partial class Initpersistedgrant
[Migration("20170912114120_Initial")]
partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
@ -47,6 +50,7 @@ namespace Identity.API.Migrations
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
#pragma warning restore 612, 618
} }
} }
} }

+ 40
- 0
src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.cs View File

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace Identity.API.Migrations.PersistedGrantDb
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PersistedGrants",
columns: table => new
{
Key = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PersistedGrants", x => x.Key);
});
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_SubjectId_ClientId_Type",
table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PersistedGrants");
}
}
}

src/Services/Identity/Identity.API/Migrations/PersistedGrantDbContextModelSnapshot.cs → src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs View File

@ -1,19 +1,22 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations
namespace Identity.API.Migrations.PersistedGrantDb
{ {
[DbContext(typeof(PersistedGrantDbContext))] [DbContext(typeof(PersistedGrantDbContext))]
partial class PersistedGrantDbContextModelSnapshot : ModelSnapshot partial class PersistedGrantDbContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
@ -46,6 +49,7 @@ namespace Identity.API.Migrations
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
#pragma warning restore 612, 618
} }
} }
} }

+ 2
- 6
src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentInputModel.cs View File

@ -1,10 +1,6 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.Collections.Generic;
using System.Collections.Generic;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class ConsentInputModel public class ConsentInputModel
{ {


+ 2
- 4
src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs View File

@ -1,12 +1,10 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using IdentityServer4.Models; using IdentityServer4.Models;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class ConsentViewModel : ConsentInputModel public class ConsentViewModel : ConsentInputModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class ExternalLoginConfirmationViewModel public class ExternalLoginConfirmationViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/AccountViewModels/ForgotPasswordViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class ForgotPasswordViewModel public class ForgotPasswordViewModel
{ {


+ 1
- 5
src/Services/Identity/Identity.API/Models/AccountViewModels/LoggedOutViewModel.cs View File

@ -1,8 +1,4 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class LoggedOutViewModel public class LoggedOutViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/AccountViewModels/LoginViewModel.cs View File

@ -1,10 +1,6 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class LoginViewModel public class LoginViewModel
{ {


+ 1
- 5
src/Services/Identity/Identity.API/Models/AccountViewModels/LogoutViewModel.cs View File

@ -1,8 +1,4 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class LogoutViewModel public class LogoutViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/AccountViewModels/RegisterViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class RegisterViewModel public class RegisterViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/AccountViewModels/ResetPasswordViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class ResetPasswordViewModel public class ResetPasswordViewModel
{ {


+ 2
- 5
src/Services/Identity/Identity.API/Models/AccountViewModels/SendCodeViewModel.cs View File

@ -1,10 +1,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class SendCodeViewModel public class SendCodeViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/AccountViewModels/VerifyCodeViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.AccountViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{ {
public class VerifyCodeViewModel public class VerifyCodeViewModel
{ {


+ 0
- 20
src/Services/Identity/Identity.API/Models/AccountViewModels/_LoginViewModel.cs View File

@ -1,20 +0,0 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.Collections.Generic;
namespace Identity.API.Models.AccountViewModels
{
//public class _LoginViewModel : LoginViewModel
//{
// public bool EnableLocalLogin { get; set; }
// public IEnumerable<ExternalProvider> ExternalProviders { get; set; }
//}
//public class ExternalProvider
//{
// public string DisplayName { get; set; }
// public string AuthenticationScheme { get; set; }
//}
}

+ 2
- 6
src/Services/Identity/Identity.API/Models/ApplicationUser.cs View File

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models
{ {
// Add profile data for application users by adding properties to the ApplicationUser class // Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser public class ApplicationUser : IdentityUser


+ 1
- 1
src/Services/Identity/Identity.API/Models/ErrorViewModel.cs View File

@ -4,7 +4,7 @@
using IdentityServer4.Models; using IdentityServer4.Models;
namespace IdentityServer4.Quickstart.UI.Models
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models
{ {
public class ErrorViewModel public class ErrorViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/ManageViewModels/AddPhoneNumberViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class AddPhoneNumberViewModel public class AddPhoneNumberViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/ManageViewModels/ChangePasswordViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class ChangePasswordViewModel public class ChangePasswordViewModel
{ {


+ 2
- 5
src/Services/Identity/Identity.API/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs View File

@ -1,10 +1,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class ConfigureTwoFactorViewModel public class ConfigureTwoFactorViewModel
{ {


+ 1
- 6
src/Services/Identity/Identity.API/Models/ManageViewModels/FactorViewModel.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class FactorViewModel public class FactorViewModel
{ {


+ 2
- 5
src/Services/Identity/Identity.API/Models/ManageViewModels/IndexViewModel.cs View File

@ -1,10 +1,7 @@
using System;
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class IndexViewModel public class IndexViewModel
{ {


+ 3
- 6
src/Services/Identity/Identity.API/Models/ManageViewModels/ManageLoginsViewModel.cs View File

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class ManageLoginsViewModel public class ManageLoginsViewModel
{ {


+ 1
- 7
src/Services/Identity/Identity.API/Models/ManageViewModels/RemoveLoginViewModel.cs View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class RemoveLoginViewModel public class RemoveLoginViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/ManageViewModels/SetPasswordViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class SetPasswordViewModel public class SetPasswordViewModel
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models.ManageViewModels
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
{ {
public class VerifyPhoneNumberViewModel public class VerifyPhoneNumberViewModel
{ {


+ 40
- 6
src/Services/Identity/Identity.API/Program.cs View File

@ -1,21 +1,55 @@
using Microsoft.AspNetCore.Hosting;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.IO; using System.IO;
namespace eShopOnContainers.Identity
namespace Microsoft.eShopOnContainers.Services.Identity.API
{ {
public class Program public class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
var host = new WebHostBuilder()
BuildWebHost(args)
.MigrateDbContext<PersistedGrantDbContext>((_, __) => { })
.MigrateDbContext<ApplicationDbContext>((context, services) =>
{
var env = services.GetService<IHostingEnvironment>();
var logger = services.GetService<ILogger<ApplicationDbContextSeed>>();
var settings = services.GetService<IOptions<AppSettings>>();
new ApplicationDbContextSeed()
.SeedAsync(context, env, logger, settings)
.Wait();
})
.MigrateDbContext<ConfigurationDbContext>((context,services)=>
{
var configuration = services.GetService<IConfiguration>();
new ConfigurationDbContextSeed()
.SeedAsync(context, configuration)
.Wait();
}).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel() .UseKestrel()
.UseHealthChecks("/hc") .UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration() .UseIISIntegration()
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.Build(); .Build();
host.Run();
}
} }
} }

+ 3
- 6
src/Services/Identity/Identity.API/Services/EFLoginService.cs View File

@ -1,11 +1,8 @@
using Identity.API.Models;
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Identity;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
public class EFLoginService : ILoginService<ApplicationUser> public class EFLoginService : ILoginService<ApplicationUser>
{ {


+ 2
- 5
src/Services/Identity/Identity.API/Services/IEmailSender.cs View File

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
public interface IEmailSender public interface IEmailSender
{ {


+ 2
- 5
src/Services/Identity/Identity.API/Services/ILoginService.cs View File

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
public interface ILoginService<T> public interface ILoginService<T>
{ {


+ 1
- 6
src/Services/Identity/Identity.API/Services/IRedirectService.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
public interface IRedirectService public interface IRedirectService
{ {


+ 2
- 5
src/Services/Identity/Identity.API/Services/ISmsSender.cs View File

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
public interface ISmsSender public interface ISmsSender
{ {


+ 2
- 5
src/Services/Identity/Identity.API/Services/MessageServices.cs View File

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
// This class is used by the application to send Email and SMS // This class is used by the application to send Email and SMS
// when you turn on two-factor authentication in ASP.NET Identity. // when you turn on two-factor authentication in ASP.NET Identity.


+ 7
- 7
src/Services/Identity/Identity.API/Services/ProfileService.cs View File

@ -1,15 +1,15 @@
using IdentityServer4.Services;
using IdentityModel;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.AspNetCore.Identity;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using IdentityServer4.Models;
using Microsoft.AspNetCore.Identity;
using Identity.API.Models;
using System.Security.Claims; using System.Security.Claims;
using IdentityModel;
using System.Threading.Tasks;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
public class ProfileService : IProfileService public class ProfileService : IProfileService
{ {


+ 2
- 6
src/Services/Identity/Identity.API/Services/RedirectService.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
namespace Identity.API.Services
namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
{ {
public class RedirectService : IRedirectService public class RedirectService : IRedirectService
{ {


+ 22
- 92
src/Services/Identity/Identity.API/Startup.cs View File

@ -1,64 +1,44 @@
using Autofac; using Autofac;
using Autofac.Extensions.DependencyInjection; using Autofac.Extensions.DependencyInjection;
using Identity.API.Certificate;
using Identity.API.Configuration;
using Identity.API.Data;
using Identity.API.Models;
using Identity.API.Services;
using IdentityServer4.EntityFramework.DbContexts;
using IdentityServer4.EntityFramework.Mappers;
using IdentityServer4.Services; using IdentityServer4.Services;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks; using Microsoft.eShopOnContainers.BuildingBlocks;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Identity.API.Certificates;
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using Microsoft.eShopOnContainers.Services.Identity.API.Services;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.HealthChecks; using Microsoft.Extensions.HealthChecks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
namespace eShopOnContainers.Identity
namespace Microsoft.eShopOnContainers.Services.Identity.API
{ {
public class Startup public class Startup
{ {
public Startup(IHostingEnvironment env)
public Startup(IConfiguration configuration)
{ {
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
if (env.IsDevelopment())
{
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets<Startup>();
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
Configuration = configuration;
} }
public IConfigurationRoot Configuration { get; }
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
// Add framework services. // Add framework services.
services.AddDbContext<ApplicationDbContext>(options => services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>() services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>() .AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
.AddDefaultTokenProviders()
.AddIdentityServer();
services.Configure<AppSettings>(Configuration); services.Configure<AppSettings>(Configuration);
@ -95,16 +75,21 @@ namespace eShopOnContainers.Identity
services.AddIdentityServer(x => x.IssuerUri = "null") services.AddIdentityServer(x => x.IssuerUri = "null")
.AddSigningCredential(Certificate.Get()) .AddSigningCredential(Certificate.Get())
.AddAspNetIdentity<ApplicationUser>() .AddAspNetIdentity<ApplicationUser>()
.AddConfigurationStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddOperationalStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, opts =>
opts.MigrationsAssembly(migrationsAssembly));
})
.AddOperationalStore(options =>
{
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, opts =>
opts.MigrationsAssembly(migrationsAssembly));
})
.Services.AddTransient<IProfileService, ProfileService>(); .Services.AddTransient<IProfileService, ProfileService>();
var container = new ContainerBuilder(); var container = new ContainerBuilder();
container.Populate(services); container.Populate(services);
return new AutofacServiceProvider(container.Build()); return new AutofacServiceProvider(container.Build());
} }
@ -118,7 +103,6 @@ namespace eShopOnContainers.Identity
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage(); app.UseDatabaseErrorPage();
app.UseBrowserLink();
} }
else else
{ {
@ -142,7 +126,7 @@ namespace eShopOnContainers.Identity
await next(); await next();
}); });
app.UseIdentity();
app.UseAuthentication();
// Adds IdentityServer // Adds IdentityServer
app.UseIdentityServer(); app.UseIdentityServer();
@ -153,60 +137,6 @@ namespace eShopOnContainers.Identity
name: "default", name: "default",
template: "{controller=Home}/{action=Index}/{id?}"); template: "{controller=Home}/{action=Index}/{id?}");
}); });
// Store idsrv grant config into db
InitializeGrantStoreAndConfiguration(app).Wait();
//Seed Data
var hasher = new PasswordHasher<ApplicationUser>();
new ApplicationContextSeed(hasher).SeedAsync(app, env, loggerFactory).Wait();
}
private async Task InitializeGrantStoreAndConfiguration(IApplicationBuilder app)
{
//callbacks urls from config:
Dictionary<string, string> clientUrls = new Dictionary<string, string>();
clientUrls.Add("Mvc", Configuration.GetValue<string>("MvcClient"));
clientUrls.Add("Spa", Configuration.GetValue<string>("SpaClient"));
clientUrls.Add("Xamarin", Configuration.GetValue<string>("XamarinCallback"));
clientUrls.Add("LocationsApi", Configuration.GetValue<string>("LocationApiClient"));
clientUrls.Add("MarketingApi", Configuration.GetValue<string>("MarketingApiClient"));
clientUrls.Add("BasketApi", Configuration.GetValue<string>("BasketApiClient"));
clientUrls.Add("OrderingApi", Configuration.GetValue<string>("OrderingApiClient"));
using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope())
{
serviceScope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>().Database.Migrate();
var context = serviceScope.ServiceProvider.GetRequiredService<ConfigurationDbContext>();
context.Database.Migrate();
if (!context.Clients.Any())
{
foreach (var client in Config.GetClients(clientUrls))
{
await context.Clients.AddAsync(client.ToEntity());
}
await context.SaveChangesAsync();
}
if (!context.IdentityResources.Any())
{
foreach (var resource in Config.GetResources())
{
await context.IdentityResources.AddAsync(resource.ToEntity());
}
await context.SaveChangesAsync();
}
if (!context.ApiResources.Any())
{
foreach (var api in Config.GetApis())
{
await context.ApiResources.AddAsync(api.ToEntity());
}
await context.SaveChangesAsync();
}
}
} }
} }
} }

+ 1
- 1
src/Services/Identity/Identity.API/Views/Account/LoggedOut.cshtml View File

@ -1,4 +1,4 @@
@model Identity.API.Models.AccountViewModels.LoggedOutViewModel
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.LoggedOutViewModel
<div class="container page-header"> <div class="container page-header">
<h1> <h1>


+ 1
- 1
src/Services/Identity/Identity.API/Views/Account/Login.cshtml View File

@ -1,7 +1,7 @@
@using System.Collections.Generic @using System.Collections.Generic
@using Microsoft.AspNetCore.Http @using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Authentication @using Microsoft.AspNetCore.Http.Authentication
@model Identity.API.Models.AccountViewModels.LoginViewModel
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.LoginViewModel
@{ @{


+ 1
- 1
src/Services/Identity/Identity.API/Views/Account/Logout.cshtml View File

@ -1,4 +1,4 @@
@model Identity.API.Models.AccountViewModels.LogoutViewModel
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.LogoutViewModel
<div class="container logout-page"> <div class="container logout-page">
<div class="page-header"> <div class="page-header">


+ 1
- 2
src/Services/Identity/Identity.API/Views/Account/Register.cshtml View File

@ -1,5 +1,4 @@
@using Identity.API.Models.AccountViewModels
@model RegisterViewModel
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.RegisterViewModel
@{ @{
ViewData["Title"] = "Register"; ViewData["Title"] = "Register";
} }


+ 1
- 1
src/Services/Identity/Identity.API/Views/Consent/Index.cshtml View File

@ -1,4 +1,4 @@
@model Identity.API.Models.AccountViewModels.ConsentViewModel
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.ConsentViewModel
<div class="container page-consent"> <div class="container page-consent">
<div class="row page-header"> <div class="row page-header">


+ 1
- 1
src/Services/Identity/Identity.API/Views/Consent/_ScopeListItem.cshtml View File

@ -1,4 +1,4 @@
@model Identity.API.Models.AccountViewModels.ScopeViewModel
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.ScopeViewModel
<li class="list-group-item"> <li class="list-group-item">
<label> <label>


+ 1
- 1
src/Services/Identity/Identity.API/Views/Shared/Error.cshtml View File

@ -1,4 +1,4 @@
@model IdentityServer4.Quickstart.UI.Models.ErrorViewModel
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.ErrorViewModel
@{ @{
var error = Model?.Error?.Error; var error = Model?.Error?.Error;


+ 12
- 0
src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs View File

@ -2,6 +2,7 @@
{ {
using EntityConfigurations; using EntityConfigurations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.eShopOnContainers.Services.Marketing.API.Model; using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
public class MarketingContext : DbContext public class MarketingContext : DbContext
@ -21,4 +22,15 @@
builder.ApplyConfiguration(new UserLocationRuleEntityTypeConfiguration()); builder.ApplyConfiguration(new UserLocationRuleEntityTypeConfiguration());
} }
} }
public class MarketingContextDesignFactory : IDesignTimeDbContextFactory<MarketingContext>
{
public MarketingContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<MarketingContext>()
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;Integrated Security=true");
return new MarketingContext(optionsBuilder.Options);
}
}
} }

+ 27
- 14
src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs View File

@ -1,33 +1,33 @@
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure
{ {
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Marketing.API.Model; using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Polly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
public static class MarketingContextSeed
public class MarketingContextSeed
{ {
public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0)
public async Task SeedAsync(MarketingContext context,ILogger<MarketingContextSeed> logger,int retries = 3)
{ {
var context = (MarketingContext)applicationBuilder
.ApplicationServices.GetService(typeof(MarketingContext));
var policy = CreatePolicy(retries, logger, nameof(MarketingContextSeed));
context.Database.Migrate();
if (!context.Campaigns.Any())
await policy.ExecuteAsync(async () =>
{ {
context.Campaigns.AddRange(
GetPreconfiguredMarketings());
if (!context.Campaigns.Any())
{
context.Campaigns.AddRange(
GetPreconfiguredMarketings());
await context.SaveChangesAsync();
}
await context.SaveChangesAsync();
}
});
} }
static List<Campaign> GetPreconfiguredMarketings()
private List<Campaign> GetPreconfiguredMarketings()
{ {
return new List<Campaign> return new List<Campaign>
{ {
@ -67,5 +67,18 @@
} }
}; };
} }
private Policy CreatePolicy(int retries, ILogger<MarketingContextSeed> logger, string prefix)
{
return Policy.Handle<SqlException>().
WaitAndRetryAsync(
retryCount: retries,
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}
} }
} }

+ 3
- 0
src/Services/Marketing/Marketing.API/Infrastructure/MarketingReadDataContext.cs View File

@ -11,8 +11,11 @@
public MarketingReadDataContext(IOptions<MarketingSettings> settings) public MarketingReadDataContext(IOptions<MarketingSettings> settings)
{ {
var client = new MongoClient(settings.Value.MongoConnectionString); var client = new MongoClient(settings.Value.MongoConnectionString);
if (client != null) if (client != null)
{
_database = client.GetDatabase(settings.Value.MongoDatabase); _database = client.GetDatabase(settings.Value.MongoDatabase);
}
} }
public IMongoCollection<MarketingData> MarketingData public IMongoCollection<MarketingData> MarketingData


+ 1
- 0
src/Services/Marketing/Marketing.API/Marketing.API.csproj View File

@ -34,6 +34,7 @@
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


+ 12
- 1
src/Services/Marketing/Marketing.API/Program.cs View File

@ -2,6 +2,8 @@
{ {
using AspNetCore.Hosting; using AspNetCore.Hosting;
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.IO; using System.IO;
@ -9,7 +11,16 @@
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
BuildWebHost(args).Run();
BuildWebHost(args)
.MigrateDbContext<MarketingContext>((context, services) =>
{
var logger = services.GetService<ILogger<MarketingContextSeed>>();
new MarketingContextSeed()
.SeedAsync(context,logger)
.Wait();
}).Run();
} }
public static IWebHost BuildWebHost(string[] args) => public static IWebHost BuildWebHost(string[] args) =>


+ 8
- 32
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -21,13 +21,12 @@
using Infrastructure.Services; using Infrastructure.Services;
using IntegrationEvents.Events; using IntegrationEvents.Events;
using Marketing.API.IntegrationEvents.Handlers; using Marketing.API.IntegrationEvents.Handlers;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Diagnostics;
using Polly;
using RabbitMQ.Client; using RabbitMQ.Client;
using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.Swagger;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlClient;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -174,6 +173,7 @@
public void Configure(IApplicationBuilder app, IHostingEnvironment env,ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IHostingEnvironment env,ILoggerFactory loggerFactory)
{ {
var pathBase = Configuration["PATH_BASE"]; var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase)) if (!string.IsNullOrEmpty(pathBase))
{ {
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
@ -192,11 +192,6 @@
c.ConfigureOAuth2("marketingswaggerui", "", "", "Marketing Swagger UI"); c.ConfigureOAuth2("marketingswaggerui", "", "", "Marketing Swagger UI");
}); });
var context = (MarketingContext)app
.ApplicationServices.GetService(typeof(MarketingContext));
WaitForSqlAvailabilityAsync(context, loggerFactory, app).Wait();
ConfigureEventBus(app); ConfigureEventBus(app);
} }
@ -205,8 +200,12 @@
// prevent from mapping "sub" claim to nameidentifier. // prevent from mapping "sub" claim to nameidentifier.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
services.AddAuthentication()
.AddJwtBearer(options =>
services.AddAuthentication(options=>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{ {
options.Authority = Configuration.GetValue<string>("IdentityUrl"); options.Authority = Configuration.GetValue<string>("IdentityUrl");
options.Audience = "marketing"; options.Audience = "marketing";
@ -249,28 +248,5 @@
{ {
app.UseAuthentication(); app.UseAuthentication();
} }
private async Task WaitForSqlAvailabilityAsync(MarketingContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, int retries = 0)
{
var logger = loggerFactory.CreateLogger(nameof(Startup));
var policy = CreatePolicy(retries, logger, nameof(WaitForSqlAvailabilityAsync));
await policy.ExecuteAsync(async () =>
{
await MarketingContextSeed.SeedAsync(app, loggerFactory);
});
}
private Policy CreatePolicy(int retries, ILogger logger, string prefix)
{
return Policy.Handle<SqlException>().
WaitAndRetryAsync(
retryCount: retries,
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}
} }
} }

+ 57
- 43
src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs View File

@ -1,63 +1,64 @@
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure
{ {
using AspNetCore.Builder; using AspNetCore.Builder;
using global::Ordering.API.Extensions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Ordering.Domain;
using Ordering.Infrastructure;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using System.Collections.Generic;
using Microsoft.AspNetCore.Hosting;
using System.IO;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Ordering.Infrastructure;
using Polly;
using System; using System;
using global::Ordering.API.Extensions;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
public class OrderingContextSeed public class OrderingContextSeed
{ {
public static async Task SeedAsync(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory)
public async Task SeedAsync(OrderingContext context, IHostingEnvironment env,IOptions<OrderingSettings> settings, ILogger<OrderingContextSeed> logger)
{ {
var log = loggerFactory.CreateLogger("ordering seed");
var policy = CreatePolicy(logger, nameof(OrderingContextSeed));
var context = (OrderingContext)applicationBuilder
.ApplicationServices.GetService(typeof(OrderingContext));
var settings = applicationBuilder
.ApplicationServices.GetRequiredService<IOptions<OrderingSettings>>().Value;
await policy.ExecuteAsync(async () =>
{
var useCustomizationData = settings.UseCustomizationData;
var contentRootPath = env.ContentRootPath;
var useCustomizationData = settings.Value
.UseCustomizationData;
var contentRootPath = env.ContentRootPath;
using (context)
{
context.Database.Migrate();
if (!context.CardTypes.Any())
using (context)
{ {
context.CardTypes.AddRange(useCustomizationData
? GetCardTypesFromFile(contentRootPath, log)
: GetPredefinedCardTypes());
context.Database.Migrate();
await context.SaveChangesAsync();
}
if (!context.CardTypes.Any())
{
context.CardTypes.AddRange(useCustomizationData
? GetCardTypesFromFile(contentRootPath, logger)
: GetPredefinedCardTypes());
if (!context.OrderStatus.Any())
{
context.OrderStatus.AddRange(useCustomizationData
? GetOrderStatusFromFile(contentRootPath, log)
: GetPredefinedOrderStatus());
}
await context.SaveChangesAsync();
}
await context.SaveChangesAsync();
}
if (!context.OrderStatus.Any())
{
context.OrderStatus.AddRange(useCustomizationData
? GetOrderStatusFromFile(contentRootPath, logger)
: GetPredefinedOrderStatus());
}
await context.SaveChangesAsync();
}
});
} }
static IEnumerable<CardType> GetCardTypesFromFile(string contentRootPath, ILogger log)
private IEnumerable<CardType> GetCardTypesFromFile(string contentRootPath, ILogger<OrderingContextSeed> log)
{ {
string csvFileCardTypes = Path.Combine(contentRootPath, "Setup", "CardTypes.csv"); string csvFileCardTypes = Path.Combine(contentRootPath, "Setup", "CardTypes.csv");
@ -86,7 +87,7 @@
.Where(x => x != null); .Where(x => x != null);
} }
static CardType CreateCardType(string value, ref int id)
private CardType CreateCardType(string value, ref int id)
{ {
if (String.IsNullOrEmpty(value)) if (String.IsNullOrEmpty(value))
{ {
@ -96,8 +97,7 @@
return new CardType(id++, value.Trim('"').Trim()); return new CardType(id++, value.Trim('"').Trim());
} }
private static IEnumerable<CardType> GetPredefinedCardTypes()
private IEnumerable<CardType> GetPredefinedCardTypes()
{ {
return new List<CardType>() return new List<CardType>()
{ {
@ -107,7 +107,7 @@
}; };
} }
static IEnumerable<OrderStatus> GetOrderStatusFromFile(string contentRootPath, ILogger log)
private IEnumerable<OrderStatus> GetOrderStatusFromFile(string contentRootPath, ILogger<OrderingContextSeed> log)
{ {
string csvFileOrderStatus = Path.Combine(contentRootPath, "Setup", "OrderStatus.csv"); string csvFileOrderStatus = Path.Combine(contentRootPath, "Setup", "OrderStatus.csv");
@ -136,7 +136,7 @@
.Where(x => x != null); .Where(x => x != null);
} }
static OrderStatus CreateOrderStatus(string value, ref int id)
private OrderStatus CreateOrderStatus(string value, ref int id)
{ {
if (String.IsNullOrEmpty(value)) if (String.IsNullOrEmpty(value))
{ {
@ -146,7 +146,7 @@
return new OrderStatus(id++, value.Trim('"').Trim().ToLowerInvariant()); return new OrderStatus(id++, value.Trim('"').Trim().ToLowerInvariant());
} }
static IEnumerable<OrderStatus> GetPredefinedOrderStatus()
private IEnumerable<OrderStatus> GetPredefinedOrderStatus()
{ {
return new List<OrderStatus>() return new List<OrderStatus>()
{ {
@ -159,7 +159,7 @@
}; };
} }
static string[] GetHeaders(string[] requiredHeaders, string csvfile)
private string[] GetHeaders(string[] requiredHeaders, string csvfile)
{ {
string[] csvheaders = File.ReadLines(csvfile).First().ToLowerInvariant().Split(','); string[] csvheaders = File.ReadLines(csvfile).First().ToLowerInvariant().Split(',');
@ -178,5 +178,19 @@
return csvheaders; return csvheaders;
} }
private Policy CreatePolicy( ILogger<OrderingContextSeed> logger, string prefix, int retries =3)
{
return Policy.Handle<SqlException>().
WaitAndRetryAsync(
retryCount: retries,
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}
} }
} }

+ 0
- 29
src/Services/Ordering/Ordering.API/Infrastructure/OrderingDbContextDesigner.cs View File

@ -1,29 +0,0 @@
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure
{
public class OrderingDbContextDesigner : IDesignTimeDbContextFactory<OrderingContext>
{
public OrderingContext CreateDbContext(string[] args)
{
var options = new DbContextOptionsBuilder<OrderingContext>();
options.UseSqlServer("Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;",
sqlServerOptionsAction: sqlOptions =>
{
sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name);
});
return OrderingContext.CreateForEFDesignTools(options.Options);
}
}
}

+ 1
- 0
src/Services/Ordering/Ordering.API/Ordering.API.csproj View File

@ -27,6 +27,7 @@
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj" />
<ProjectReference Include="..\Ordering.Domain\Ordering.Domain.csproj" /> <ProjectReference Include="..\Ordering.Domain\Ordering.Domain.csproj" />
<ProjectReference Include="..\Ordering.Infrastructure\Ordering.Infrastructure.csproj" /> <ProjectReference Include="..\Ordering.Infrastructure\Ordering.Infrastructure.csproj" />
</ItemGroup> </ItemGroup>


+ 18
- 1
src/Services/Ordering/Ordering.API/Program.cs View File

@ -1,6 +1,11 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.IO; using System.IO;
namespace Microsoft.eShopOnContainers.Services.Ordering.API namespace Microsoft.eShopOnContainers.Services.Ordering.API
@ -9,7 +14,19 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
BuildWebHost(args).Run();
BuildWebHost(args)
.MigrateDbContext<OrderingContext>((context, services) =>
{
var env = services.GetService<IHostingEnvironment>();
var settings = services.GetService<IOptions<OrderingSettings>>();
var logger = services.GetService<ILogger<OrderingContextSeed>>();
new OrderingContextSeed()
.SeedAsync(context, env, settings, logger)
.Wait();
})
.MigrateDbContext<IntegrationEventLogContext>((_,__)=>{})
.Run();
} }
public static IWebHost BuildWebHost(string[] args) => public static IWebHost BuildWebHost(string[] args) =>


+ 9
- 36
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -7,7 +7,6 @@
using global::Ordering.API.Application.IntegrationEvents.Events; using global::Ordering.API.Application.IntegrationEvents.Events;
using global::Ordering.API.Infrastructure.Filters; using global::Ordering.API.Infrastructure.Filters;
using global::Ordering.API.Infrastructure.HostedServices; using global::Ordering.API.Infrastructure.HostedServices;
using Infrastructure;
using Infrastructure.AutofacModules; using Infrastructure.AutofacModules;
using Infrastructure.Filters; using Infrastructure.Filters;
using Infrastructure.Services; using Infrastructure.Services;
@ -28,16 +27,13 @@
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Ordering.Infrastructure; using Ordering.Infrastructure;
using Polly;
using RabbitMQ.Client; using RabbitMQ.Client;
using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.Swagger;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Common; using System.Data.Common;
using System.Data.SqlClient;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
public class Startup public class Startup
{ {
@ -85,6 +81,15 @@
ServiceLifetime.Scoped //Showing explicitly that the DbContext is shared across the HTTP request scope (graph of objects started in the HTTP request) ServiceLifetime.Scoped //Showing explicitly that the DbContext is shared across the HTTP request scope (graph of objects started in the HTTP request)
); );
services.AddDbContext<IntegrationEventLogContext>(options =>
{
options.UseSqlServer(Configuration["ConnectionString"], opts =>
{
opts.MigrationsAssembly("Ordering.API");
});
});
services.Configure<OrderingSettings>(Configuration); services.Configure<OrderingSettings>(Configuration);
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
@ -208,14 +213,6 @@
c.ConfigureOAuth2("orderingswaggerui", "", "", "Ordering Swagger UI"); c.ConfigureOAuth2("orderingswaggerui", "", "", "Ordering Swagger UI");
}); });
WaitForSqlAvailabilityAsync(loggerFactory, app, env).Wait();
var integrationEventLogContext = new IntegrationEventLogContext(
new DbContextOptionsBuilder<IntegrationEventLogContext>()
.UseSqlServer(Configuration["ConnectionString"], b => b.MigrationsAssembly("Ordering.API"))
.Options);
integrationEventLogContext.Database.Migrate();
ConfigureEventBus(app); ConfigureEventBus(app);
} }
@ -279,29 +276,5 @@
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>(); services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
} }
private async Task WaitForSqlAvailabilityAsync(ILoggerFactory loggerFactory, IApplicationBuilder app, IHostingEnvironment env, int retries = 0)
{
var logger = loggerFactory.CreateLogger(nameof(Startup));
var policy = CreatePolicy(retries, logger, nameof(WaitForSqlAvailabilityAsync));
await policy.ExecuteAsync(async () =>
{
await OrderingContextSeed.SeedAsync(app, env, loggerFactory);
});
}
private Policy CreatePolicy(int retries, ILogger logger, string prefix)
{
return Policy.Handle<SqlException>().
WaitAndRetryAsync(
retryCount: retries,
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}
} }
} }

+ 32
- 8
src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs View File

@ -1,5 +1,6 @@
using MediatR; using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork; using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
@ -31,15 +32,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
private readonly IMediator _mediator; private readonly IMediator _mediator;
public static OrderingContext CreateForEFDesignTools(DbContextOptions options)
{
return new OrderingContext(options);
}
private OrderingContext(DbContextOptions options) : base (options) { }
private OrderingContext(DbContextOptions<OrderingContext> options) : base (options) { }
public OrderingContext(DbContextOptions options, IMediator mediator) : base(options)
public OrderingContext(DbContextOptions<OrderingContext> options, IMediator mediator) : base(options)
{ {
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
@ -76,4 +71,33 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
return true; return true;
} }
} }
public class OrderingContextDesignFactory : IDesignTimeDbContextFactory<OrderingContext>
{
public OrderingContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<OrderingContext>()
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;Integrated Security=true");
return new OrderingContext(optionsBuilder.Options,new NoMediator());
}
class NoMediator : IMediator
{
public Task Publish<TNotification>(TNotification notification, CancellationToken cancellationToken = default(CancellationToken)) where TNotification : INotification
{
return Task.CompletedTask;
}
public Task<TResponse> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default(CancellationToken))
{
return Task.FromResult<TResponse>(default(TResponse));
}
public Task Send(IRequest request, CancellationToken cancellationToken = default(CancellationToken))
{
return Task.CompletedTask;
}
}
}
} }

Loading…
Cancel
Save