CatFactory.EntityFrameworkCore icon indicating copy to clipboard operation
CatFactory.EntityFrameworkCore copied to clipboard

Problem with multiple foreign keys referencing a single entity

Open diwgh opened this issue 6 years ago • 1 comments

Hello!

I have a problem when using the software to generate entity framework core models.

I have a table A, having two different foreign keys (key1 and key2) both referencing single table B. In the generated class for AEntity there are 2 properties key1 and key2, but only one virtual navigation property for the referenced entity for the two foreign keys - BEntityFK. In the generated class for BEntity there is only one collection of AEntities instead of two - one for each referencing foreign key. Also in the model builder configuration files there are two configuration entries, configuring the one to many relationship, one for each key, but they are mapping the same properties twice.

Is this a bug or there is a configuration, causing creation of multiple virtual navigation properties for each foreign key, no matter if all of them reference a single table? Are there any workarounds for this situation?

Thank You in advance!

diwgh avatar Aug 13 '19 09:08 diwgh

Hi.

This is a bug, thank you so much for your feedback.

Let me work to solve this issue.

I'll let you know when I have solved.

Regards

hherzl avatar Aug 31 '19 17:08 hherzl