Filter child collection returned with Aggregate Root using Nhibernate

后端 未结 4 1329
小蘑菇
小蘑菇 2021-01-13 08:46

I\'m trying filter the child collection of an aggregate root when loading it with Nhibernate. Load a Customer with all their Orders that have been shipped. Is this possibl

4条回答
  •  日久生厌
    2021-01-13 09:14

    You could look at it the other way - load all the shipped orders for a Customer.

    session.CreateCriteria( typeOf(Order) )
        .Add( Restrictions.Eq("Shipped", shippedStatus ) )
        .Add( Restrictions.Eq("Customer", requiredCustomer) )
        .List();
    

提交回复
热议问题