/// <summary> /// Begins loading the collection of entities loader /// </summary> void loadEntitiesCollectionOnMainThread() { IEnumerable <IEntitiesLoaderDescription> entitiesLoader = loaderCollection.Where(x => !x.isLoaded); if (entitiesLoader == null) { return; } int currentLoadOrder = entitiesLoader.Min(x => x.loadOrder); IEntitiesLoaderDescription entitiesLoaderDescription = loaderCollection.First(x => x.loadOrder == currentLoadOrder); if (entitiesLoaderDescription.dependencyType != null) { if (loaderCollection.IsEntitiesLoaderExists(entitiesLoaderDescription.dependencyType)) { IEntitiesLoaderDescription dependentEntitiesLoaderDescription = loaderCollection.GetLoader(entitiesLoaderDescription.dependencyType); if (!dependentEntitiesLoaderDescription.isLoaded) { throw new InvalidOperationException("Dependent entities loader is sequenced after the current entities loader."); } else { entitiesLoaderDescription.CreateCollectionViewModel(); } } else { throw new InvalidOperationException("Dependent entities loader not added."); } } else { entitiesLoaderDescription.CreateCollectionViewModel(); } }