Fixes packager to ensure the GUIDs are used for all entities where possible (#10477)
* Clean up and changes to backoffice for the nuget only packages * temp commit of package logic removal * Lots of package code cleanup and removal * Removes old package data from the test package xml * Updates packaging code to take in XDocument instead of a file since we'll not be dealing with files, starts creating expressions for the package migrations scripting. * fixing tests * Fixes runtime state and boot failed middleware so that it actually runs. Separates out unattended install/upgrade into notification handlers. * Gets unattended package migrations working and running * Gets embedded package.xml resources able to install from package migration. * Implements automatic package migrations for package that just declare an xml data manifest. * fix build * small cleanups * fix build * adds some tests * Fix export test * Fix newlines in test for linux * Typo * removes old todos and updates AutomaticPackgeMigrationPlan to use getter with backing field. * Update dictionary package data to use GUID * Ensures macros are packaged and used with their GUID * Ensures the GUID for doc types and media types remains consistent for package installation based on what is in the xml. * fix automatic migrations to not validate initial state, fixes packaging GUIDs for multiple entities. * Added guids to embedded test packages (Some tests are still failing) * Fix one more test * Fixes up Key vs Id, moves tests to correct namespace, fix tests * Fixes Dictionary packaging to ensure an xml hierarchy * Fixes tests * fixes package xml Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Umbraco.
|
||||
// Copyright (c) Umbraco.
|
||||
// See LICENSE for more details.
|
||||
|
||||
using System;
|
||||
@@ -234,6 +234,33 @@ namespace Umbraco.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
public static T RequiredAttributeValue<T>(this XElement xml, string attributeName)
|
||||
{
|
||||
if (xml == null)
|
||||
{
|
||||
throw new ArgumentNullException("xml");
|
||||
}
|
||||
|
||||
if (xml.HasAttributes == false)
|
||||
{
|
||||
throw new InvalidOperationException($"{attributeName} not found in xml");
|
||||
}
|
||||
|
||||
if (xml.Attribute(attributeName) == null)
|
||||
{
|
||||
throw new InvalidOperationException($"{attributeName} not found in xml");
|
||||
}
|
||||
|
||||
var val = xml.Attribute(attributeName).Value;
|
||||
var result = val.TryConvertTo<T>();
|
||||
if (result.Success)
|
||||
{
|
||||
return result.Result;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"{val} attribute value cannot be converted to {typeof(T)}");
|
||||
}
|
||||
|
||||
public static T AttributeValue<T>(this XElement xml, string attributeName)
|
||||
{
|
||||
if (xml == null) throw new ArgumentNullException("xml");
|
||||
@@ -249,6 +276,7 @@ namespace Umbraco.Extensions
|
||||
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public static T AttributeValue<T>(this XmlNode xml, string attributeName)
|
||||
{
|
||||
if (xml == null) throw new ArgumentNullException("xml");
|
||||
|
||||
Reference in New Issue
Block a user