Browse Source

[fix] V1ScpDbContext

master
贾荣国 3 years ago
parent
commit
e5a6132abf
  1. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  2. 122
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt
  3. 45
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs
  4. 47
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs
  5. 8
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs
  6. 202
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs
  7. 8
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs
  8. 37
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs
  9. 7
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/V1ScpEventModule.cs
  10. 81
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

@ -6,7 +6,7 @@
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"WebApi": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;"
"V1Scp": "Server=127.0.0.1;Database=Scp_V1;User ID=sa;Password=Microsoft2008;connection timeout=600;"
},
"AuthServer": {
"Authority": "https://localhost:9988",

122
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt

@ -5593,3 +5593,125 @@ System.Net.Http.HttpRequestException: Response status code does not indicate suc
2022-01-13 09:18:16.269 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 16097.5245ms
2022-01-13 09:18:16.269 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-13 09:18:16.271 +08:00 [INF] Request finished HTTP/2 POST https://localhost:9977/api/scp/part application/xml 543 - 200 1034 application/xml;+charset=utf-8 16164.5237ms
2022-01-13 17:16:32.805 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-13 17:16:33.922 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
2022-01-13 17:16:34.506 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-13 17:16:34.507 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-13 17:16:34.507 +08:00 [INF] Hosting environment: Development
2022-01-13 17:16:34.507 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-13 17:16:36.854 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/index.html - -
2022-01-13 17:16:37.409 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 558.1198ms
2022-01-13 17:16:37.424 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-13 17:16:37.427 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11964 application/javascript;+charset=utf-8 2.5674ms
2022-01-13 17:16:38.290 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-13 17:18:10.620 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-13 17:18:11.543 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
2022-01-13 17:18:12.344 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-13 17:18:12.344 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-13 17:18:12.344 +08:00 [INF] Hosting environment: Development
2022-01-13 17:18:12.344 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-13 17:18:14.043 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/index.html - -
2022-01-13 17:18:14.764 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-13 17:18:14.772 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11964 application/javascript;+charset=utf-8 6.5364ms
2022-01-13 17:18:14.785 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 739.3333ms
2022-01-13 17:18:16.283 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-14 16:20:12.601 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-14 16:20:15.613 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
2022-01-14 16:20:15.807 +08:00 [INF] Creating key {aa504a78-83ce-4280-86ce-6a4bea3824e3} with creation date 2022-01-14 08:20:15Z, activation date 2022-01-16 04:14:18Z, and expiration date 2022-04-14 08:20:15Z.
2022-01-14 16:20:15.843 +08:00 [INF] Writing data to file 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys\key-aa504a78-83ce-4280-86ce-6a4bea3824e3.xml'.
2022-01-14 16:20:16.885 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-14 16:20:16.885 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-14 16:20:16.885 +08:00 [INF] Hosting environment: Development
2022-01-14 16:20:16.885 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-14 16:20:21.067 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger - -
2022-01-14 16:20:21.645 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger - - - 301 0 - 581.0510ms
2022-01-14 16:20:21.793 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/index.html - -
2022-01-14 16:20:22.243 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 449.9605ms
2022-01-14 16:20:22.259 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/swagger-ui-standalone-preset.js - -
2022-01-14 16:20:22.259 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-14 16:20:22.260 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/swagger-ui-bundle.js - -
2022-01-14 16:20:22.261 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 2.1807ms
2022-01-14 16:20:22.262 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/swagger-ui.css - -
2022-01-14 16:20:22.302 +08:00 [INF] Sending file. Request path: '/swagger-ui-standalone-preset.js'. Physical path: 'N/A'
2022-01-14 16:20:22.307 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/swagger-ui-standalone-preset.js - - - 200 336841 application/javascript 47.3695ms
2022-01-14 16:20:22.309 +08:00 [INF] Sending file. Request path: '/swagger-ui.css'. Physical path: 'N/A'
2022-01-14 16:20:22.309 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/swagger-ui.css - - - 200 143410 text/css 47.2542ms
2022-01-14 16:20:22.328 +08:00 [INF] Sending file. Request path: '/swagger-ui-bundle.js'. Physical path: 'N/A'
2022-01-14 16:20:22.329 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/swagger-ui-bundle.js - - - 200 1097461 application/javascript 68.9070ms
2022-01-14 16:20:22.819 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-14 16:20:22.906 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/favicon-32x32.png - -
2022-01-14 16:20:22.907 +08:00 [INF] Sending file. Request path: '/favicon-32x32.png'. Physical path: 'N/A'
2022-01-14 16:20:22.907 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/favicon-32x32.png - - - 200 628 image/png 1.2248ms
2022-01-14 16:20:24.506 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 1687.1007ms
2022-01-14 16:21:38.133 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-14 16:21:39.121 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
2022-01-14 16:21:39.879 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-14 16:21:39.880 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-14 16:21:39.880 +08:00 [INF] Hosting environment: Development
2022-01-14 16:21:39.880 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-14 16:21:43.539 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/index.html - -
2022-01-14 16:21:43.962 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 428.1001ms
2022-01-14 16:21:43.963 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-14 16:21:43.975 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 12.2802ms
2022-01-14 16:21:44.232 +08:00 [INF] Request starting HTTP/2 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-14 16:21:44.686 +08:00 [INF] Request finished HTTP/2 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 454.5244ms
2022-01-14 16:23:40.316 +08:00 [INF] Request starting HTTP/2 POST https://localhost:9977/test/body?name=a application/xml 117
2022-01-14 16:23:40.353 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header
2022-01-14 16:23:40.354 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:23:40.378 +08:00 [INF] Route matched with {action = "BodyParamTest", controller = "Test"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book]] BodyParamTestAsync(System.String, System.String, Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-14 16:23:40.463 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-14 16:23:40.467 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 0.8298ms.
2022-01-14 16:23:40.470 +08:00 [INF] Executing ObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book'.
2022-01-14 16:23:40.479 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 98.1129ms
2022-01-14 16:23:40.479 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:23:40.480 +08:00 [INF] Request finished HTTP/2 POST https://localhost:9977/test/body?name=a application/xml 117 - 200 - application/json;+charset=utf-8 164.0594ms
2022-01-14 16:23:55.410 +08:00 [INF] Request starting HTTP/2 POST https://localhost:9977/test/body?name=a application/xml 117
2022-01-14 16:23:55.416 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header
2022-01-14 16:23:55.421 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:23:55.421 +08:00 [INF] Route matched with {action = "BodyParamTest", controller = "Test"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book]] BodyParamTestAsync(System.String, System.String, Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-14 16:23:55.436 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-14 16:24:04.075 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 8638.9228ms.
2022-01-14 16:24:04.075 +08:00 [INF] Executing ObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book'.
2022-01-14 16:24:04.076 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 8654.5938ms
2022-01-14 16:24:04.076 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:24:04.076 +08:00 [INF] Request finished HTTP/2 POST https://localhost:9977/test/body?name=a application/xml 117 - 200 - application/json;+charset=utf-8 8665.6463ms
2022-01-14 16:24:08.679 +08:00 [INF] Request starting HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 117
2022-01-14 16:24:08.681 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header
2022-01-14 16:24:08.682 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:24:08.682 +08:00 [INF] Route matched with {action = "BodyParamTest", controller = "Test"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book]] BodyParamTestAsync(System.String, System.String, Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-14 16:24:08.700 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-14 16:24:21.953 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 13253.1597ms.
2022-01-14 16:24:21.953 +08:00 [INF] Executing ObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book'.
2022-01-14 16:24:21.954 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 13271.9532ms
2022-01-14 16:24:21.954 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:24:21.954 +08:00 [INF] Request finished HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 117 - 200 - application/json;+charset=utf-8 13274.8196ms
2022-01-14 16:24:28.885 +08:00 [INF] Request starting HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 118
2022-01-14 16:24:28.886 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header
2022-01-14 16:24:28.886 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:24:28.887 +08:00 [INF] Route matched with {action = "BodyParamTest", controller = "Test"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book]] BodyParamTestAsync(System.String, System.String, Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-14 16:24:28.903 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-14 16:24:44.252 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 15345.0094ms.
2022-01-14 16:24:44.258 +08:00 [INF] Executing ObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book'.
2022-01-14 16:24:44.258 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 15371.5744ms
2022-01-14 16:24:44.259 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:24:44.259 +08:00 [INF] Request finished HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 118 - 200 - application/json;+charset=utf-8 15386.2385ms
2022-01-14 16:24:54.010 +08:00 [INF] Request starting HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 110
2022-01-14 16:24:54.010 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header
2022-01-14 16:24:54.010 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:24:54.010 +08:00 [INF] Route matched with {action = "BodyParamTest", controller = "Test"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book]] BodyParamTestAsync(System.String, System.String, Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-14 16:24:54.024 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-14 16:24:56.996 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 2971.5882ms.
2022-01-14 16:24:56.996 +08:00 [INF] Executing ObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book'.
2022-01-14 16:24:56.997 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 2986.3222ms
2022-01-14 16:24:56.997 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:24:56.997 +08:00 [INF] Request finished HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 110 - 200 - application/json;+charset=utf-8 2986.9762ms
2022-01-14 16:25:10.277 +08:00 [INF] Request starting HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 110
2022-01-14 16:25:10.277 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header
2022-01-14 16:25:10.277 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:25:10.277 +08:00 [INF] Route matched with {action = "BodyParamTest", controller = "Test"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book]] BodyParamTestAsync(System.String, System.String, Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-14 16:25:10.292 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-14 16:25:16.423 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 6130.732ms.
2022-01-14 16:25:16.423 +08:00 [INF] Executing ObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.Book'.
2022-01-14 16:25:16.424 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 6146.2529ms
2022-01-14 16:25:16.424 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.TestController.BodyParamTestAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-14 16:25:16.424 +08:00 [INF] Request finished HTTP/2 POST https://localhost:9977/test/body?name=a&author=ss application/xml 110 - 200 - application/json;+charset=utf-8 6147.1488ms

45
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs

@ -9,7 +9,6 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
@ -79,48 +78,4 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
}
}
internal class SwaggerFixArraysInXmlFilter : ISchemaFilter
{
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
{
var type = context.Type;
// Fix issues with xml array examples not generating correctly
if (type.IsValueType)
{
return;
}
if (type.Name == "String")
{
return;
}
schema.Xml = new OpenApiXml { Name = type.Name };
if (schema.Properties == null)
{
return;
}
foreach (var property in schema.Properties)
{
//Array property, which wraps its elements
if (property.Value.Type != "array")
{
continue;
}
property.Value.Xml = new OpenApiXml
{
Name = $"{property.Key}",
Wrapped = true
};
property.Value.Items.Xml = new OpenApiXml
{
Name = $"{property.Value.Items.Type}",
Wrapped = true
};
}
}
}

