Home > Back-end >  .Net core Join return IEnumerable List
.Net core Join return IEnumerable List

Time:10-17

I'm having two classes Experience and ExperienceReservation : The experience containt a foreign key named HostId and the ExperienceReservation contains only the experienceId ! i'm trying to return the list of each Reservation for only hosts so i want to join the two tables and return an array list IEnumerable that contains the specific reservations for each Host ! Here is my code :

enter image description here

after execution , this error appears : enter image description here

I already knows that the return type causes a problem so is there a way to resolve it ??

CodePudding user response:

Add ExperiencesReservations after select new and return query only without casting.

Make sure to read the post instructions in order to be more clear when explaining an issue.

CodePudding user response:

If you want to convert List<> to IEnumerable<>,try to use:

return query.AsEnumerable();
  • Related