Domain Method with Complex Type

4 posts, 0 answers
  1. Brent
    Brent avatar
    33 posts
    Member since:
    Jun 2010

    Posted 06 Jun 2013 Link to this post

    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

  2. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 10 Jun 2013 Link to this post

    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.
  3. DevCraft banner
  4. Brent
    Brent avatar
    33 posts
    Member since:
    Jun 2010

    Posted 12 Jun 2013 Link to this post

    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
  5. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 14 Jun 2013 Link to this post

    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.
Back to Top