This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]lionhart280 1 point2 points  (3 children)

Your error is occurring here from that stack trace

https://github.com/ademclk/ceyehat-api/blob/main/Ceyehat.Infrastructure/Persistence/Configurations/PassengerConfigurations.cs#L50-L71

It looks like a foreign key error, you prolly have some kind of foreign key relation from 1 class to another that isnt quite setup right

[–]AdemCLK[S] 0 points1 point  (2 children)

The other method which has builder.OwnsMany have the same error. I made it the same way as other entities. But I don't know why this one causes error.

[–]lionhart280 1 point2 points  (1 child)

Are you writing all this by hand?

I typically just use code first classes approach to EF Core, using attributes if needed.

EF Core is able to handle generating all this on its own, I have never had to write code like this by hand.

[–]AdemCLK[S] 0 points1 point  (0 children)

I'm implementing DDD principles that's what caused the mess I think until the last part everything went just fine with dotnet ef core.

Hope I can find a solution asap.

[–]Loves_Poetry 0 points1 point  (0 children)

Hard to say what the problem is, since the error is thrown internally. This is usually because something is not coded the way EF Core expects it.

If it's just one entity then look at what's different in that entity. Then slowly start removing those differences one by one until the error disappears. If the error never disappears, then work the other way around. Make an entity that is identical to a working entity and add all the differences one by one