This is a migrated thread and some comments may be shown as answers.

Domain Method with Complex Type

3 Answers 64 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brent
Top achievements
Rank 2
Brent asked on 06 Jun 2013, 04:48 PM
I have generated a Domain Method based on an SP on my server that returns a complex type.  I have generated the web service using the Telerik wizard.  Inside of my Context class on the server I see the stub for the function call.

Public Function TestSP() As IEnumerable(Of Global.AspireWeb.TestSPResultSet0) Implements IMyContextUnitOfWork.TestSP
   Dim queryResult As IEnumerable(Of Global.AspireWeb.TestSPResultSet0)= Me.ExecuteQuery(Of Global.AspireWeb.TestSPResultSet0)("[TestSP]", CommandType.StoredProcedure)
   Return queryResult
End Function

How would I call this from the silverlight side? As the complex resultset Global.AspireWeb.TestSPResultSet0
 does not appear to be exposed to the client, I'm just confused how to properly make the call from the client to grab and parse what is being returned in queryResult. 

Thanks,
Brent

3 Answers, 1 is accepted

Sort by
0
Kaloyan Nikolov
Telerik team
answered on 10 Jun 2013, 08:10 AM
Hi Brent,

Telerik OpenAccess ORM generates services for the context endpoints (tables or views) only. If you want to invoke a Domain Method (stored procedure or function) from your client you should add a new method in your service.
I would suggest you to add this new method in a partial class of the target service in order to guarantee that your change will be preserved in case you regenerate the services. 

NOTE: our Services Wizard generates data transport objects (DTO) for the entities being returned by the services, You should create such classes for your complex type classes as well to be able to serialize them. 

I hope this helps. Please do not hesitate to get back to us if you have any other questions.
 

Regards,
Kaloyan Nikolov
Telerik
OpenAccess Samples Kit boasts 50+ sample applications providing diverse real-life business solutions. Click to read more and see OpenAccess ORM in action.
0
Brent
Top achievements
Rank 2
answered on 12 Jun 2013, 11:48 AM
Do you have an existing example for pulling in a dataset being returned by a sp?  or Could you elaborate on how i would do this:

"NOTE: our Services Wizard generates data transport objects (DTO) for the entities being returned by the services, You should create such classes for your complex type classes as well to be able to serialize them. "

Thanks,
Brent
0
Kaloyan Nikolov
Telerik team
answered on 14 Jun 2013, 01:20 PM
Hi Brent,

At the time being we don't have such an example. You can have a look in our examples using Plain WCF Services  in our Samples Kit. You will find there that for each of the Domain Classes there is DTO object generated and Assembler class which transforms the DomainClass retrieved from OpenAcces into DTO object and the other way around. The DTO class is a simplified copy of this DomainClass generated by OpenAccess ORM but it is decorated with all needed [DataContract] and [DataMember] attributes. 

Another option for you would be to return directly the ComplexType class generated by OpenAccess ORM. WCF is smart enough to handle it and to create the metadata need by itself. This approach will work if you don't need to control the WSDL generated by the service. Although this approach is not highly recommended. 
 

Regards,
Kaloyan Nikolov
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
Tags
Web Services
Asked by
Brent
Top achievements
Rank 2
Answers by
Kaloyan Nikolov
Telerik team
Brent
Top achievements
Rank 2
Share this question
or