❔ Ef core-Odd Behavior
So straight into it,
The mapping:
builder.Entity<LessonPhase>(b =>
{
b.ToTable(lingumindConsts.DbTablePrefix + "Phases", lingumindConsts.DbSchema);
b.HasOne(x => x.BotInitialInteraction).WithOne(x => x.LessonPhaseForInitial)
.HasForeignKey<BotInteraction>(x => x.LessonPhaseForInitialId);
b.HasOne(x => x.BotFinalInteractionOnSuccess).WithOne(x => x.LessonPhaseForOnSuccess)
.HasForeignKey<BotInteraction>(x => x.LessonPhaseForOnSuccessId);
b.HasOne(x => x.BotFinalInteractionOnFailure).WithOne(x => x.LessonPhaseForOnFailure)
.HasForeignKey<BotInteraction>(x => x.LessonPhaseForOnFailureId);
b.HasMany(x => x.UserInteractions).WithOne(x => x.LessonPhase).HasForeignKey(x => x.LessonPhaseId);
});
The Class:
The Code:
Basically After saving to the DB, the last phase, lets say number 6, The InitialBotInteraction string value becomes the same as the BotFinalInteractionOnSuccess string,
Only happens on the last phase all the others are fine, so the heck is going on?
The mapping:
builder.Entity<LessonPhase>(b =>
{
b.ToTable(lingumindConsts.DbTablePrefix + "Phases", lingumindConsts.DbSchema);
b.HasOne(x => x.BotInitialInteraction).WithOne(x => x.LessonPhaseForInitial)
.HasForeignKey<BotInteraction>(x => x.LessonPhaseForInitialId);
b.HasOne(x => x.BotFinalInteractionOnSuccess).WithOne(x => x.LessonPhaseForOnSuccess)
.HasForeignKey<BotInteraction>(x => x.LessonPhaseForOnSuccessId);
b.HasOne(x => x.BotFinalInteractionOnFailure).WithOne(x => x.LessonPhaseForOnFailure)
.HasForeignKey<BotInteraction>(x => x.LessonPhaseForOnFailureId);
b.HasMany(x => x.UserInteractions).WithOne(x => x.LessonPhase).HasForeignKey(x => x.LessonPhaseId);
});
The Class:
The Code:
Basically After saving to the DB, the last phase, lets say number 6, The InitialBotInteraction string value becomes the same as the BotFinalInteractionOnSuccess string,
Only happens on the last phase all the others are fine, so the heck is going on?