private static ICollection GetAllElementsCollection(CollectionType collectionType, object collection) { return collectionType.GetElementsCollection(collection); }
public static ICollection GetLoadedElementsCollection(CollectionType collectionType, object collection) { if (CollectionIsInitialized(collection)) { // handles arrays and newly instantiated collections return collectionType.GetElementsCollection(collection); } else { // does not handle arrays (that's ok, cos they can't be lazy) // or newly instantiated collections so we can do the cast return ((IPersistentCollection) collection).QueuedAddsCollection; } }