New Posts New Posts RSS Feed: Generating a Report Server-Side Using a Remote Procedure Call
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Generating a Report Server-Side Using a Remote Procedure Call

 Post Reply Post Reply
Author
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Topic: Generating a Report Server-Side Using a Remote Procedure Call
    Posted: 06-Jun-2007 at 3:38pm

Question:

We discussed “prefetching” the data with a spanned query to improve the performance of reports.  Can you give us an example of how that would work in an RPC scenario where we are handing the entire generation of the report off to an RPC process?

Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2007 at 3:41pm

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);

}

 


 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down