diff --git a/MachineTool/DemoBuildMachineTool.cs b/MachineTool/DemoBuildMachineTool.cs
index 18fb746..38467d2 100644
--- a/MachineTool/DemoBuildMachineTool.cs
+++ b/MachineTool/DemoBuildMachineTool.cs
@@ -23,9 +23,15 @@ namespace Sample.MachineTool
///
public class DemoBuildMachineTool : IGetCodeXyzabcMachineTool
{
- static DemoBuildMachineTool()
+ ///
+ /// Registers this type's deserializer with the given
+ /// (or when is
+ /// null). Idempotent.
+ ///
+ public static void Reg(XFactory factory = null)
{
- XFactory.Generators.Add(XName, (xml, baseDirectory, relFile, progress, res) => new DemoBuildMachineTool());
+ factory ??= XFactory.Default;
+ factory.Generators.TryAdd(XName, (xml, baseDirectory, relFile, progress, res) => new DemoBuildMachineTool());
}
///
/// Generates an XYZ-ABC machine tool instance from embedded resources.