The following code does not compile because SingleOrDefaultAsync() is not a suitable extension for GetAppointments(). I was just wondering why ...
public IQueryable<Appointment> GetAppointments()
{
return Context.Appointments;
}
public async Task<Appointment> GetAppointmentAsync(int appointmentId)
{
return await GetAppointments().SingleOrDefaultAsync(a => a.ID == appointmentId);
}
I am using EF 6.0.0. And please ignore what I am doing here exactly. I just tried to make things easier than they actually are in my project.
Make sure you have added System.Data.Entity
namespace to your usings. This is an extension method, and it will not be available until you add appropriate namespace.
I fixed it by adding using Microsoft.EntityFrameworkCore;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With