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

SQL Server scaffolding generates invalid anonymous types for indexes (rc1-final) #3847

Closed
AlekseyMartynov opened this issue Nov 23, 2015 · 3 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@AlekseyMartynov
Copy link

I use the NORTHWND database restored from https://northwinddatabase.codeplex.com, and use the following command to scaffold entity classes:

dnx EntityFramework.Commands dbcontext scaffold "data source=.\SQLEXPRESS;initial catalog=NORTHWND;integrated security=True" EntityFramework.MicrosoftSqlServer -a -c NorthwindContext -o Models\Northwind

Design package is EntityFramework.MicrosoftSqlServer.Design 7.0.0-rc1-final

Generated classes fail to compile with "An anonymous type cannot have multiple properties with the same name".

Problematic source lines:

entity.HasIndex(e => new { e.CompanyName, e.CompanyName }).HasName("CompanyName");
entity.HasIndex(e => new { e.PostalCode, e.PostalCode, e.PostalCode }).HasName("PostalCode");
@lajones
Copy link
Contributor

lajones commented Nov 23, 2015

Hi Aleksey. Thanks for reporting this. It looks like there's a problem in the code which uniquifies property names and/or creates indexes. We'll look into it.

@lajones
Copy link
Contributor

lajones commented Dec 2, 2015

This was a consequence of us conflating indexes which had the same name but were on different tables. This was fixed by #3934.

@lajones lajones closed this as completed Dec 2, 2015
@lajones lajones modified the milestones: 7.0.0-rc2, 7.0.0 Dec 2, 2015
@dumbledad
Copy link

@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers modified the milestones: 1.0.0-rc2, 1.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants