title: Ria Services Passing Complex Object as parameter to a query domain service method
body: <p>I'm experiencing some difficulties with a WCF RIA Services similar to the problem specified in <a href="https://stackoverflow.com/questions/2330085/cant-pass-collection-class-as-parameter-to-ria-services">this thread</a>.</p>
  
  <p>The domainservice method I'm creating (a Query method) should take a complex object parameter.
  example domainservice method:</p>
  
  <pre><code>public ComplexObjectResult GetComplexObject(ComplexObjectParameter test)
     {
          //do stuff
     }
  </code></pre>
  
  <p>the parameter object:</p>
  
  <pre><code>public class ComplexObjectParameter 
  {        
  
      [Key]
      public decimal ID { get; set; }
  
      ... other fields
  }
  </code></pre>
  
  <p>I get this compilation error: <strong>Error   70  Parameter 'test' of domain operation entry 'GetComplexObject' must be one of the predefined serializable types</strong>.</p>
  
  <p>After some searching on the web I found <a href="http://forums.silverlight.net/forums/p/96425/302186.aspx" rel="nofollow noreferrer">this msdn thread</a>. It states that this is a limitation of RIA services and the thread specifies no decent workarounds.</p>
  
  <p>Now there seem to be some dirty workarounds:</p>
  
  <ul>
  <li><p>Change the complex parameter to type string and Serialize/Deserialize the parameterobject ourself which I find a very hacky solution.</p></li>
  <li><p>Use [Invoke] tag on the domain service method and loose all RIA tracking functionality, for which I am using RIA in the first place.</p></li>
  </ul>
  
  <p>Are there alternatives for the mentioned solutions that have less disadvantages? Has someone found a more elegant workaround for this problem?</p>
  
  <p>Thanks</p>