© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
3 replies
SWEETPONY

Find doesn't return my collection

Shift contains a property:
Qualifications
Qualifications

I'm trying to add them to
Shifts
Shifts
and it works!
But when I get Shift using
FindCoreAsync
FindCoreAsync
Qualifications
Qualifications
in null
protected override async Task AddCoreAsync(Shift shift, EventHandlingContext context)
{
    shift.Created = timeProvider.GetUtcNow().DateTime;
    dbContext.Shifts.Add(shift);
        dbContext.ShiftQualifications.AddRange(shift.Qualifications!);
    await dbContext.SaveChangesAsync(context.CancellationToken).ConfigureAwait(false);
}

public override async Task<Shift?> FindCoreAsync(Shift shift, EventHandlingContext context)
{
    var foundShift = await dbContext.Shifts
       .AsNoTracking()
       .FirstOrDefaultAsync(
          s => s.ScheduledStart == shift.ScheduledStart
            && s.Type == shift.Type
            && s.ResourceId == shift.ResourceId,
            context.CancellationToken)
        .ConfigureAwait(false);

    return foundShift;
}
protected override async Task AddCoreAsync(Shift shift, EventHandlingContext context)
{
    shift.Created = timeProvider.GetUtcNow().DateTime;
    dbContext.Shifts.Add(shift);
        dbContext.ShiftQualifications.AddRange(shift.Qualifications!);
    await dbContext.SaveChangesAsync(context.CancellationToken).ConfigureAwait(false);
}

public override async Task<Shift?> FindCoreAsync(Shift shift, EventHandlingContext context)
{
    var foundShift = await dbContext.Shifts
       .AsNoTracking()
       .FirstOrDefaultAsync(
          s => s.ScheduledStart == shift.ScheduledStart
            && s.Type == shift.Type
            && s.ResourceId == shift.ResourceId,
            context.CancellationToken)
        .ConfigureAwait(false);

    return foundShift;
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ api doesn't return anything.
C#CC# / help
3y ago
❔ Why doesn't every method in Collection<T> has an extension point?
C#CC# / help
3y ago
✅ my mouse doesn’t work
C#CC# / help
3y ago
collection expression on Span<T>
C#CC# / help
3y ago