47
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs

@ -0,0 +1,47 @@
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
internal class SwaggerFixArraysInXmlFilter : ISchemaFilter
{
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
{
var type = context.Type;
// Fix issues with xml array examples not generating correctly
if (type.IsValueType)
{
return;
}
if (type.Name == "String")
{
return;
}
schema.Xml = new OpenApiXml { Name = type.Name };
if (schema.Properties == null)
{
return;
}
foreach (var property in schema.Properties)
{
//Array property, which wraps its elements
if (property.Value.Type != "array")
{
continue;
}
property.Value.Xml = new OpenApiXml
{
Name = $"{property.Key}",
Wrapped = true
};
property.Value.Items.Xml = new OpenApiXml
{
Name = $"{property.Value.Items.Type}",
Wrapped = true
};
}
}
}

8
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs

@ -1,12 +1,12 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
public class V1ScpDbContext :
AbpDbContext<V1ScpDbContext>,
IV1ScpDbContext
[ConnectionStringName("V1Scp")]
public class V1ScpDbContext : AbpDbContext<V1ScpDbContext>, IV1ScpDbContext
{
/* Add DbSet properties for your Aggregate Roots / Entities here. */
@ -40,7 +40,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
// //...
//});
builder.ConfigureWebApi();
builder.ConfigureV1Scp();
}
}

