Bart (2) [Avatar] Offline
#1
It would be great if the design principles of the following frameworks become clear (and how they work together)
- EF Core
- MMVC (MVC)
- Web API (REST)

In plain English, how to create automatically entities from an existing database, use them to create the REST API, which is used in a mobile or desktop application to view and update the data in the UI.

I found this (http://www.learnentityframeworkcore.com/walkthroughs/existing-database) but the rest of the pieces are not clear to me. Especially since this process is common, it should possible to automate this completely.
Andrew Lock (51) [Avatar] Offline
#2
Thanks for posting.

Unfortunately, automating the entire process is not as simple as you might like, for the simple case that it's more complicated than your suggestion poses. For example, the outline you describe does not take security into account; automatically scaffolding EF entities from an existing database is not simple if the database doesn't follow the expected conventions; you should not directly exposes entities over a web API, and others.

Granted, there could probably be templates for doing a large part of this, and the necessary model mapping back and forth from view models to entities is a bit of a pain, but unfortunately that's all we have to work with at the moment!
Bart (2) [Avatar] Offline
#3
Thanks for the response. Yes, I understand that it will not be perfect, but some kind of automation would be great if you could elaborate more in the book. There are great tools available: https://github.com/domaindrivendev/Swashbuckle.AspNetCore