Distributor[] all = Distributor.FindAll();
foreach(Distributor distributor in all) {
Console.WriteLine(distributor.Name);
foreach(DeliveryMethod deliveryMethod in distributor.DeliveryMethods)
Console.WriteLine("--" + deliveryMethod.Description);
}
Here is what was added to the Distributor class:
public new static Distributor[] FindAll() { return FindAll(DetachedCriteria.For(typeof(Distributor)).SetResultTransformer(CriteriaUtil.DistinctRootEntity).SetFetchMode("DeliveryMethods", FetchMode.Eager)); }
I'm sure there's a way to include the same attribute on the DeliveryMethod and still get the results you want - I just haven't learned enough of the API yet to know how to do that. Tips are welcome..
No comments:
Post a Comment