202
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs

@ -9,7 +9,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
public static class V1ScpDbContextModelCreatingExtensions
{
public const string IsDeletedFilter = "IsDeleted=0";
public static void ConfigureWebApi(
public static void ConfigureV1Scp(
this ModelBuilder builder,
Action<V1ScpModelBuilderConfigurationOptions> optionsAction = null)
{
@ -22,208 +22,10 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
optionsAction?.Invoke(options);
/*
builder.ConfigurePart(options);
builder.ConfigSuppliers(options);
builder.ConfigReceipt(options);
builder.ConfigPurchaseOrder(options);
builder.ConfigPurchaseOrderDetail(options);
builder.ConfigUnplannedReceipt(options);
*/
}
/*
/// <summary>
/// 零件表
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
private static void ConfigurePart(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<Part>(b =>
{
b.ToTable($"{options.TablePrefix}_Part", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.Code).IsRequired().HasMaxLength(64);
b.Property(x => x.Name).IsRequired().HasMaxLength(64);
b.Property(x => x.Desc1).HasMaxLength(1024);
b.Property(x => x.Desc2).HasMaxLength(1024);
b.Property(x => x.Status).IsRequired().HasMaxLength(64);
b.Property(x => x.IsBuyPart).IsRequired();
b.Property(x => x.IsMakePart).IsRequired();
b.Property(x => x.Uom).IsRequired().HasMaxLength(64);
b.Property(x => x.AbcClass).IsRequired().HasMaxLength(64);
b.Property(x => x.ProductLine).HasMaxLength(64);
b.Property(x => x.Type).HasMaxLength(64);
b.Property(x => x.Catalog).HasMaxLength(64);
b.Property(x => x.Group).HasMaxLength(64);
b.Property(x => x.Version).HasMaxLength(64);
b.Property(x => x.Site).IsRequired().HasMaxLength(64);
b.Property(x => x.Company).IsRequired().HasMaxLength(64);
//b.Property(x => x.Color).HasMaxLength(64);
//b.Property(x => x.Configuration).HasMaxLength(64);
//b.Property(x => x.Project).HasMaxLength(64);
//b.Property(x => x.Eco).HasMaxLength(64);
//b.Property(x => x.StdPackUom).IsRequired().HasMaxLength(64);
//b.Property(x => x.StdPackQty).IsRequired();
//b.Property(x => x.ExtPackUom).HasMaxLength(64);
//b.Property(x => x.ExtPackQty);
});
}
/// <summary>
/// 供应商
/// </summary>
private static void ConfigSuppliers(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<Supplier>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + "_Suppliers", options.Schema);
b.ConfigureByConvention();
b.Property(q => q.Code).IsRequired().HasMaxLength(64);
b.Property(q => q.Name).IsRequired().HasMaxLength(64);
b.Property(q => q.Desc).HasMaxLength(1024);
b.Property(q => q.Rank).HasMaxLength(64);
b.Property(q => q.Address).HasMaxLength(1024);
b.Property(q => q.Country).HasMaxLength(64);
b.Property(q => q.City).HasMaxLength(64);
b.Property(q => q.Phone).HasMaxLength(64);
b.Property(q => q.Fax).HasMaxLength(64);
b.Property(q => q.PostId).HasMaxLength(64);
b.Property(q => q.ContactName).HasMaxLength(64);
b.Property(q => q.Currency).HasMaxLength(64);
b.Property(q => q.IsActive).IsRequired();
b.Property(q => q.Company).HasMaxLength(64);
b.Property(q => q.Remark).HasMaxLength(4096);
b.Property(x => x.Bank).HasMaxLength(64);
});
}
/// <summary>
/// 收货单与退货单明细
/// </summary>
private static void ConfigReceipt(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<Receipt>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + "_Receipt", options.Schema);
b.ConfigureByConvention();
b.Property(q => q.RcNumber).IsRequired().HasMaxLength(64);
b.Property(q => q.AsnNumber).IsRequired().HasMaxLength(64);
b.Property(q => q.PoNumber).HasMaxLength(64);
b.Property(q => q.SupplierCode).IsRequired().HasMaxLength(64);
b.Property(q => q.RcType).IsRequired().HasMaxLength(64);
b.Property(q => q.Warehouse).HasMaxLength(64);
b.Property(q => q.Dock).HasMaxLength(64);
b.Property(q => q.ReceiveDate).IsRequired();
b.Property(q => q.ReceiveTime);
b.Property(q => q.PoLine).HasMaxLength(64);
b.Property(q => q.PartCode).IsRequired().HasMaxLength(64);
b.Property(q => q.Lot).IsRequired().HasMaxLength(64);
b.Property(q => q.SupplierLot).IsRequired();
b.Property(q => q.Uom).IsRequired().HasMaxLength(64);
b.Property(q => q.ReceiveQty).IsRequired();
b.Property(q => q.SupplierPackConvertRate).IsRequired();
b.Property(q => q.Remark).HasMaxLength(4096);
b.Property(q => q.Site).IsRequired().HasMaxLength(64);
b.Property(q => q.Company).IsRequired().HasMaxLength(64);
});
}
/// <summary>
/// 采购订单主表
/// </summary>
private static void ConfigPurchaseOrder(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<PurchaseOrder>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + "_PO", options.Schema);
b.ConfigureByConvention();
b.Property(q => q.PoNumber).HasMaxLength(64);
b.Property(q => q.SupplierCode).IsRequired().HasMaxLength(64);
b.Property(q => q.PoType).IsRequired().HasMaxLength(64);
b.Property(q => q.Status).IsRequired();
b.Property(q => q.IsConsignment).IsRequired();
b.Property(q => q.OrderDate).IsRequired();
b.Property(q => q.DueDate).IsRequired();
b.Property(q => q.Version).IsRequired().HasMaxLength(64);
b.Property(q => q.TaxRate).IsRequired();
b.Property(q => q.Site).IsRequired().HasMaxLength(64);
b.Property(q => q.Company).IsRequired().HasMaxLength(64);
b.Property(q => q.ContactName).HasMaxLength(64);
b.Property(q => q.ContactPhone).HasMaxLength(64);
b.Property(q => q.Remark).HasMaxLength(4096);
b.HasMany(u => u.Details).WithOne().HasForeignKey(rd => rd.Id).OnDelete(DeleteBehavior.NoAction).IsRequired();
});
}
/// <summary>
/// 采购订单明细表
/// </summary>
private static void ConfigPurchaseOrderDetail(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<PurchaseOrderDetail>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + "_PODetail", options.Schema);
b.ConfigureByConvention();
b.Property(q => q.PoNumber).IsRequired().HasMaxLength(64);
b.Property(q => q.PoLine).IsRequired().HasMaxLength(64);
b.Property(q => q.PartCode).IsRequired().HasMaxLength(64);
b.Property(q => q.Uom).IsRequired().HasMaxLength(64);
b.Property(q => q.OrderQty).IsRequired();
b.Property(q => q.StdPackQty).IsRequired();
b.Property(q => q.SupplierPackConvertRate);
b.Property(q => q.IsConsignment).IsRequired();
b.Property(q => q.LineStatus).IsRequired();
b.Property(q => q.Remark).HasMaxLength(4096);
});
}
private static void ConfigUnplannedReceipt(this ModelBuilder builder,
V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<UnplannedReceipt>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + "_UnplannedReceipt", options.Schema);
b.ConfigureByConvention();
b.Property(q => q.TrNbr).IsRequired();
b.Property(q => q.TrType).IsRequired().HasMaxLength(8);
b.Property(q => q.Order).HasMaxLength(64);
b.Property(q => q.Location).IsRequired().HasMaxLength(8);
b.Property(q => q.EffectiveDate).IsRequired();
b.Property(q => q.SystemDate).IsRequired();
b.Property(q => q.PartCode).IsRequired().HasMaxLength(18);
b.Property(q => q.Lot).IsRequired().HasMaxLength(64);
b.Property(q => q.Uom).IsRequired().HasMaxLength(8);
b.Property(q => q.Qty).IsRequired();
b.Property(q => q.SoJob).HasMaxLength(20);
b.Property(q => q.Remark).HasMaxLength(4096);
b.Property(q => q.Site).IsRequired().HasMaxLength(8);
b.Property(q => q.Company).IsRequired().HasMaxLength(8);
});
*/
}

8
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs

@ -39,14 +39,6 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
});
/*
context.Services.AddAbpDbContext<MainDbContext>(options =>
{
options.AddDefaultRepositories(includeAllEntities: true);
});
*/
Configure<AbpDbContextOptions>(options =>
{

37
WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs

@ -2,11 +2,10 @@
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Win_in.Sfs.Scp.v1.Domain;
using Win_in.Sfs.Scp.WebApi;
using Volo.Abp.ObjectMapping;
namespace Win_in.Sfs.Scp.v1.Event
{
@ -15,20 +14,40 @@ namespace Win_in.Sfs.Scp.v1.Event
ITransientDependency
{
private readonly ITaPartRepository _taPartRepository;
private readonly IObjectMapper _objectMapper;
public PartEventHandler(ITaPartRepository taPartRepository)
public PartEventHandler(ITaPartRepository taPartRepository,
IObjectMapper objectMapper)
{
_taPartRepository = taPartRepository;
_objectMapper = objectMapper;
}
public Task HandleEventAsync(EntityCreatedEventData<Part> eventData)
public async Task HandleEventAsync(EntityCreatedEventData<Part> eventData)
{
Console.WriteLine("Local Event:" + eventData.Entity.Id);
return Task.CompletedTask;
var part = eventData.Entity;
Console.WriteLine("Local Event:" + part.Code);
//根据传入数据新增或修改TA_PART
var taPart = _objectMapper.Map<Part, TA_PART>(part);
var current = await _taPartRepository.GetAsync(p => p.PartCode == taPart.PartCode);
if (current == null)
{
await _taPartRepository.InsertAsync(taPart);
}
else
{
current = _objectMapper.Map<Part, TA_PART>(part);
// current.PartDesc1 = part.Desc1;
// current.PartDesc2 = part.Desc2;
//...
await _taPartRepository.UpdateAsync(current);
}
// throw new System.NotImplementedException();
//TODO 根据传入数据新增或修改TA_PART
}
}
}

7
WebApiService/src/Win_in.Sfs.Scp.v1.Event/V1ScpEventModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.Modularity;
using Win_in.Sfs.Scp.v1.Domain;
@ -9,6 +10,7 @@ namespace Win_in.Sfs.Scp.v1.Event
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(V1ScpDomainModule),
typeof(WebApiDomainModule),
typeof(V1ScpEntityFrameworkCoreModule)
@ -17,8 +19,11 @@ namespace Win_in.Sfs.Scp.v1.Event
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<V1ScpEventModule>();
});
}
}

