locked
Hybrid Data Service and WCF Approach RRS feed

  • Question

  • I'm very interested in pursuing a hybrid approach to using WCF and ADO.NET Data Services as outlined by Pablo Castro in one of his blog posts a while back (http://blogs.msdn.com/pablo/archive/2007/05/04/application-models-for-astoria.aspx).

    That said, I'm wondering how to actually go about doing something like that - here's the scenario...

    I envision that about 80% of the calls needed by our app are data-only, select/get queries that could be executed using the ADO.NET Data Services interface. Let's say the other 20% of the service-based activities are more advanced - stuff like operating on multiple sets of data, processing large amounts of data, etc. - stuff you wouldn't or couldn't do using ADO.NET Data Services alone.  

    The question becomes, how do I use the two different approaches in a combined, sensible way? For example, let's say I use the ADO.NET Data Services to get a List<Widgets>. Later on, I want to order a Widget, which requires me to call a WCF service, say Purchase(Widget), that does a bunch of heavy-lifting on the server-side. How can I share types across both WCF and ADO.NET Data Services so that I can use the same client-side Widget object that I get as the return type for the Data Service and pass it right back into the WCF service.

    Of course, I am using ADO.NET Entity Framework underneath all of this as the DAL, so both services are surfacing up the same underlying types, so I'm hoping there's some ideas out that there that might make this process easier. Additionally, the client app will be Silverlight, but I hope that is a moot point and whatever solution will work regardless.

    Thanks for any input.


    Chris
    Wednesday, January 14, 2009 1:47 AM

Answers

  • No no we dont tell you the answer, you have to pay for this kind of support
    --------------joking aside


    Hi Chris Wiedarspan

    Well just remember this, data service and wcf just care that the object you are using meets the "interface" of the entity, so you can create your wcf service and reuse the object from there on the dataservice context vise versa.

    You will find that the Add Service Reference dialog and the code generators provided in visual studio will not be upto the task as you can not control the types they generate. So you might create the two service references and then start modifying them so they use only one object "pool". every time you decide that you want to update the reference you would have to bear in mind all that work you done before to set things up.

    If you are creating the contexts manually then you should not have any troubles as you can code to take things like that is consideration.

    If you want to example let me know and I can build some solution demonstrating it working. 

    But I will need brownies and hugs and well adoration. 

    PS.: just the brownies will do.

    Daniel Portella Blogger from hell http://undocnet.blogspot.com

    Daniel Portella - http://undocnet.blogspot.com - This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, January 27, 2009 12:58 PM

All replies

  • No no we dont tell you the answer, you have to pay for this kind of support
    --------------joking aside


    Hi Chris Wiedarspan

    Well just remember this, data service and wcf just care that the object you are using meets the "interface" of the entity, so you can create your wcf service and reuse the object from there on the dataservice context vise versa.

    You will find that the Add Service Reference dialog and the code generators provided in visual studio will not be upto the task as you can not control the types they generate. So you might create the two service references and then start modifying them so they use only one object "pool". every time you decide that you want to update the reference you would have to bear in mind all that work you done before to set things up.

    If you are creating the contexts manually then you should not have any troubles as you can code to take things like that is consideration.

    If you want to example let me know and I can build some solution demonstrating it working. 

    But I will need brownies and hugs and well adoration. 

    PS.: just the brownies will do.

    Daniel Portella Blogger from hell http://undocnet.blogspot.com

    Daniel Portella - http://undocnet.blogspot.com - This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, January 27, 2009 12:58 PM
  • Daniel,

    Thanks for the info - I was beginning to wonder if my post had been lost in the ether. Anyway, that's pretty much what I had suspected. I was hoping there would be a nice, tidy process/work-around to pool up the similar data types into a common set, but I can do that on my own.

    I would be great if MS could target something in the upcoming releases because it seems - and I'm using it in "the real world" - that this is a great approach to building a multi-tiered, distributed app, and making it easier would be the icing on the cake.

    Thanks again - brownies are in the email!!!

    Chris


    Chris
    Tuesday, January 27, 2009 2:52 PM
  • No no we dont tell you the answer, you have to pay for this kind of support
    --------------joking aside

    Hehe, thank you I now researching a way to materialize brownies that have been digitalized.

    ps.: dont forget to mark the answer.

    Daniel Portella Blogger from hell http://undocnet.blogspot.com

    Daniel Portella - http://undocnet.blogspot.com - This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, January 27, 2009 3:00 PM