Aspnetcore.docs: Update tutorial ASP.NET Core MVC with Entity Framework for 3.1 and 5.0

Created on 19 Aug 2019  ·  17Comments  ·  Source: dotnet/AspNetCore.Docs

Review team note: This will be updated directly to .NET 5, skipping 3.1 for now.

From @donhuvy ...

> Need update tutorial ASP.NET Core MVC with Entity Framework use Visual Studio 2019


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

P2 Source - Docs.ms doc-bug

Most helpful comment

@wadepickett after you get RP/EF and all the other tutorials updated, update this for 5.0, skip 3.1

All 17 comments

Any news on this? The doc says to look at this issue for dates but nothing is mentioned

For information on when this might be updated, see this GitHub issue. https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/?view=aspnetcore-3.0

As an aside, the page mentions:

For new development, we recommend Razor Pages over MVC with controllers and views

This goes against many demos from recent conferences, that mention "Razor Pages are great for demos but not large LOB sites".

Could you please clarify why razor pages are better?

@Allann just as another data point, we use Razor pages on large LOB sites, so I don't know what that's coming from.

Controllers are merely a way to describe routes to methods, Razor Pages improves on this because in a typical controller, the actions don't have much to do with each other. The only case this isn't true is a GET/POST of a single URL, which Razor Pages encapsulate better because it's two methods on the same page.

A single class that holds methods for a number of separate, disparate requests doesn't make much sense from an object design perspective. It's really a legacy artifact from previous MVC frameworks (Rails, Monorail) and not really a true representation of the original MVC pattern.

I do think Razor Pages just for fresh newer developer or many older develop that dont want mvc or just for little small sites. cause it likes webform and likes aspx that reduce the work for the older developer that dont want to change.like to learn mvc pattern.
And another one point, to many people,the business rule,function,class,Di and many other front language may mixed in one class,witch will make the class become a big mud and all in a mess.
so there no better but for newer to learn or some small site quick code(also result in a mess)

@xyz0822 That's no different than a controller action. It's now breaking a controller from multiple disparate actions into more tightly focused pages. But a page's class can still get big.

Can we do this tutorial in Visual Studio Code as well, please?

Я сделал проект Contoso University MVC для EF Core 3.1 на основе EF для Razor Pages. Можете посмотреть здесь https://github.com/creativcode-ru/EF-Core

I made a Contoso University MVC project for EF Core 3.1 based on EF for Razor Pages. You can look here https://github.com/creativcode-ru/EF-Core

⚠ ВНИМАНИЕ! Опечатка в документации:
https://docs.microsoft.com/ru-ru/aspnet/core/data/ef-mvc/inheritance?view=aspnetcore-3.1#add-person-to-the-model

Из класса SchoolContext в методе OnModelCreating(ModelBuilder modelBuilder) закомментируйте 2 строки с классами Student и Instructor, надо оставить только одну таблицу Person вместо двух прежних. При миграции будет предупреждение о потере данных.


⚠ ATTENTION! Typo in the documentation:
from the SchoolContext class in the OnModelCreating method (ModelBuilder modelBuilder) comment out 2 rows with the Student and Instructor classes, you need to leave only one Person table instead of the two previous ones. During migration there will be a warning about data loss.

Any update on this guys? I just started migrating to .net core this week and can't seem to follow some of the outdated instructions..

@wadepickett after you get RP/EF and all the other tutorials updated, update this for 5.0, skip 3.1

"For information on when this might be updated, see this GitHub issue." led me here, still confused as this left me with little clarity.

Related to #15620 which I had scheduled in for this month but it was moved yesterday.

I added this issue to the list of work for this month's sprint (August 2020) instead. This has been piled on to the August work and will start sometime this month as we work through the entire list of highest priority items. Honestly I am not sure how long it will take to finish once started so I can't provide a real specific date. It is certainly an important topic to update.

@wadepickett you'll update this for 5, we're skipping 3.1 on this. You can do this after you update RP/EF to 5

@Rick-Anderson, we are on the same page. That is why I gave a thumbs up the first time you mentioned it. :) Thanks for double checking though.

@Rick-Anderson, just realized why you mentioned it again. Yes this would wait to go out with the final release, but I could at least start on it, then make any last minute changes based on a test with the final release bits when that happens. Thanks! :) This is an 11 topic series. I remember to took a while to get it updated/reviewed/published for its last major update for the last author, better I start when I can.

While making my yearly pilgrimage to the "Contoso University tutorial", I re-read the statement "For new development, we recommend Razor Pages over MVC with controllers and views." Who's the "we"? The authors of the tutorial? Microsoft's ASP.NET team? Thanks for the clarification. Obligatory _"Use whatever works for you!"_ OK, I found myself the most productive using Classic ASP (circa 1998) and it's too bad nobody is hiring for that these day... :-)

@streetwiseherc ... .NET team ... the highest-ranking manager I've heard the remark come from is Damian Edwards.

... and specifically the recommendation is for page-based/workload apps ... not everything, of course.

Was this page helpful?
0 / 5 - 0 ratings