ComplexTypes in service operations in version 1.2?

Mar 10, 2011 at 6:16 AM

Hi All,

As far as I know the current version of the SDK doesn't support complex types, i.e. a service operation that returns a complex type isn't supported. Will this be supported in ver. 1.2?

BR, Max.

Mar 10, 2011 at 11:33 PM

It does support complex types returned from a service. QueryOperationResponse has a member called m_result which is an array of typed objects from the service. Please refer to the user guide and look at the samples.

Mar 15, 2011 at 4:36 AM

Is this really supported? How the QueryOperationResponse is used with the serice operations? 

User Guide says the following about the service operations.

FunctionImport

FunctionImport element in service metadata is used to import Stored Procedures or Functions defined in Store Schema Model into Entity Data Model. Odatagen will generate the function in the class as per functionimport element in service metadata document.  You can then use OData Client for invoking the function by passing the parameter(s) required by this function. Following are some of the examples of FunctionImport:

Function which accept single parameter and return collection:

DemoService *proxy=[[DemoService alloc]initWithUri:@"http://services.odata.org/OData/OData.svc/" credential:nil];

NSArray *arr=

       [proxy

              GetProductsByRatingWithrating:[NSNumber numberWithInt:4]

       ];

 Product *p=nil;

int count=[arr count];

 for (int i=0;i<count;i++)

{

       p=[arr objectAtIndex:i];

       NSLog(@"name = %@",[p getName]);

}

 [proxy release];

 

Mar 15, 2011 at 8:59 AM

I did not read you question carefully. I did not realize you were asking about FunctionImport. QueryOperationResponse has nothing to do with FunctionImport, but rather with ObjectContext.execute or DataServiceQuery.execute.

In the above example, the Product class can be a class that is generated by odatagen from a complex type.

Apr 4, 2011 at 9:36 PM
Edited Apr 4, 2011 at 9:36 PM

As far as we've seen in our project service operations that are returning complex types are NOT working. I.e. the following service operations (in a wcf data service) does not work using the SDK:

 

[WebGet]
public IQueryable<ProjectSummary> GetProjectSummaries()

[WebGet]
public AverageCompanyRating GetAverageCompanyRating(int companyId, bool completedProjects)

 

Notice that the first operation is returning an IQueryable collection of the type ProjectSummary and the second operation returns a single AverageCompanyRating. Both types are however complex types. Is there anybody out there that has managed to get service operations that are returning complex types to work in the SDK?

 

BR, Max.