I’ve created my application and using the database first approach. So I used the ADO.net Entity Data Model to add my database to the project and then added controllers to it that way, I don’t have any models so to speak I think? But anyway, I’ve added controllers and CRUD was added to each entity automatically.
My problem is, I want to view data from many tables on one web page. I can do this via sql but how do I use sql to pull the data I need and display it on the screen.
To build a little bit on Dave A’s answer:
I personally like doing this type of retrieval with database first EF.
After building the EDMX, create a simple, straight-forward POCO that mimics what you want to return. A simple example would be:
Once you’ve built the relationships in your database which is reflected in your EDMX, access it in a provider via your favorite pattern. A simple using pattern is always good, though I’ve built the more complex object with a mapper.
Call this provider from your controller and strongly type the view with
at the top of your view.