sagesky36
sagesky36

Reputation: 4692

Cannot await System.Linq.IQueryable

In my WCF service, I am getting the above error with the below code.

I am confused as to why I'm getting this error...

Can someone please explain what I would need to do in order to correct it?

public async Task<List<HH_FuelTkt_Output>> GetFilteredFuelTicketsAsync(HH_FuelTkt_Input value)
        {
            try
            {
                using (HandheldEntities DbContext = new HandheldEntities())
                {
                    var tkts = await DbContext.HH_FuelTkt.Select(s =>
                        new HH_FuelTkt_Output
                        {
                            Customer_Name = s.Customer_Name,
                            FuelTkt_ID = s.FuelTkt_ID,
                            Image_ID = s.Image_ID,
                            Ticket_No = s.Ticket_No,
                            Trans_Timestamp = s.Trans_Timestamp,
                            Vehicle_No = s.Vehicle_No
                        }).Where(w => w.Image_ID != null);

Upvotes: 0

Views: 916

Answers (1)

sagesky36
sagesky36

Reputation: 4692

The problem is, I forgot to include the ToListAsync on the end of the query.

Upvotes: 2

Related Questions