Actually I just found out what was the issue using the WCF tracer...
The OperationContract that returns the Post object to the client did
not have the attribute ServiceKnownType(typeof(PrintSource))]
I think microsoft should look into this... I end up having something
like this on my OperationContract due to the number of inherited
classes.... :
[OperationContract]
[ServiceKnownType(typeof (CGMPost))]
[ServiceKnownType(typeof (MSMPost))]
[ServiceKnownType(typeof(PrintSource))]
[ServiceKnownType(typeof(BroadcastSource))]
[ServiceKnownType(typeof(OnlineCGMSource))]
[ServiceKnownType(typeof(OnlineMSMSource))]
Post GetPostById(Database pDb, int pPostId);
Looks a bit ugly...
On 30 avr, 10:08, graphicsxp <[email protected]> wrote:
> Hi,
>
> So far I could return my objects from my service to the client with no
> issues. Then I've introduced inheritance in my objects and I'm getting
> the following exception on the client side:
>
> The underlying connection was closed: The connection was closed
> unexpectedly.
>
> So before inheritance I was trying to return object of type Post which
> looked like this :
>
> public class Post
> {
> Publication thePublication;
>
> }
>
> public class Publication
> {
> string title;
> string url;
>
> }
>
> It's very simplified of course but I just want to make it clear what
> the object graph looked like. Now if I introduced inhertance in the
> Publication class :
>
> public class Post
> {
> Publication thePublication;
>
> }
>
> public abstract class Publication
> {
> string title;
>
> }
>
> public class OnlinePublication : Publication
> {
> string online;
>
> }
>
> Now I get the exception mentioned above when I try to return a Post
> object....
>
> Does someone know what I can do ?