Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Compilation Error after Upgrading to v1.3.0.11 #129

Closed
ab-tools opened this issue Dec 1, 2019 · 4 comments
Closed

Compilation Error after Upgrading to v1.3.0.11 #129

ab-tools opened this issue Dec 1, 2019 · 4 comments
Labels
bug Confirmed bug released Issue is resolved in a current release
Milestone

Comments

@ab-tools
Copy link

ab-tools commented Dec 1, 2019

I've upgraded from v1.3.0.4 to v1.3.0.11 and now get a compilation error due to following automated generated code change.

Previous line:
modelBuilder.Entity<global::QuickArchive.Data.Db.Keyword>().HasIndex(t => t.Name)
New line:
modelBuilder.Entity<global::QuickArchive.Data.Db.Keyword>().HasIndex("_Name")
When I change this back manually compilation works fine again.

And that's the property definition the code is generated from:
image

What's the reason for this code change that leads to a compilation error?

@msawczyn
Copy link
Owner

msawczyn commented Dec 1, 2019

It's a bug in the EFCore generation that's not present in the EF6 version, but since this isn't an AutoProperty it shouldn't be doing that. There's something else going on here outside of this property. If you would, please take a look at EFCoreDesigner.ttinclude around line 304. Change

         segments.Add($"modelBuilder.Entity<{modelClass.FullName}>().HasIndex(t => t.{indexed.Name})");

to

         segments.Add(indexed.AutoProperty
                  ? $"modelBuilder.Entity<{modelClass.FullName}>().HasIndex(t => t.{indexed.Name})"
                  : $"modelBuilder.Entity<{modelClass.FullName}>().HasIndex(\"_{indexed.Name}\")");

and see if that changes things.

Thanks for the report.

@msawczyn msawczyn added the investigating Looking into this label Dec 1, 2019
@ab-tools
Copy link
Author

ab-tools commented Dec 1, 2019

First thanks a lot for your really fast reply on a Sunday! :-)

I'm targeting .NET 4,7.2 at the moment, so I would say it's EF6 (sorry, should have mentioned that from the beginning) - therefore I don't think this it can be related to the EFCore generation?

Still tried to do the change you suggest, but without effect which I expected, because I guess it's rather EF6Designer.ttinclude what is used and not EFCoreDesigner.ttinclude.

Please let me know in case you need any further info on this from myself!

@msawczyn
Copy link
Owner

msawczyn commented Dec 2, 2019

Hmm. Then that makes less sense. Since AutoProperty is set to false, _Name shouldn't even exist. Would you be able to post a minimal repro model that shows this problem?

@ab-tools
Copy link
Author

ab-tools commented Dec 2, 2019

Yes as I can even reproduce the problem with just a single entity in this project:
EFDesignerTest.zip

@msawczyn msawczyn added bug Confirmed bug and removed investigating Looking into this labels Dec 3, 2019
@msawczyn msawczyn added the pending release Issue is resolved in the current codebase, will be published with the next release label Dec 4, 2019
@msawczyn msawczyn added this to the 1.3.0.12 milestone Dec 4, 2019
@msawczyn msawczyn added released Issue is resolved in a current release and removed pending release Issue is resolved in the current codebase, will be published with the next release labels Dec 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug released Issue is resolved in a current release
Projects
None yet
Development

No branches or pull requests

2 participants