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

  • Question

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


      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.

    Monday, April 19, 2010 4:54 PM


All replies

  • Hi Nick ,

     Unfortunately , passing in non-primitive types as input parameters to a service operation is not supported in the 3.5 SP1 or the 4.0 release of WCF Data Services.

    You can vote on the feature here :


    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Monday, April 19, 2010 4:57 PM
  • The blog world seems to say you can do it via complex types....? Is this incorrect?






    Wednesday, April 21, 2010 9:07 PM
  • Unfortunately you can't - that blog post is talking about the output type. For parameters, you can (currently) only use primitives, and they must go inside the query string - which has a 2KB limit.

    Now, you can fake this by serializing whatever types you want to pass into XML, and modify the service op to accept just one XElement parameter. Then, you need to deserialize the type on the server.

    In addition, to get around the 2KB limit, you likely need to batch the request.



    Peter Q. http://blogs.msdn.com/peter_qian
    Wednesday, April 21, 2010 9:38 PM
  • The system has encountered an unexpected error. We apologize for the inconvenience. The issue will be addressed as quickly as possible. 

    If this error continues, click the Help link at the top of the page to report the issue and include this error ID in your e-mail: 342fa7b0-6c0f-43f3-996c-58c4234b3c79 

    Microsoft Connect welcome page.
    Tuesday, January 7, 2014 10:49 AM