简体   繁体   中英

Using non primitive types in ServiceOperation for WCF Data Service (3.5SP1)

Is there any way at all to create a "mock" entity type for use in a WCF Service Operation?

We have some queries we do that we need to optimize by exposing as a ServiceOperation. The problem is in order to do so we would result in a very long list of primitative types...

Ex

  SomeoneHelpMe(int time, string name, string address, string i, string purple, string foo, int stillGoing, int tooMany, etc...)

And we really need to reduce this to

 SomeoneHelpedMe(CustomEntityNotMappedToAnything e)

This would also help us when it comes time to write some complex queries since there is a 3 param limitation...

I saw this will be possible in 4.0 using "complex types", but i am still in the 3.5SP1 world.

Let me know if anyone needs more information.

So this is confirmed not possible in 3.5 or 4.0! Officially its a no!

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/771587aa-0822-4991-8a3f-0091de044b5c

There is no way to do this currently - both in 3.5SP1 and 4.0. Only primitive types are supported as parameters for service operations.

Use the following link to add this as a feature request: https://connect.microsoft.com/data/SearchResults.aspx?SearchQuery=WCF%2bData%2bServices . You need to sign in and then you can see the list of bugs/features that have been reported externally. You can add in a new feature request or vote for an existing feature request.

Thanks Pratik

The MSDN site suggests serializing the complex type.

"Any data of a non-primitive type must be serialized and passed into a string parameter." - http://msdn.microsoft.com/en-us/library/cc668788.aspx

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