locked
Possible to reuse types? RRS feed

  • Question

  • Hello,


    Is it possible to have a ADO data service client that reuses types, instead of generating proxies for each type?



    Suppose I have a business model, with some entity classes, containing small methods for business logic.


    After creating a data service for this model, I want a client to consume this service,
    so i choose "Add Service Reference" in my client project. I make sure that the business model project is
    referenced from the client project and that
    In the advanced tab, "Reuse types" is checked.

    However, proxy objects are generated on the client and the existing classes of my
    business model are not used. So I lose the small business logic contained in these classes..



    Is there any way to use the classes from the business model on the client?


    Thanks,
    Koen
    Friday, October 24, 2008 7:43 AM

Answers

  • If you already have objects in the client that match to the server model, then you need not generate proxy objects using AddServiceReference. You can use DataServiceContext, and pass the uri to the service and use that directly to query/update from the client. Sure, you won't get strongly typed DataContext with all the helper methods, but if you want one, you can quickly write one yourself.

     

    Thanks

    Pratik

    Monday, October 27, 2008 4:33 PM
    Moderator

All replies

  • If you already have objects in the client that match to the server model, then you need not generate proxy objects using AddServiceReference. You can use DataServiceContext, and pass the uri to the service and use that directly to query/update from the client. Sure, you won't get strongly typed DataContext with all the helper methods, but if you want one, you can quickly write one yourself.

     

    Thanks

    Pratik

    Monday, October 27, 2008 4:33 PM
    Moderator
  • Ok, that's nice.

    It would have been nicer though if you could just use
    AddServiceReference with option "Reuse existing types" and the client-side DataServiceContext would be generated, using the server model's classes so that you would get all the helper methods with it..

    I'll use this for now, thanks.
    Wednesday, October 29, 2008 7:34 AM