An ASP.NET Core OData Example using the Wide WorldImporters database and Entity Framework Core #674
Replies: 4 comments 9 replies
-
I am a little rough with my Docker skills, but, all three images built successfully and came online.
2024-10-24 15:11:47 wwi-api | [19:11:47 INF] Request starting HTTP/2 GET https://localhost:5000/odata/ColdRoomTemperatures?%24count=true&%24skip=0&%24top=10 - null null
2024-10-24 15:11:47 wwi-api | [19:11:47 INF] CORS policy execution successful.
2024-10-24 15:11:47 wwi-api | [19:11:47 INF] Executing endpoint 'WideWorldImporters.Api.Controllers.EntitiesController.GetColdRoomTemperatures (WideWorldImporters.Server.Api)'
2024-10-24 15:11:47 wwi-api | [19:11:47 INF] Route matched with {action = "GetColdRoomTemperatures", controller = "Entities"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult GetColdRoomTemperatures() on controller WideWorldImporters.Api.Controllers.EntitiesController (WideWorldImporters.Server.Api).
2024-10-24 15:11:48 wwi-api | warn: Microsoft.EntityFrameworkCore.Model.Validation[10400]
2024-10-24 15:11:48 wwi-api | Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data; this mode should only be enabled during development.
2024-10-24 15:11:48 wwi-api | [19:11:48 WRN] Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data; this mode should only be enabled during development.
2024-10-24 15:11:49 wwi-api | [19:11:49 INF] Executing OkObjectResult, writing value of type 'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[[WideWorldImporters.Server.Database.Models.ColdRoomTemperature, WideWorldImporters.Server.Database, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'.
2024-10-24 15:11:49 wwi-db-sqlserver2022 |
2024-10-24 19:11:49.47 Logon Error: 18456, Severity: 14, State: 5.
2024-10-24 15:11:49 wwi-db-sqlserver2022 |
2024-10-24 19:11:49.47 Logon Login failed for user 'wwi'. Reason: Could not find a login matching the name provided. [CLIENT: 172.18.0.2] Because I'm on a windows box, I ran this command (after I built the images)
|
Beta Was this translation helpful? Give feedback.
-
Ok, after watching the logs, this confirms that my personal experiences in OData v9 libraries are not any different than what you've built. I toyed with your wwi-app so that it will submit specific fields in a $select query option, but, I'm noticing that the [EnableQuery] Web API method does not seem to translate those into the generated T-SQL statements. Specifically, I wanted the customer grid / view model to only request the displayed fields: CustomerId,CustomerName,AccountOpenedDate,IsOnCreditHold See the log for full details:
=====
|
Beta Was this translation helpful? Give feedback.
-
I'm reviewing my prior comment and think I may have misspoke. I am seeing that there is an inner query that does indeed seem to match the $select field options. I am posting the original logs that show how things looked before I made the edit to the wwi-app
|
Beta Was this translation helpful? Give feedback.
-
Many thanks @bytefish for this great application design; I installed docker long ago on my PC and had figured out the WSL2 business on my Windows 11 machine.. but this was the first time I really dusted it all off and used QUESTION: |
Beta Was this translation helpful? Give feedback.
-
I have written an article on ASP.NET Core OData 8, that uses the WideWorldImporters database and uses EntityFramework Core for scaffolding the database:
It also shows how to generate the database model, ODataController, Swagger documentation and what’s necessary to support Spatial queries. I think there is a lot of potential in it for interesting queries.
It would be great to get some feedback on it!
Beta Was this translation helpful? Give feedback.
All reactions