سؤال

I have two classes, client and user. User is a field in client (there is a foreign key). I am trying to do a join, getting all the clients and the related user (it is one to one).

I am using Entity Framework and a web service that gives me my data.

I currently am getting all my clients like:

public DbSet<Client> getClients()
{
    return context.Clients;
}

I need to also get the related object user. I found an example that tells me to do:

public DbSet<Client> getClients()
{
    return context.Clients.include(x => x.User);
}

This throws an exception, I need to be working with IQueryable. If I change my function the connection to the web service does not work.

How do I do what I am trying to do?

EDIT:

The exception I get from the webservice is An error occurred while receiving the HTTP response to http://localhost:60148/WebService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

هل كانت مفيدة؟

المحلول

try these links: Expose IQueryable Over WCF Service and IQueryable problems using WCF you need to send something else back, like a List, as IQueryable is actually a query, which you can't send back. the links above provide alternative ways to do it, to get around the IQueryable restriction.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top