MVCContrib CustomPagination WCF Serialization

205 views Asked by At

All the parameters for CustomPagination<T> (datasource, page number, page size, and total items count) I retrieve in the WCF Service. It would be awesome if I could instantiate CustomPagination right there, in WCF and pass it back to my application. However, it looks like it cannot serialize CustomPagination object because it misses attributes like [DataContract] and [DataMember].

I know I could pass back all of the values required for CustomPagination separately or in another custom made object, but it would be a lot nicer to pass back just one ready to use CustomPagination object. Any suggestions on this?


Error that I get when try to update my service reference in my application:

Type 'MvcContrib.Pagination.CustomPagination`1[Myproject.WCFServices.DataContracts.User]' cannot be serialized.

The User object is marked with appropriate [DataContract] and [DataMember] attributes.

1

There are 1 answers

0
LOAS On

As much as I dislike all the 'what do you want to do that for'-posts around here, here goes :)

I would like to respectfully question the following:

but it would be a lot nicer to pass back just one ready to use CustomPagination object

I do see your point. But to me, the mvccontrib stuff is strictly mvc (eg front-end). I would go out of my way not to reference it from my wcf backend service. As it stands, I don't have to go out of my way as the easier solution (as you point out) is to just create the CustomPagination in the controller (which is what I do).