2016-08-31 3 views
1

非永続列の列を並べ替えることができません。 (DevExpress社eXpressAppフレームワーク(XAF)と永続オブジェクト(XPO)を発現する)私のコードここ DevExpress eXpressAppフレームワークとeXpress永続オブジェクト:列の問題をソート

[Association("PCs-Gs", typeof(Allotments))] 
public XPCollection<Allotments> PCs 
{ 
    get { return GetCollection<Allotments>("PCs"); } 
} 

[Association("SCs-Gs", typeof(Allotments))] 
public XPCollection<Allotments> SCs 
{ 
    get { return GetCollection<Allotments>("SCs"); } 
} 

XPCollection<Allotments> _allAllotmentsCore; 
public XPCollection<Allotments> AllAllotments 
{ 
    get 
     { 
      if (_allAllotmentsCore == null) 
       { 
       _allAllotmentsCore = new XPCollection<Allotments>(Session); 
       } 
       _allAllotmentsCore.Criteria = CriteriaOperator.Parse("PCGrower.Oid == ? OR SCGrower.Oid == ?", Oid); 
       _allAllotmentsCore.Sorting.Add(new SortProperty("Project.ProjectName", SortingDirection.Descending)); 

       PopulateCollection(_allAllotmentsCore); 
       return _allAllotmentsCore; 
     } 
} 

private void PopulateCollection(XPCollection<Allotments> sourceCollection) 
{ 
      sourceCollection.AddRange(PCs); 
      sourceCollection.AddRange(SCs); 
} 

性質

[PersistentAlias("PCs[Project is not null].Count")] // THIS IS WORKING 
//[PersistentAlias("AllAllotments[PCs.Project is not null].Count")] // THIS IS NOT WORKING 
public int myCustomProperties 
    { 
     get { return Convert.ToInt32(EvaluateAlias("myCustomProperties")); } 
    } 

非永続列に使用PersistentAliasが、私は、この列をソートすることができるかどうかを。そのためには、PersistentAliasにロジックを追加する必要があります。私の場合は

私は[PersistentAlias( '全体の論理')]のようなPersistentAliasにこのロジックを追加する必要が

ロジック

public int myCustomProperties 
    { 
       get 
       { 
        int _myCustomProperties = 0; 
        Projects project = null; 
        foreach (Allotments obj in AllAllotments) 
        { 
         if (project != obj.Project && obj.Project != null) 
         { 
          project = obj.Project; 
          _myCustomProperties += 1; 
         } 
        } 
        return _myCustomProperties ; 
       } 
    } 

はロジック

に注目しましょうAllAllotments(これはAssociationプロパティではありません)を使用しています。

[PersistentAlias( 'AllAllotmentsを使用])のように使用すると、エラーが発生します。

しかし私は[PersistentAlias( "use PCs")]のように使います。

PC(アソシエーションプロパティ)とAllAllotments(アソシエーションなし)のみ。

だから、私の質問:私はPersistentAliasにAllAllotmentsを使用するにはどうすればよい

誰でも知りたいですか?

答えて

1

無料で参加できます。 DevExpressのドキュメントから。 XPOで

は、あなたが 直接(明示的に定義された関連性を持っていません)関連していない永続オブジェクトに基づいた基準を構築することができます は使用して無料で参加します。本質的に、XPOでは、条件にある永続的な オブジェクトを結合し、それらのプロパティを使用して オブジェクトと一致する集約関数を計算し、結合結果として 集計値を返します。これを達成するには、 基準でJoinOperandsを使用します。あなたは、例えば、

CriteriaOperator criteria = 
CriteriaOperator.Parse("[<Orders>][^.EmployeeID = EmployeeID].Count() > 50"); 
XPCollection<Employee> employees = new XPCollection<Employee>(session, criteria); 

それとも、[PersistentAlias]内でそれらを使用することができ、基準にそれらを使用することができますいずれか

this item from the DevExpress support centerを参照してください。すべての物事DevExpress社で

public class Department : BaseObject 
{ 
    private System.Int32? _TotalPhoneNumbers; 
    [PersistentAlias("[<PhoneNumber>][Party.<Contact>Department.Oid = ^.Oid and PhoneType='1'].Count()")] 
    public System.Int32? TotalPhoneNumbers { 
     get { 
      if (_TotalPhoneNumbers == null) { 
       _TotalPhoneNumbers = (int?)EvaluateAlias("TotalPhoneNumbers"); 
      } 
      return _TotalPhoneNumbers; 
     } 
    } 
} 

、頼むのに最適な場所は、彼らのsupport centerです。