model generation issue

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
kentatcap
Posts: 9
Joined: Tue 12 Jul 2016 15:47

model generation issue

Post by kentatcap » Fri 21 Jun 2019 16:02

We have a model generated using VS 2019 with DotConnect 9.7.770.0 that we are using in an application using DotConnect 9.3.230.0 with EntityFrameworkCore 1.1.1 and we are getting the following error:

---
Unable to determine the relationship represented by navigation property '<NavigationProperty>' of type '<T>'. Either manually configure the relationship, or ignore this property from the model.
---

It seems that the model generated by 9.7.770.0 contains a .IsRequired(false) on navigation properties where it didn't before when generated with by earlier versions, as revealed by git. Some properties had .IsRequired(true) but those seem to be the existing.

I was able to get it to work if I were to manually edit the generated model and globally replace all/delete the .IsRequired(false), but I feel that is potentially too destructive. Another way I was able to get part of it to work is by setting Is Null to false on the Foreign Key on the class with the navigation property, but the problem is that 1) is not always the case and 2) there are a lot existing connections across multiple models.

I was trying to find some settings or attributes that modify this model generation behavior but to no avail. Is there something I may be missing? Is it a bug? Can it be addressed? Suggestions? Pointers?

Some information for potential questions. We want to start using VS 2019 but 9.3.230 doesn't have support for VS 2019, only 9.7.770.0. Also, 9.7.770.0 doesn't seem to support or work with EntityFrameworkCore 1.x.x, only EntityFrameworkCore 2.x.x. We are not ready to upgrade our projects to EntityFrameworkCore 2.x.x as would require more resources and testing that we cannot do right now, but also not a decision for me to make.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: model generation issue

Post by Shalex » Thu 27 Jun 2019 13:43

Refer to https://www.devart.com/dotconnect/oracl ... story.html :
9.4.314 13-Jul-17
The behaviour is changed: IsRequired(false / true) for navigation properties is always generated in EF Core fluent mapping now

kentatcap wrote: Fri 21 Jun 2019 16:02Unable to determine the relationship represented by navigation property '<NavigationProperty>' of type '<T>'. Either manually configure the relationship, or ignore this property from the model.
Please contact us and provide a small test project for reproducing the error in our environment.

Post Reply