.NET 學習

.NET 學習生活感想... 万事成蹉跎..... 贵在坚持 及时整理自己做过和学过的东西

博客园 首页 新随笔 联系 订阅 管理

1.语法

 

public object Evaluate( 
   Type objectType,  
   CriteriaOperator expression,  
   CriteriaOperator criteria 
);

 

Parameters

objectType

        A System.Type object that identifies the type of objects against which the expression will be evaluated.

expression
A DevExpress.Data.Filtering.CriteriaOperator object that specifies the expression to evaluate.
criteria
A DevExpress.Data.Filtering.CriteriaOperator object that specifies the filter criteria. The objects that match this criteria will be used to evaluate the expression.

Return Value

The value evaluated.

2.用法

      <1>
      

代码
using DevExpress.Xpo;
using DevExpress.Data.Filtering;

// A custom XPobject
class Person : XPObject {
   
//...
   bool isMale;
   
public bool IsMale {
      
get { return isMale; }
      
set { isMale = value; }
   }      
}

// Calculate the number of objects.
object count = Session.DefaultSession.Evaluate(typeof(Person), CriteriaOperator.Parse("Count()"), 
    CriteriaOperator.Parse(
"IsMale = true"))

    <2>

    

代码
using DevExpress.Data.Filtering;

//...

decimal sumPaid = (decimal)session.Evaluate<Order>(CriteriaOperator.Parse("Sum(OrderTotals)"), 
    
new BinaryOperator("OrderDate", DateTime.Today.AddDays(-10), BinaryOperatorType.Greater));

 

 

 

posted on 2010-05-28 15:22  Tonyyang  阅读(1084)  评论(0编辑  收藏  举报
欢迎转载,转载请注明出处:http://www.cnblogs.com/Tonyyang/