locked
Using WCF Service as a data source for lightswitch html client RRS feed

  • Question

  • Hi,

    how exactly are you supposed to use an existing wcf service as a data source in lightswitch ?

    if I select add a external data source and choose WCF RIA Service it wants a dll to pull into the lightswitch app, what if you do not have that dll - but you have a deployed wcf ria service at an url - how are you supposed to use that ?

    if you do have the dll, and you add the service using that so that your entities can be used , how do you set the endpoint for the service when you want to deploy the app?

    the endpoint for the service is already published at a public url.

    mrP


    • Edited by mrP Wednesday, November 20, 2013 7:17 PM
    Wednesday, November 20, 2013 7:07 PM

Answers

All replies

  • Hi,

    Yann has replied  a similar question before.

    Well LightSwitch is REALLY clever with how it handles custom RIA services that you add to your project. There's nothing "special" that you need to do, LS does it all for you.

    I'd have to check, but I wouldn't be surprised if LS doesn't actually publish the RIA service to the server tier automatically. Best practices are a large part of the LS architecture, & that would be best practice.

    If you're dealing with a RIA service that lives outside of LS, then that's a different story.

    You may get detailed information from Specifying the url of a WCF RIA service when deploying

    Please let me know if I have misunderstood you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, November 21, 2013 8:58 AM
  • from the link you posted,

     If the LightSwitch application is using a custom RIA Service, it is deployed along with the application. In your case, it sounds like the published application is configured to be 2-tier, which means that the LightSwitch server is running on the client machine. Since the server builds against the RIA Service, then the RIA Service must be deployed with the server assemblies.

    the highlighted portion is what I was looking for, some guidance on achieving that.

    after some playing around... if you add the wcf service as a datasource by pointing to the dll, loading in the entities etc, I find that if you modify the web.config in the server project to include an endpoint ( to the same wcf service running on a different server\website) - it DOES seem to get the data from there, however I don't know if that is the correct way to achieve this as there seems to be a lack of documentation on using this approach in the real world.

    I can't find any documentation or guidance from Microsoft on this, where is the lightswitch\wcf documentation that explains the steps above ?

    however this approach means that you can only ever use a wcf service as a data source if you have the dll - that seems a bit of a limitation.

    MrP

    Thursday, November 21, 2013 3:30 PM
  • Hi,

    You can try calling Soap based WebService (that talks to TRIM) from WCF RIA Service. WCF RIA Service can stay with the LightSwitch application and use it as a datasource.

    For more information, you can refer here

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/66b501eb-7682-48c0-9734-51e9642466d8/accessing-remote-wcf-ria-service-from-the-lightswitch-application?forum=lightswitch

    #How to Connect to a WCF service from LightSwitch- Part One

    http://www.danlmoyer.com/?p=130

    Hope it can help you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 22, 2013 8:29 AM