C
C#3mo ago
SWEETPONY

✅ How to fill the object without populating properties?

I have this record:
public sealed record WorkingTaskWithFlights: WorkingTask
{
public List<Flight>? Flights { get; init; }
}
public sealed record WorkingTaskWithFlights: WorkingTask
{
public List<Flight>? Flights { get; init; }
}
and in my code:
var workingTask = dbContext.WorkingTasks.FirstOrDefault(...);
var flights = dbContext.Flights.Select(...);
var workingTask = dbContext.WorkingTasks.FirstOrDefault(...);
var flights = dbContext.Flights.Select(...);
workingTask is WorkingTask record and flights is Flight record, I need now somehow create a WorkingTaskWithFlights but without populating properties of workingTask
0 Replies
No replies yetBe the first to reply to this messageJoin