DevForce Help Reference
PassthruEsqlQuery Class
Members  Example 


Used to execute an Entity SQL statement within the DevForce framework.
Object Model
PassthruEsqlQuery ClassEntityManager ClassParameterizedEsql ClassQueryStrategy Class
Syntax
'Declaration
 
Public Class PassthruEsqlQuery 
   Implements IEntityQuery, IUntypedEntityQuery, System.ICloneable 
'Usage
 
Dim instance As PassthruEsqlQuery
public class PassthruEsqlQuery : IEntityQuery, IUntypedEntityQuery, System.ICloneable  
Remarks
A PassthruEsqlQuery can be used to retrieve IEntity objects from an EntityManager. You might want to build an Entity SQL (eSQL) query instead of a standard EntityQuery for performance reasons or for complex eSQL statements. Queries are submitted using EntityManager.ExecuteQuery or one of the available overloads.

A PassthruEsqlQuery must always use a FetchStrategy of DataSourceOnly, and cannot be used when disconnected from the EntityServer.

Example
// Sample 1 - A sample PassthruEsqlQuery returning a SalesPerson entity.
private void Sample1() {
  AW2000Model.Manager mgr = new AW2000Model.Manager();

  // Create a parameter and the parameterized sql 
  QueryParameter param = new QueryParameter("bonus", 2000);
  ParameterizedEsql paramEsql = new ParameterizedEsql("SELECT VALUE sp FROM SalesPersons AS sp Where sp.Bonus > @bonus", param);

  // Create and execute the query
  var query = new PassthruEsqlQuery(typeof(SalesPerson), paramEsql);
  var results = mgr.ExecuteQuery(query);
}

// Sample 2 - a sample PassthruEsqlQuery returning a scalar value.
private void Sample2() {      
  AW2000Model.Manager mgr = new AW2000Model.Manager();
  
  // Create the query - note you must provide both the returnType and queryableType arguments here.
  var query = new PassthruEsqlQuery(typeof(Int32), typeof(Customer), 
      "SELECT VALUE Count(c.CustomerType) FROM Customers AS c Where c.CustomerID < 10");
      
  int result = mgr.ExecuteQuery(query).Cast<Int32>().First();
}
Inheritance Hierarchy

System.Object
   IdeaBlade.EntityModel.PassthruEsqlQuery

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PassthruEsqlQuery Members
IdeaBlade.EntityModel Namespace
EntityManager Property
IEntity Interface

Send Feedback