public List <T1> GetAll(ILocalization localization) { //Log.Instance.LogDebug("Reloading all entities of type "+ TypeAlias + " for store "+storeAlias); var examineResults = UmbracoStaticCachedEntityRepository.GetExamineResultsForNodeTypeAlias(TypeAlias); if (examineResults != null && examineResults.Any()) { return(examineResults.Select(e => CreateEntityFromExamineData(e, localization)).ToList()); } return(UmbracoStaticCachedEntityRepository.GetNodeIdsFromXMLStoreForNodeTypeAlias(TypeAlias).Select(id => CreateEntityFromNode(new Node(id), localization)).Where(e => e != null).ToList()); }
internal T1 CreateEntityFromNode(Node node, ILocalization localization) { if (node == null) { throw new Exception("Trying to load data from null node"); } if (node.NodeTypeAlias == null || (node.NodeTypeAlias != TypeAlias && !node.NodeTypeAlias.StartsWith(TypeAlias))) { return(null); } var entity = Activator.CreateInstance <T2>(); LoadDataFromNode(entity, node, localization); if (UmbracoStaticCachedEntityRepository.CheckNodeTypeAliasForImproperOverlap(entity.NodeTypeAlias, TypeAlias)) { return(entity); } return(null); }