IdeaBlade DevForce 2010 Help Reference
PassthruEsqlQuery Class
Members  Example  See Also  Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace : PassthruEsqlQuery Class



Used to execute an Entity SQL statement within the DevForce framework.

Object Model

PassthruEsqlQuery ClassEntityManager ClassParameterizedEsql ClassQueryStrategy Class

Syntax

Visual Basic (Declaration) 
Public Class PassthruEsqlQuery 
   Implements IEntityQueryIUntypedEntityQuerySystem.ICloneable 
Visual Basic (Usage)Copy Code
Dim instance As PassthruEsqlQuery
C# 
public class PassthruEsqlQuery : IEntityQueryIUntypedEntityQuerySystem.ICloneable  
C++/CLI 
public ref class PassthruEsqlQuery : public IEntityQueryIUntypedEntityQuerySystem.ICloneable  

Example

C#Copy Code
// 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();
}

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.

Inheritance Hierarchy

System.Object
   IdeaBlade.EntityModel.PassthruEsqlQuery

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.