After developing a few ASP.Net Core MVC sites with sorting and searching, that work quite OK, when coming to pagination I met some errors that I did not understand, so I thought working on the demo application would be a good idea.
Well, I get the same errors there: strange, is not it?
I imagine that if there were errors in the demo application that would be well known and quickly corrected, the other hypothesis is an error on my machine.
I hope somebody is able to situate the error, to avoid me the pain of completely reinstalling my machine, which for sure would take … some time, at least.
First of all, the reference page is there: Tutorial: Add sorting, filtering, and paging – ASP.NET MVC with EF Core
On that page, search “Get the code”, and click on “Download or view the completed application”.
I was surprised to see a title that begins with “Aspnet-Docs”, but somebody by Microsoft confirmed me the link was correct.
I arrive there:
https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/data/ef-mvc/intro/samples/cu-final
then I click on “Code” in the navigation bar on top of the page, then on the “Code” button.
I obtain a “Clone” interface, that gives me this URL to clone:
https://github.com/dotnet/AspNetCore.Docs.git
So, in Visual Studio 2022 I start a new session, click on “Clone a repository”, and paste that URL.
When launching the execution I see nothing persuasive. No application window appears.
After updating Visual Studio 2022 to Version 4.8.09032, I launch execution again, and it raises four errors.
Perhaps it is best to first give the original (localised) version for each from the errors window, before translating it to English.
“Gravité Code Description Projet Fichier Ligne État de la suppression Détails Erreur (active) CS0234 Le nom de type ou d’espace de noms ‘Entity’ n’existe pas dans l’espace de noms ‘System.Data’ (vous manque-t-il une référence d’assembly ?) MVCStudents01 C:Projects Visual StudioWebMVCStudents01MVCStudents01DALSchoolInitializer.cs 10 ”
Error CS0234, The type name or namespace ‘Entity’ does not exist in the namespace ‘System.Data’. (Are you missing an assembly reference ?)
“Gravité Code Description Projet Fichier Ligne État de la suppression Détails Erreur (active) CS1503 Argument 1 : conversion impossible de ‘string’ en ‘Microsoft.EntityFrameworkCore.DbContextOptions’ MVCStudents01 C:Projects Visual StudioWebMVCStudents01MVCStudents01DALSchoolContextt.cs 11 ”
Error CS1503 Argument 1 : impossible conversion from ‘string’ to ‘Microsoft.EntityFrameworkCode.DbContextOptions’
“Gravité Code Description Projet Fichier Ligne État de la suppression Détails Erreur (active) CS0246 Le nom de type ou d’espace de noms ‘DbModelBuilder’ est introuvable (vous manque-t-il une directive using ou une référence d’assembly ?) MVCStudents01 C:Projects Visual StudioWebMVCStudents01MVCStudents01DALSchoolContextt.cs 20 ”
Error CS0246 The type name of namespace ‘DbModelBuilder’ cannot be found (Are you missing a using directive or an assembly reference ?)
“Gravité Code Description Projet Fichier Ligne État de la suppression Détails Erreur (active) CS0246 Le nom de type ou d’espace de noms ‘PluralizingTableNameConvention’ est introuvable (vous manque-t-il une directive using ou une référence d’assembly ?) MVCStudents01 C:Projects Visual StudioWebMVCStudents01MVCStudents01DALSchoolContextt.cs 22 ”
Error CS0246 The type name or namespace ‘PluralizingTableNameConvention’ cannot be found (are you missing a using directive or an assembly reference?)
So, maybe after taking some distance it will be obvious that I forgot to install something. It is possible that somebody can be quicker than I on this.
As I said, when seeing errors in my code, I tried cloning the demo application, and saw, at least partially, the same errors.