2011-12-16 8 views
0

カスタマーオブジェクト内のすべての注文のすべての明細を取得するにはどうすればよいですか?LLBLGen - メモリ内のエンティティコレクションに対して選択

私は

grdView.DataSource = customer.Orders. 

をしようとしていますが、受注後、私が得るすべては私がLineItemsにコレクションを見ていない...「GetMulti」です。

私は一桁

grdView.DataSource = customer.Orders(0).LineItems 

のためにこれをやって理解することができますが、どのように私はすべての注文のためのすべてのLineItemsを得るのですか?

  • 私は私は2

を注文するアイテムを追加注文2

  • を作成したため1
  • に項目を追加したため1
  • を添加顧客オブジェクト
  • を作成私のエンティティはCustomer、Order、LineItemです

    すべてを表示したい保存する前に、lineitemsはgridviewにあります。 llblgen proランタイムを使用してこれを行うにはどうすればよいですか?

  • 答えて

    1

    すべてのLineItemエンティティを取得するには、リレーションとフィルタを使用してLineItemCollectionにデータを設定する必要があります。 Here is the LLBLGen Documentation for multi-entity filters.必要な特定の顧客の結果をフィルタリングできるようにするには、関連するエンティティを取得するために関係を追加する必要があります。

    (これはSelfServicingを使用していることを前提とします。アダプタのマニュアルを参照してください。)

    // Make a link through relations from LineItem to Order to Customer 
    RelationCollection relations = new RelationCollection(); 
    relations.Add(LineItemEntity.Relations.OrderEntityUsingLineItemId); 
    relations.Add(OrderEntity.Relations.CustomerEntityUsingOrderId); 
    
    // Filter on the customer id 
    PredicateExpression filter = new PredicateExpression(); 
    filter.Add(CustomerFields.CustomerId == CustomerId); 
    
    // Get LineItems based on the relations and filters above 
    LineItemCollection collection = new LineItemCollection(); 
    collection.GetMulti(filter, 0, null, relations); 
    
    関連する問題