'CollectionOwnershipBuilder' does not contain a definition for 'HasAlternateKey' #15698
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
punted-for-3.0
type-bug
Milestone
Describe what is not working as expected.
I've got several DbContexts in my solution. All are working as expected except for one, which is generating anomalous code in the snapshot and designer classes. I have an entity, let's call it ABC. ABC has a list of DEFs. DEF is marked as
[Owned]
and I have it configured as an OwnsMany in the OnModelCreating as in the following:The IDs for each are GUIDs, in case that's relevant. When I run the Add-Migration command, I use the following:
Add-Migration Initial -StartupProject SampleBuilder -Project Data.Abc -Verbose
This runs without issue and produces _Initial.cs, _Initial.Designer.cs and MyContextModelSnapshot. There is nothing flagged as wrong in _Initial.cs, but when looking at _Initial.Designer.cs, I see the following (names changed, of course):
I see exactly the same thing in the MyContextModelSnapshot.cs file and the same error.
I attempted to remove the migration and that worked fine. I re-added it and the same thing happened. It only occurs in that one spot and I haven't experienced this in any of the other many owned types in this or other DbContexts.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Here are the classes and their relevant bits:
Further technical details
EF Core version: 2.2.4
Microsoft.EntityFrameworkCore.Design: 2.2.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer: 2.2.4
Operating system: Windows 10 x64 Pro
IDE: Visual Studio 2019 Pro Stable channel, 16.0.3
The text was updated successfully, but these errors were encountered: