tags:

views:

60

answers:

2

I'm trying to use SubSonic with WCF. I can get data into List but I can't return that data to client side, its error is

The socket connection has been disposed. Object name: 'System.ServiceModel.Channels.SocketConnection'.

I try to send and retrieve data to/from WCF by POCO object and it working but when I try to use generated class from SubSonic it don't work anymore, so I think its has some problem.

A: 

I would assume that this is not the "real" exception. I am not familiar with WCF but maybe you find something in the logs.

Here is an article about debugging WCF http://www.codeproject.com/KB/WCF/DebugWCFApps.aspx

Most likely WCF is trying to serialize a SubSonic class with nullable properties. Properties of SubSonic classes are marked as XMLAttribute, which throws an error if you want to serialize a nullable type. Nullables can only be serialized as XMLElements.

Try if it works with a SubSonic generated class that has no nullable property.

SchlaWiener
I can debugging at service side now but it's error when I try to use message.GetBody<T>(new NetDataContractSerializer());
In The Pink
A: 

After I've downloaded source code of SubSonic and debug into it SubSonic.Core, I found that it error because GetBody<> will create instance of that class, and inside its constructor is trying to connect to database which it can't; client has no access to database.

Now I'm working on create mapping class with SubSonic and return POCO instead.

In The Pink