81
WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs

@ -0,0 +1,81 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Scp.v1.Domain;
using Win_in.Sfs.Scp.WebApi;
namespace Win_in.Sfs.Scp.v1.Event
{
public class EventAutoMapperProfile : Profile
{
public EventAutoMapperProfile()
{
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMapPart();
CreateMapSupplier();
CreateMapReceipt();
CreateMapPurchaseOrder();
CreateMapPurchaseOrderDetail();
CreateMapUnplannedReceipt();
}
/// <summary>
/// 零件实体与Dto映射
/// </summary>
private void CreateMapPart()
{
CreateMap<Part, TA_PART>();
}
/// <summary>
/// 供应商实体与Dto相互映射
/// </summary>
private void CreateMapSupplier()
{
CreateMap<Supplier, TA_VENDER>();
}
/// <summary>
/// 收货单与退货单明细实体与Dto映射
/// </summary>
private void CreateMapReceipt()
{
CreateMap<Receipt, TB_RECEIVE_QAD>();
CreateMap<Receipt, TB_RECEIVE_DETAIL_QAD>();
CreateMap<Receipt, TB_REJECT>();
CreateMap<Receipt, TB_REJECT_DETAIL>();
}
/// <summary>
/// 采购订单主表映射
/// </summary>
private void CreateMapPurchaseOrder()
{
CreateMap<PurchaseOrder, TB_PO>();
}
/// <summary>
/// 采购订单明细表映射
/// </summary>
private void CreateMapPurchaseOrderDetail()
{
CreateMap<PurchaseOrderDetail, TB_PO_DETAIL>();
}
private void CreateMapUnplannedReceipt()
{
CreateMap<UnplannedReceipt, TB_RECEIVE_QAD>();
CreateMap<UnplannedReceipt, TB_RECEIVE_DETAIL_QAD>();
}
}
}
Loading…
Cancel
Save