Print Page | Close Window

Generating a Report Server-Side Using a Remote Procedure Call

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=66
Printed Date: 12-Jun-2026 at 9:59am


Topic: Generating a Report Server-Side Using a Remote Procedure Call
Posted By: Customer
Subject: Generating a Report Server-Side Using a Remote Procedure Call
Date 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?




Replies:
Posted By: IdeaBlade
Date 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);

}

 


 




Print Page | Close Window