Wcf service returning linq object
Posted: Thu 03 Feb 2011 13:30
I'm trying to create a wcf service that returns a linq-mapped object.
I have a table "Users" mapped with linq as "User" and a table "Groups" mapped to "Group".
Groups has a many-to-many with Users and with itself.
When I try to return the linq object explicitely like this:
the client gets disconnected from the wcf service with error 10054 : "An existing connection was forcibly closed by the remote host".
If I try to return a simple string in my service it works.
Is there a problem returning a linq object this way?
Since this worked for EF I think this should work too.
EDIT: I also read about setting Serialization Mode=Unidirectional but when I set it the code generated is checking for a bool property "serializing" which doesn't exists in my User class.
I have a table "Users" mapped with linq as "User" and a table "Groups" mapped to "Group".
Groups has a many-to-many with Users and with itself.
When I try to return the linq object explicitely like this:
Code: Select all
User result = context.Users.Where(u => u.Id == 1);
return user;
If I try to return a simple string in my service it works.
Is there a problem returning a linq object this way?
Since this worked for EF I think this should work too.
EDIT: I also read about setting Serialization Mode=Unidirectional but when I set it the code generated is checking for a bool property "serializing" which doesn't exists in my User class.