update XML IO pattern.

This commit is contained in:
2026-05-24 14:06:51 +08:00
parent 058003f395
commit d7836db45f
314 changed files with 13376 additions and 573 deletions
@@ -180,9 +180,15 @@ namespace Sample.MachineTool
/// </remarks>
public class DemoBuildMachineTool : IGetCodeXyzabcMachineTool
{
static DemoBuildMachineTool()
/// <summary>
/// Registers this type's deserializer with the given <see cref="XFactory"/>
/// (or <see cref="XFactory.Default"/> when <paramref name="factory"/> is
/// <c>null</c>). Idempotent.
/// </summary>
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());
}
/// <summary>
/// Generates an XYZ-ABC machine tool instance from embedded resources.
@@ -409,6 +415,40 @@ namespace Sample.MachineTool
<a id="Sample_MachineTool_DemoBuildMachineTool_Reg_" data-uid="Sample.MachineTool.DemoBuildMachineTool.Reg*"></a>
<h3 id="Sample_MachineTool_DemoBuildMachineTool_Reg_Hi_Common_XmlUtils_XFactory_" data-uid="Sample.MachineTool.DemoBuildMachineTool.Reg(Hi.Common.XmlUtils.XFactory)">
Reg(XFactory)
</h3>
<div class="markdown level1 summary"><p>Registers this type's deserializer with the given <a class="xref" href="../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a>
(or <a class="xref" href="../api/Hi.Common.XmlUtils.XFactory.html#Hi_Common_XmlUtils_XFactory_Default">Default</a> when <code class="paramref">factory</code> is
<code>null</code>). Idempotent.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void Reg(XFactory factory = null)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>factory</code> <a class="xref" href="../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a></dt>
<dd></dd>
</dl>
<a id="Sample_MachineTool_DemoBuildMachineTool_ToXElement_" data-uid="Sample.MachineTool.DemoBuildMachineTool.ToXElement*"></a>
<h3 id="Sample_MachineTool_DemoBuildMachineTool_ToXElement" data-uid="Sample.MachineTool.DemoBuildMachineTool.ToXElement">