Domain services are WCF services that expose the business logic of a WCF
RIA Services application. Domain service contains set of business related data
operation and it is exposed as WCF service.
Domain Context class at the client
side is used to consume the Domain service by using Domain Client object. it is available inside the namespace "System.ServiceModel.DomainServices.Client"
Below diagram explains
integration of the RIA service with WCF.
The Domain Service class is the base class for all classes that serve as domain services.
The Domain Service class is the base class for all classes that serve as domain services.
- DomainServiceHost is the hosting class for
domain service; internally
- DomainServiceHost uses the WCF Service Host
class to host the application.
A domain service class
must be marked with the EnableClientAccessAttribute attribute
to make the service available to the client project. The EnableClientAccessAttribute is automatically applied to a domain service when you select the Enable client
access check box in the Add New Domain Service Class dialog box. When the
EnableClientAccessAttribute attribute is applied to a domain service, RIA
Services generates the corresponding classes for the client project.
Example:
[EnableClientAccess()]
Public class EmployeeDomainService:
DomainService
{
Private EmployeeData data
= EmployeeData.Instance;
Public IEnumerable <
Employee> GetEmployees ()
{
Return
data.EmployeeList;
}
}
No comments:
Post a Comment