In http://msdn.microsoft.com/zh-cn/library/ee707370 (V = vs.91)
DomaincontextClass supports query, submission, and call of these three domain operations: loadoperation, submitoperation, and invokeoperation.
Loadoperation:
Entityquery <customer> query =
From C in _ customercontext. getcustomersquery ()
Where C. Phone. startswith ("583 ")
Orderby C. lastname
Select C;
Loadoperation <customer> loadop = This. _ customercontext. Load (query );
Customergrid. itemssource = loadop. entities;
You can also:
Loadoperation <customer> loadop =
This. _ customercontext. Load (_ customercontext. getcustomersquery ());
Customergrid. itemssource = loadop. entities;
Walkthrough: demonstrate examples in RIA services:
This. datagrid1.itemssource = _ organizationcontext. Employees; // This line is added.
_ Organizationcontext. Load (_ organizationcontext. getemployeesquery ());
/************** If you want to call getemployeesquery through invokeoperation on a client, you need to add the attribute [invoke ()] to the method on the server.
The program called on the client is as follows:
CTX. getemployees (invokeoperation =>
{
If (invokeoperation. haserror)
{
MessageBox. Show ("invokeoperation. haserror ");
}
Else
{
This. datagrid1.itemssource = invokeoperation. value; // This value can be viewed as a synchronous value.
}
}, Null );