Skip to content

Commit 178731f

Browse files
committed
Fix for XmlSerialiser
1 parent ad06f44 commit 178731f

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Framework.Shared/Serialisation/XmlSerialiser.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Xml;
23
using System.Xml.Serialization;
34

@@ -10,6 +11,8 @@ namespace OmniBus.Framework.Serialisation
1011
public class XmlSerialiser<TConfig> : ISerialiser<TConfig>
1112
where TConfig : new()
1213
{
14+
private static readonly Lazy<string> RootName = new Lazy<string>(() => new XmlSerialiser<TConfig>().Serialise(new TConfig()).Name);
15+
1316
/// <summary>
1417
/// Serialise an object to an Xml Element
1518
/// </summary>
@@ -41,7 +44,7 @@ public TConfig Deserialise(XmlNode node)
4144
}
4245

4346
var doc = new XmlDocument();
44-
doc.LoadXml($"<Config>{node.InnerXml}</Config>");
47+
doc.LoadXml($"<{RootName.Value}>{node.InnerXml}</{RootName.Value}>");
4548
if (doc.DocumentElement == null)
4649
{
4750
return new TConfig();

Scripts/Install.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@echo off
2+
powershell "gci . -Recurse | Unblock-File"
23
powershell "Start-Process -FilePath powershell.exe -ArgumentList '%~fs0\..\Scripts\Install.ps1', 'PROJECT', 'PROJECT' -verb RunAs -Wait"

Scripts/Uninstall.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@echo off
2+
powershell "gci . -Recurse | Unblock-File"
23
powershell "Start-Process -FilePath powershell.exe -ArgumentList '%~fs0\..\Scripts\Uninstall.ps1', 'PROJECT' -verb RunAs -Wait"

0 commit comments

Comments
 (0)