While refreshing Silverlight knowledge, an article leads me to think is the time to study how to call a function in domain services from Silverlight page.

I reuse the same solution which i created in my previous post:

1. Add a new domain services class called “Employee.cs” in “Services” folder under web project. Create a new function to return a simple string object.


2. Add the following code in the new created silverlight page.


3. Invoke the string function in domain service. Due to all calls to domain services are async, the return value of the function “ReturnTestString” will not carry anything in function “OnNavigatedTo”, so we need to add a callback class “OnInvokeCompleted” to get the return value and bind to the textblock.


4. Result!