Note:
System. servicemodel. domainservices. Client. loadoperation-used for asynchronous loading
System. servicemodel. domainservices. Client. invokeoperation-used for asynchronous calls
System. servicemodel. domainservices. Client. submitoperation-used for asynchronous submission
Method 1
Private Void Button3_click ( Object Sender, routedeventargs E)
{
DS. Load (Ds. getselectallstudentquery (), (x) =>
{
This . Maid = x. entities;
}, Null );
}
Statement 2
Private Void Button3_click ( Object Sender, routedeventargs E)
{
Loadoperation <selectallstudent_result> loadoperation = Ds. Load (Ds. getselectallstudentquery (), onloadcallback, False );
}
Private Void Onloadcallback (loadoperation <selectallstudent_result> loadop)
{
If (Loadop. haserror)
{
MessageBox. Show (loadop. Error. Message );
Loadop. markerrorashandled ();
}
Else
{
This . Maid = loadop. entities;
}
}
Statement 3
Private Void Button3_click ( Object Sender, routedeventargs E)
{
Entityquery <selectallstudent_result> query = Ds. getselectallstudentquery (). orderbydescending (P => P. studentid );
Loadoperation <selectallstudent_result> Lo = Ds. Load (query );
Lo. Completed + = Delegate
{
This . Maid = Lo. entities;
};
}