Answer:
In DevForce v3.3.0, we introduced a third InvokeServerMethod signature on the PM:
public Object InvokeServerMethod(
ServerRpcPersistenceDelegate pDelegate,
params Object[] pArgs)
The signature takes in a ServerRpcPersistenceDelegate which was also introduced in v3.3.0:
public delegate Object ServerRpcPersistenceDelegate(
IPrincipal pPrincipal,
PersistenceManager pServerPersistenceManager,
params Object[] pArgs)
A PersistenceServer instance in the BOS applies any security constraints, and (if passed), will create a pre-authenticated serverside PersistenceManager and invoke the requested method
// Sample showing invocation of server method
bool reportGenerated =
(bool)mPm.InvokeServerMethod(new ServerRpcPersistenceDelegate(Report. GenerateSomeReport), new DateTime(1995, 1, 1), new DateTime(1999, 1, 1));
…
// Sample RPC method in Report class
[AllowRpc]
public static Object GenerateSomeReport(IPrincipal pPrincipal, PersistenceManager pPm, params Object[] pArgs) {
// Example report:
// Gather data for a report displaying:
// all Employees,
// all associated Orders (for given period),
// all associated Order details,
// all associated Products,
// and all associated Customers
RdbQuery query = new RdbQuery(typeof(Employee), Order.OrderDateEntityColumn,
EntityQueryOp.Between, pArgs);
query.AddSpan(EntityRelations.Employee_Order, EntityRelations.Order_OrderDetail,
EntityRelations.Product_OrderDetail);
query.AddSpan(EntityRelations.Employee_Order, EntityRelations.Customer_Order);
// Execute query and fill cache
EntityList<Employee> emps = pPm.GetEntities<Employee>(query);
// Invoke report generation. Passing in PM will enable the following report method
// to get all associated report data by performing QueryStrategy.CacheOnly queries.
return RunReport(pPm, //and any other report params needed);
}