C
C#10mo ago
ngtphat.towa

EF core generated code does not contain a definition for 'HasDiscriminator'

I was following course on YouTube: https://www.youtube.com/playlist?list=PLzYkqgWkHPKBcDIP5gzLfASkQyTdy0t4k I use this repos as reference to read the code https://github.com/PanKunik/buber-dinner After i update all dependency to net8.0: I encounter this error:
From An unknown user
From An unknown user
From An unknown user
GitHub
GitHub - PanKunik/buber-dinner: This repository follows Amichai Man...
This repository follows Amichai Mantinband course on REST API DDD CLEAN ARCHITECTURE. - PanKunik/buber-dinner
No description
7 Replies
ngtphat.towa
ngtphat.towaOP10mo ago
The code look almost identical
No description
Keswiik
Keswiik10mo ago
HasDiscriminator is a method on EntityTypeBuilder. b1 is an OwnedNavigationBuilder
ngtphat.towa
ngtphat.towaOP10mo ago
would you like to elaborate? :TeBeCat:
Keswiik
Keswiik10mo ago
You're attempting to use HasDiscriminator in the wrong context. It is something you would use when you're configuring an entity, not a relationship. modelBuilder.Entity<SomeType>(b => b.HasDiscriminator(...)) Not sure if there is an easy way to handle discriminators when configuring owned entities.
Keswiik
Keswiik10mo ago
https://github.com/dotnet/efcore/issues/29659 a relevant github issue, not sure if there's been much done to make this easier
GitHub
HasDiscriminator based on owned value object property · Issue #2965...
Question How would I go about configuring a discriminator column based on a property of an owned (OwnsOne) type? Code public record ClassDetails(ClassType Type); public abstract class BaseClass { p...
ngtphat.towa
ngtphat.towaOP10mo ago
To be honest, I lack of knowledge about ef-core configuration . I just understand what course's author archives, however i never configure efcore before. I suppose it working like previous efcore version 7.
Keswiik
Keswiik10mo ago
I'd recommend spending some time to learn EF, it can be pretty confusing if you have no clue what's going on.
Want results from more Discord servers?
Add your server