Hi,
Can anyone tell me how to create RIA Services for Silverlight?
Please give some working samples or code
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Priya LingePosted Aug 12, 2011, 5:34 AM
Hi,
For Creating Ria DomainService ,Please follow the below steps,
Step 1> Suppose Your Silverlight Application Project let say RiaDomainSevices . Now right Click on your Web Project and select "Add New Item", Select "Data" from the Tree Menu on the Left, and then Select "ADO.NET Entity Data Model".Select table data which you want,then build your web project after that select "Add New Item", Select "Web" from the Tree Menu on the Left, and then Select "Domain Service Class".You will get Domain Service which you created.
Here you will get below assemblies by default, Please make those dll Copy Local to true by selecting their property.
using System.ServiceModel.DomainServices.EntityFramework;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.Server;
Bulid your Domain service,then add below assemlies reference in your page.xaml.cs.
using System.ServiceModel.DomainServices.Client;
using RiaDomainSevices.Web;
[EnableClientAccess()] GetEmployees() employees = new List();
public class EmployeeDomainService : DomainService
{
public List
{
List
EmployeeDTO employee = new EmployeeDTO();
employee.ID = 1;
employee.FirstName = "Jason";
employee.LastName = "Apergis";
employees.Add(employee);
employee = new EmployeeDTO();
employee.ID = 2;
employee.FirstName = "Ethan";
employee.LastName = "Apergis";
employees.Add(employee);
employees.Add(employee);
return employees;
}
}
for Accessing service from client side, add namespace of web part and then access:
private EmployeeDomainContext _context = null;
public EmployeeViewModel() //constructor of client
{
_context = new EmployeeDomainContext();
_context.Load(_context.GetEmployeesQuery());
}
please see the below links.
http://forums.silverlight.net/forums/p/173862/391495.aspx
http://forums.silverlight.net/forums/p/203848/476896.aspx
For Creating Ria Domain Services.
http://www.adam-thompson.com/category/Silverlight-4.aspx
http://msdn.microsoft.com/en-us/library/ee707376(v=vs.91).aspx
Hope this will help you.
Thanks.