public IEnumerable <PackageDefinition> GetAll() { Sql <ISqlContext> query = new Sql <ISqlContext>(_umbracoDatabase !.SqlContext) .Select <CreatedPackageSchemaDto>() .From <CreatedPackageSchemaDto>() .OrderBy <CreatedPackageSchemaDto>(x => x.Id); var packageDefinitions = new List <PackageDefinition>(); List <CreatedPackageSchemaDto> xmlSchemas = _umbracoDatabase.Fetch <CreatedPackageSchemaDto>(query); foreach (CreatedPackageSchemaDto packageSchema in xmlSchemas) { var packageDefinition = _xmlParser.ToPackageDefinition(XElement.Parse(packageSchema.Value)); if (packageDefinition is not null) { packageDefinition.Id = packageSchema.Id; packageDefinition.Name = packageSchema.Name; packageDefinition.PackageId = packageSchema.PackageId; packageDefinitions.Add(packageDefinition); } } return(packageDefinitions); }
public IEnumerable <PackageDefinition?> GetAll() { XDocument packagesXml = EnsureStorage(out _); if (packagesXml?.Root == null) { yield break; } foreach (XElement packageXml in packagesXml.Root.Elements("package")) { yield return(_parser.ToPackageDefinition(packageXml)); } }