in ef core I have a contract entity which has a paymentRequirement entity. I want to bring back just the payment requirement entity given the contract's id.
public async Task<PaymentRequirement> GetPaymentRequirementByContractAsync(long Id) =>
await context.Contracts.Include(p => p.PaymentRequirement).FirstOrDefaultAsync(p => p.Id == Id)?.PaymentRequirement
Severity Code Description Project File Line Suppression State Error CS1061 'Task' does not contain a definition for 'PaymentRequirement' and no accessible extension method 'PaymentRequirement' accepting a first argument of type 'Task' could be found (are you missing a using directive or an assembly reference?) Minerals C:\Users\c-bdelling\source\repos\Minerals\Minerals\Repositories\PaymentRequirementRepository.cs 15 Active
here is the contract
public class Contract : AuditedEntity
{
public long Id { get; set; }
public long? PaymentRequirementId { get; set; }
public PaymentRequirement PaymentRequirement { get; set; }
}
here is paymentrequirment
public class PaymentRequirement
{
public long Id { get; set; }
public decimal? FloorPrice { get; set; }
}
?
? – vivek nuna