Proper ASP.NET MVC 5 Approach

时间:2015-06-15 15:13:33

标签: asp.net-mvc entity-framework

Looking for some guidance as I am struggling here.

As someone who spent many years developing ASP.NET applications - that has been out of the game for 3-4 years, I am struggling to pick up the latest approaches. Probably as a result of a decade of experience.

My ASP.NET in the past was built using stored procedure calls, and the GUI was built using hand-coded HTML and JavaScript. I used JavaScript to emulate Ajax type functionality (before it was really a well known thing), and also would at times use XSLT to separate presentation from code.

Now, I am trying to move to MVC 5. It's not intuitive to me, and the few popular tutorials out there seem to be doing things that I don't want to do. For example, they are connecting to a simple table through EF, and allowing a user to view, edit or create items.

I'm looking for some basic things:

  1. How do I get data from a stored procedure into some form of a view (GridView, or ListView, etc) - Using a controller, a View, a stored procedure as the data source (using Entity Framework? When i try DB First, and select to include procedures, I can't find them anywhere)

  2. I'm going to want to allow them to override the value in one column. This would be stored down in the database as a different field.

This stuff was always very simple using basic web forms, but I can't find a tutorial that allows me to do anything other than just edit an existing table using EF - which isn't what I want to do. So tempted to just go back to the old fashioned way ...

This is one tutorial that was making sense to me, until it jumped into the code first approach on the database, where it went off the path from what I was looking to do: http://www.asp.net/mvc/overview/getting-started/introduction/getting-started

Here was another one: http://www.asp.net/mvc/overview/getting-started/database-first-development/generating-views But this one was also different than what I was hoping to do.

I wish I wasn't so short on time with this project.

Thanks for any guidance.

1 个答案:

答案 0 :(得分:0)

您最好等待ASP.NET 5 / vNext / MVC6版本,不要在MVC5上浪费时间。如果您的项目依赖于SQL并且运行良好,则根本不使用Entity Framework。