An Azure Static Web App with EF: 2. Index of the Repository
web web blazor azure-static-webapp csharp entity-framework-core
An Azure Static Web App was developed by extending the tutorial on that topic to contain 3 editable entities mimicking a database with a view to extending to use EF with an Azure SQL database. Each milestone was noted as a separate branch of the repository. This post is an idex to those branches in chronological order.
The app is for helpers to volunteer for assistance tasks at a track meet. Entity Framework Core is used with the main entities being Round, Helper and Activity. A Helper volunteers and performs an Activity at a Meet (called a Round).
Note that this page has been updated as the story is extended. Now complete. 5/5/2021
Branches of the Repository
Each is a bookmark in order of this progression.
- Initial-commit
- After creating the repository from the template on GitHub as used in the tutorial at MicrosoftDocs/mslearn-staticwebapp-dotnet
- Template: MicrosoftDocs/mslearn-staticwebapp-dotnet
- Completed-tutorial
- After completing the tutorial
- Rename-Products-to-Activitys
- Renamed the Products entity as Activitys. Functionality etc. Unchanged otherwise.
- Activitys-helpers-rounds-Basic
- Added Helpers and Round entities as properties to Activitys. Can list Activitys and get Helpers and Rounds on client from that.
- Add-helper_and-round-apis
- Implemented Helper and Round APIs and app pages
- Tried-Chrissainty-localstorage
- This was a dead-end as it uses Javascript which made no sense on the server.
- Entities-as-a-csharp-local-storage-service
- Used the LocalStorage Nuget Package from Julien Hanssens which is .NET-centred storage.
- Meant to mimic a database: Can Add, delete and Update entities.
- Attempt to add EF and Migration_and SQLSvr
- First, worked through blog post Using Entity Framework with Azure Functions, creating the project separate to this project.
- Then tried to apply same to the Api project here.
- But could not run
add-migration
. Got error message:
Error:
An assembly specified in the application dependencies manifest (Api.deps.json) was not found:
package: 'Api', version: '1.0.0'
path: 'Api.dll'
9(con)
- Have queried about this on Stackoverflow here: Azure Function PostBuild File Copy being lost
- Whereas the build for the Using Entity Framework with Azure Functions project copies that and other files to $(Target) folder from $(Target)bin this Api project does not.
- Will now abandon this approach and directly use the Azure Function project from Using Entity Framework with Azure Functions.
- Nb: This has now been resolved. The Main Branch now has this working
“Nearly” The Final Solution:
Link: 10. EF and can recreate data
- EF Works :)
- Except: Cascade Delete not working here. See main branch.
- This all now works with an Azure SQL Database, and CRUD actions in the API project as Azure C# functions.
- Can do new Migrations and database updates from within Visual Studio in the PMC terminal.
- Solution was a recreation of 8. with some tweaks.
- I am guessing, but I think moving from EF Core Version 2.3.3 packages to 3.3.14 might have solved the problem in 9. above.
- Another issue arose, in that with CRUD, GET,DELETE and PUt worked but POST only worked for the entities with scalar properties. The new Activity POST which has Helper and Round entity properties would not work except for when a complete entity with all new properties was Json POST using Curl.
- This was queried on StackOverFlow: EF Core Entity Post Error with entity that has other entities as properties where a correct answer was posted. More on this in the next blog post … now available.
Next: Cascade and SetNull Deletions See link below.
Posts in this series: An Azure Static Web App with EF
- Multiple Entities and LocalStorage
- Index of the Repository This post.
- Entity Framework Core Implementation
- Cascade and SetNull Deletions
Topic | Subtopic | |
This Category Links | ||
Category: | Web Sites Index: | Web Sites |
Next: > | An Azure Static Web App with EF | 3. Entity Framework Core Implementation |
< Prev: | An Azure Static Web App with EF | 1. Multiple Entities and LocalStorage |