Steps for creating such an application are below.
Create New Silverlight Application
New project >> Select Silverlight Application.
Check "Enable WCF RIA Services" check box
Create Entity Data model.
Select tables, views and stored procedure from given list to add it to the entity data model.
Create Domain Service.
Before adding a new domain service, compile the web project.
Map or enable entity(s) with domain service. In the Entities list you get all tables (also called entities) available in the entity model.
Now build both projects; Silverlight as well as web. After compiling you will have auto generated code in the Silverlight project which is responsible for communication between Silverlight and Domain service.
Domain service has many built-in methods for selecting, inserting, updating and deleting the entity(s). You may also add new methods as per your requirement.
In the attached Silverlight project we a create custom method to get customer from its id.
public CustomerMaster GetCustomerFromId(int customerId)
{
return this.ObjectContext.CustomerMasters.Where(d => d.CustomerId == customerId).FirstOrDefault();
}
After completion of the web project, you may access this method in Silverlight project.
Create New Silverlight Application
New project >> Select Silverlight Application.
Check "Enable WCF RIA Services" check box
Create Entity Data model.
Select tables, views and stored procedure from given list to add it to the entity data model.
Create Domain Service.
Before adding a new domain service, compile the web project.
Map or enable entity(s) with domain service. In the Entities list you get all tables (also called entities) available in the entity model.
Now build both projects; Silverlight as well as web. After compiling you will have auto generated code in the Silverlight project which is responsible for communication between Silverlight and Domain service.
Domain service has many built-in methods for selecting, inserting, updating and deleting the entity(s). You may also add new methods as per your requirement.
In the attached Silverlight project we a create custom method to get customer from its id.
public CustomerMaster GetCustomerFromId(int customerId)
{
return this.ObjectContext.CustomerMasters.Where(d => d.CustomerId == customerId).FirstOrDefault();
}
After completion of the web project, you may access this method in Silverlight project.
No comments:
Post a Comment