|
Bill,
The example in the documentation is correct.
You asked "what is entityManager initialized to"
- For server-side code accepting an EntityManager we create a server-specific EM just for that particular use. In the case of RPC methods it's a bit different in that the type will usually be the type of the calling EM on the client.
By the way, in an earlier post, you showed the following line of code:
private static LaborWareEntities _manager = LaborWareEntities.DefaultManager;
Avoid using static EntityManagers in server-side code. The server code must be able to support multi-threading, and using a static EM means you're opening yourself up to unforeseen multi-threading errors later on. These threading problems usually don't show up in development and early testing, but they show up when you go into production.
You mentioned "Here is your remote server method, it looks like even though you are calling it asychronously your GetQuery is a synchronous call"
- Regardless of being called SYNCHRONOUSLY or ASYNCHRONOUSLY in the Client, the Server Method will be executed SYNCHRONOUSLY in the Server.
You asked "is null, null the principal and the entitymanager"
- InvokeServerMethodAsync has 3 overloads. The one shown in your post is: InvokeServerMethodAsync(String,String,Action<InvokeServerMethodOperation>,Object,Object[])
Here's a quote from our API documentation:
======================================================================
Asynchronously invokes the specified static (Shared in Visual Basic) method for execution on the server. Syntax C# public InvokeServerMethodOperation InvokeServerMethodAsync( string fullTypeName, string methodName, Action<InvokeServerMethodOperation> userCallback, object userState, params object[] userArguments ) Parameters fullTypeName Assembly-qualified type name such as 'MyNamespace.Services, MyAssembly' methodName Name of method to be invoked userCallback Callback called when the operation completes userState Token identifying the asynchronous request userArguments Arguments to be passed to method
======================================================================
You can reference DevForce API Documentation at http://drc.ideablade.com/ApiDocumentation/webframe.html - http://drc.ideablade.com/ApiDocumentation/webframe.html
and also in your machine (installed with DevForce) at Start>Programs>DevForce2010>Documentation>API Documentation.
I am also attaching a simple Silverlight App invoking a Server Method based on the example in the http://drc.ideablade.com/xwiki/bin/view/Documentation/InvokeServerMethod - DevForce Resource Center .
You can download the sample http://ideablade.com/friends/SilverlightInvokeServerMethod.zip - here .
Silvio.
|