Ok, I have managed to get the following working
public IQueryable getTicketInformation(int ticketID)
{
var ticketDetails = from tickets in _context.ticke
As Marc stated you're not constructing instances of myObject
when your query is run. But additionally you don't need to cast it to an IQueryable
, a LINQ select statment will return an IQueryable
unless explicity cast to an IEnumerable
.
Also, be careful that your DataContext hasn't been disposed of before you try and access the data being returned. But I noticed your context is not constructed in the method, be careful that you're not maintaining a DataContext for too long, it's a unit-of-work object and not meant to be kept open for long periods of time.