Closed as not planned
Description
I have two tables, Request and State. In the Request table, I've defined a computed property CurrentStatus as follows:
public abstract class Request<TKey, TStatus>
where TKey : IEquatable<TKey>
where TStatus : struct, Enum
{
private readonly List<State<TKey, TStatus>> _statuses = new();
[NotMapped]
public virtual TStatus? CurrentStatus
=> _statuses
.OrderByDescending(x => x.DateSigned)
.Select(x => x.Status)
.FirstOrDefault();
}
Is there any way to translate the CurrentStatus property without the need to store it in the database explicitly or create a function? I'm looking for a solution that handles this calculation without requiring a database column and ensures efficient querying.
I've attempted to use "Computed columns," but they don't seem to support computations involving properties from other tables.
EF Core Version: 7
Database Provider: SQL Server