Ejemplo n.º 1
0
        private static INakedObjectAssociation[] CollectionAssociations(INakedObject[] collection,
                                                                        INakedObjectSpecification collectionSpec,
                                                                        Func<INakedObjectAssociation, bool> filter,
                                                                        Func<INakedObjectAssociation, int> order) {
            IEnumerable<INakedObjectAssociation> assocs = collectionSpec.Properties.Where(filter).Where(a => collection.Any(item => a.IsVisible(NakedObjectsContext.Session, item)));

            if (order != null) {
                assocs = assocs.OrderBy(order);
            }

            return assocs.ToArray();
        }