C
C#5mo ago
engineertdog

.HasPrincipalKey -> Specify different column name

I need to use .HasPrincipalKey in Fluent, but I need the resulting column to be named differently from what the Fluent API wants to use. I don't see an option to override the column name to something different?
2 Replies
engineertdog
engineertdog5mo ago
c#
modelBuilder.Entity<PiCollectiveDigitalSet>()
.HasMany(e => e.Values)
.WithOne(e => e.PiCollectiveDigitalSet)
.HasPrincipalKey(e => e.StatesetId) // Column name for the FK should be `StatesetId` instead of `PiCollectiveDigitalSetStatesetId`
c#
modelBuilder.Entity<PiCollectiveDigitalSet>()
.HasMany(e => e.Values)
.WithOne(e => e.PiCollectiveDigitalSet)
.HasPrincipalKey(e => e.StatesetId) // Column name for the FK should be `StatesetId` instead of `PiCollectiveDigitalSetStatesetId`
leowest
leowest5mo ago
Want results from more Discord servers?
Add your server
More Posts