Serialization Error

Posts   
 
    
danvallejo
User
Posts: 6
Joined: 24-May-2007
# Posted on: 17-Dec-2007 22:01:50   

We are using remoting to pass data between layers and getting a serialization error.

Specially, we have a Typed View Row array that we want to pass around.

public partial class SubscriptionHistoryViewRow : DataRow

The problem is that the autogenerated code doesn't have the Serializable attribute.

Ideally, we'd just pass Typed View itself, but it also gives serialization errors even though it is marked as Serializable.

Thoughts?

LLBLGenPro v2.5 (9/24/07) Adapter, .NET 2.0, C#

simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 18-Dec-2007 07:02:25   

A DataRow on its own isn't Serializable (because it doesn't actually hold any data - DataColumns hold the data internally)

You need to either serialize the entire DataTable that owns the row (if it only contains the rows you want), or custom serialize your rows - maybe by extracting an array of object[] via ItemArray and rebuilding on the other side.

Cheers Simon

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 18-Dec-2007 10:53:16   

we have a Typed View Row array that we want to pass around.

Code: public partial class SubscriptionHistoryViewRow : DataRow

The problem is that the autogenerated code doesn't have the Serializable attribute.

Similar question: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=11371

Ideally, we'd just pass Typed View itself, but it also gives serialization errors even though it is marked as Serializable

What have you tried here and what errors exception have you got? Please provide more details so we can help you out.

Also please check the following thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6830

litho
User
Posts: 1
Joined: 18-Dec-2007
# Posted on: 18-Dec-2007 23:18:43   

On behalf of Dan, issue solved

The error we were getting was: "Type 'Phoenix.ORM.GSGlobal.TypedViewClasses.SubscriptionHistoryViewRow' in Assembly 'Phoenix.ORM.GSGlobal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b3db7a2830c3b794' is not marked as serializable."

So, we've acknowledged that a ViewRow doesn't serialize because it is a DataRow. As suggested by simmotech, I changed the return type to SubscriptionHistoryViewTypedView, which does serialize, then on the Business side I am able to extract the SubscriptionHistoryViewRow after deserialization.

Thanks for everyon's help!

Litho