I’ve made a service for my silverlight 4 database (SQL) affairs (VS2010, C# ASP.NET web app), now I’m writing my SQL functions in this service, how can I use this functions? I’ve read some articles about deploying services but I think my case should not be much complicated, I have a big ASP.net web app with several web pages (I have a server running on winserver2008), it works great, also I have a SL app, what kind of files should I upload for using service? do I need an asmx? how can I create it? should I change anything in web.config?
what is the easiest way to use my service for communicating between SQL and SL? thanks
WCF RIA Services is the way to go. You do not want to bother with old-school ASMX web-services.
You will use an EF model and a DomainContext on the server to handle all database access via CRUD methods (Create, Read, Update & Delete).
On the client you will use the generated Domain Service client to access data.
Notes from my previous RIA post:
My suggestion is to always create RIA Service libraries instead of adding directly to a Silverlight application. Then you can link the Client-side library to any number of Silverlight applications, then link the .Web part of the RIA library to your website to provide the WCF service. Again the key is to migrate the config settings.
It will probably make a lot more sense if you create a new RIA services library project, add your EDM etc, then link the halves to a separate Silverlight app and your new ASP.net website.
Step-by-step:
RiaServices.webproject. Select Add new item. Select Data on the left. Select ADO.Net Entity Data Model on the right. I will assume it is called the defaultModel1.edmxfor this example. Connect it to your database tables etc.RiaServices.webproject. Select Add new item. Select Web on the left. Select Domain Service Class on the right. I will assume it is calledDomainService1.csfor this example. Choose your data items from the Add New Domain Service Class popup window by ticking the checkboxes. A set of RIA services objects and methods will be created for each item you select.Use the
RIAServicesLibrary1client object (called DomainService1 in this example) directly from your Silverlight code like this:DomainService1 client = new DomainService1();
or use the
Data Sourceswindow to drag/drop a new grid etc onto a page.If the
Data Sourceswindow is not visible select the “Data” menu then the “Show Data Sources” option.For more information try this Microsoft link: Using WCF RIA Services