Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Namespace Reference in Several PageModels #9089

Closed
RyanLilla opened this issue Oct 18, 2018 · 2 comments
Closed

Wrong Namespace Reference in Several PageModels #9089

RyanLilla opened this issue Oct 18, 2018 · 2 comments
Labels
Pri1 Pri2 Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

@RyanLilla
Copy link
Contributor

Noticed that in some of the scaffolded PageModels in the example code the wrong namespace reference is given.

For example, in the Pages/Instructors/Index.cshtml.cs code snippet, the _context field is of type ContosoUniversity.Data.SchoolContext, but the namespace that actually contains the SchoolContext type is ContosoUniversity.Models (as specified when first scaffolding the Student model here).

I was going to create a PR myself, but realized it would be better to first discuss what the most appropriate fix would be because there are a few:

  1. Change all the lines of code from private readonly ContosoUniversity.Data.SchoolContext _context; to private readonly ContosoUniversity.Models.SchoolContext _context;

  2. Keep the PageModels as-is, but change the steps in the tutorial to create the data context type in the ContosoUniversity.Data namespace instead


Document Details

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

@dotnet-bot dotnet-bot added the Source - Docs.ms Docs Customer feedback via GitHub Issue label Oct 18, 2018
@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Oct 18, 2018

@RyanLilla I think the problem stems from parts 1-5 were rewritten for ASP.NET Core 2.1 with the 2.1 SDK, but 6-8 were not updated. The scaffolder changed in 2.2

We're going to update this to 2.2 when it RTMs - at that time we'll get all the code updated.

@Rick-Anderson
Copy link
Contributor

Fixed in 2.2 update

@dotnet dotnet locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Pri1 Pri2 Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

No branches or pull requests

3 participants