Silverlight BeginExecute no data is null on server side

Silverlight BeginExecute no data is null on server side

Old forum URL: forums.lhotka.net/forums/t/9990.aspx


JonM posted on Wednesday, January 26, 2011

I'm working on a SL4 project and dataportal.  My CommandBase has one property, a list of a custom class.  I set the value in the BeginExec factory method but in the DataPortal_Execute() code the value is null.  It is like the data isn't making over the dataportal.  I've flagged it with a Csla.Serializable attribute. Is there anything else I need to do to get the value across?

Thanks

JonM replied on Wednesday, January 26, 2011

Okay.  I figured out that the properties must be managed properties.  However the contract serializer explodes when it hits my custom type.  Is there anything I can do about it?

JonnyBee replied on Wednesday, January 26, 2011

Your CustomType must implement IMobileObject.

JonM replied on Wednesday, January 26, 2011

That makes sense.  I'll give it a try.  Thanks!

RockfordLhotka replied on Wednesday, January 26, 2011

You will find it best to inherit from one of the pre-existing CSLA base types. Even if you don't need the top-level steroetype support from BB or ROB, you should look at the MobileXYZ types in Csla.Core - like MobileObject.

In short, you really don't want to implement IMobileObject yourself if you can avoid it, and we already provide some basic implementations that might meet your requirements.

JonM replied on Wednesday, January 26, 2011

That worked! I had to change my List<CustomType> to a Csla.Core.MobileList<CustomType>.  Is that normal?

RockfordLhotka replied on Wednesday, January 26, 2011

The MobileFormatter can only serialize types that implement IMobileObject - that includes the entire object graph, so lists, objects, dictionaries, you name it.

JonM replied on Friday, January 28, 2011

That makes sense.  Thanks!

Copyright (c) Marimer LLC