locked
Lightswitch runtime system.data.dll RRS feed

  • Question

  • Hi. Sorry my english. I want in my Lightswitch project in runtime be possible to click a button to delete the data from another database than that is used by Lightswitch ... For that I need to use system.data.dll, which is not allowed in Silverlight.
    For this I tried to add a class by external add the link, but as the project Lightswitch uses the references of own project, did not work.
    I wonder if it is possible to create the server a silverlight wcf service-enable and add to the customer.
    Thank you.
    Friday, January 4, 2013 2:43 PM

Answers

  • Hello,

    Indeed, in the SilverLight frontend you can't use the System.Data namespace. You have to create a WCF service to do data manipulation and call the service from your frontend.

    When you add a datasource to your LightSwitch project, the WCF service is created automatically and you can add own methods to it.

    Otherwise, an easy way would be to use OData service, the implementation is quickly done; see WCF Data Services...


    Olaf Helper

    Blog Xing

    • Marked as answer by Angie Xu Tuesday, January 15, 2013 5:30 AM
    Sunday, January 6, 2013 9:28 AM

All replies

  • Hello,

    Indeed, in the SilverLight frontend you can't use the System.Data namespace. You have to create a WCF service to do data manipulation and call the service from your frontend.

    When you add a datasource to your LightSwitch project, the WCF service is created automatically and you can add own methods to it.

    Otherwise, an easy way would be to use OData service, the implementation is quickly done; see WCF Data Services...


    Olaf Helper

    Blog Xing

    • Marked as answer by Angie Xu Tuesday, January 15, 2013 5:30 AM
    Sunday, January 6, 2013 9:28 AM
  • Why not add the other database as an external data source in LightSwitch, using the Attach Data Source Wizard?

    Then you can manipulate it as just another collection of tables.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Monday, January 7, 2013 4:01 AM
    Moderator
  • Thanks for the replies. The point is that there are several external Databases, then I need to change the connection string at runtime. strings have the connection in the application Database lightswitch, and depending on which button click will access another specific Database.
    Monday, January 7, 2013 9:21 AM
  • This is not a scenario that is natively supported by LightSwitch. The only way that I can think of is to use RIA Services, that can respond to such different access requirements. You'll have to write the code to do this yourself.

    In a RIA service, you have access to the full .NET framework, you're not subject to any Silverlight restraints in your code.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    • Proposed as answer by Angie Xu Monday, January 14, 2013 12:32 AM
    Tuesday, January 8, 2013 3:55 AM
    Moderator
  • What I did was add to the solution a wcf service that used the System.data.dll, and LS client asynchronous mode access . Do not know if it's the best solution. Again, thanks for the help.
    Tuesday, January 8, 2013 9:11 AM
  • You're welcome.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Tuesday, January 8, 2013 10:50 AM
    Moderator