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

Namespace of generated DbContext class uses Models when it should use Data #822

Closed
Rick-Anderson opened this issue Jun 25, 2018 · 4 comments

Comments

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Jun 25, 2018

When you scaffold EF/CRUD the new DC uses Models in the namespace when it should use Data
image

The DC

namespace ContosoUniversity.Models
{
    public class ContosoUniversityContext : DbContext
    {
        public ContosoUniversityContext (DbContextOptions<ContosoUniversityContext> options)
            : base(options)
        {
        }

        public DbSet<ContosoUniversity.Models.Student> Student { get; set; }
    }
}

But it’s not in the Models folder, it’s in the Data folder. The namespace should be ContosoUniversity.Data

@Rick-Anderson
Copy link
Contributor Author

@seancpeters this causes alot of confusion in our tutorials. Can we get this scheduled for 3.1?

@ajcvickers
Copy link
Member

@vijayrkn: @Rick-Anderson is pinging Sean here, so just pinging you so it doesn't get missed.

@vijayrkn
Copy link
Contributor

Thank you @ajcvickers .

@Rick-Anderson - I don't have a dev assigned to the Scaffolding feature yet. Will get to this once we have active resource working on this.
(Sean has moved to a new company and is not with Microsoft any more)

@Rick-Anderson
Copy link
Contributor Author

I opened this VS bug as the CLI is using the correct namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants