简体   繁体   中英

MVCContrib CustomPagination WCF Serialization

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM