❔ 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:
public class LessonPhase : AuditedEntity<Guid>, ISoftDelete
{

}
public BotInteraction BotInitialInteraction { get; set; }
public BotInteraction? BotFinalInteractionOnSuccess { get; set; }
public BotInteraction? BotFinalInteractionOnFailure { get; set; }
public string? UserExpectedAnswer { get; set; }
public ICollection<UserInteraction> UserInteractions { get; set; }

public LessonPhase(Guid id) : base(id)
{
UserInteractions = new Collection<UserInteraction>();
}}
public class LessonPhase : AuditedEntity<Guid>, ISoftDelete
{

}
public BotInteraction BotInitialInteraction { get; set; }
public BotInteraction? BotFinalInteractionOnSuccess { get; set; }
public BotInteraction? BotFinalInteractionOnFailure { get; set; }
public string? UserExpectedAnswer { get; set; }
public ICollection<UserInteraction> UserInteractions { get; set; }

public LessonPhase(Guid id) : base(id)
{
UserInteractions = new Collection<UserInteraction>();
}}
The Code:

_currentLesson = await HandlePhaseAudioFileStorage(_currentLesson);
if (AzureBlobStorageManager.StoreEnabled) {
var newLesson=await _lessonRepository.InsertAsync(_currentLesson, true);

}

_currentLesson = await HandlePhaseAudioFileStorage(_currentLesson);
if (AzureBlobStorageManager.StoreEnabled) {
var newLesson=await _lessonRepository.InsertAsync(_currentLesson, true);

}
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?
16 Replies
antimatter8189
antimatter8189OP2y ago
Removed alot of code cuz it wont hit let me pass the 2000 character mark
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX2y ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
antimatter8189
antimatter8189OP2y ago
@TeBeClone alright here it is: https://paste.mod.gg/pnakwgkdnmti/0
BlazeBin - pnakwgkdnmti
A tool for sharing your source code with the world!
antimatter8189
antimatter8189OP2y ago
again , only happening on the last element in the phase list, like the fuck lol
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
antimatter8189
antimatter8189OP2y ago
Will post there aswell, last time didnt help me too much out there tho =[
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
antimatter8189
antimatter8189OP2y ago
Yeah bro lol ik nobody owns me anything neither its fine ef core bugs annoying af 😄
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
JakenVeina
JakenVeina2y ago
what is the issue?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
JakenVeina
JakenVeina2y ago
me neither what's a "phase"?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
JakenVeina
JakenVeina2y ago
and dumping a ton of code on us doesn't help I'm just not going to read it if it's too big to fit here, you haven't refined your understanding of the problem enough
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server